summaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2018-05-25 13:31:07 +0200
committerMichał Górny <mgorny@gentoo.org>2018-05-25 13:32:41 +0200
commit1852a5892e2f4b0555f47118cd02500c0dd08071 (patch)
tree00ca72913d8e353948f0683246f2ba9af27cc1a8 /views
parentReplace redirect on no threads with inline display (diff)
downloadfrontend-1852a5892e2f4b0555f47118cd02500c0dd08071.tar.gz
frontend-1852a5892e2f4b0555f47118cd02500c0dd08071.tar.bz2
frontend-1852a5892e2f4b0555f47118cd02500c0dd08071.zip
Remove the awful redirect on no messages in month
The redirect when no messages are found in month is awfully irritating, given that it rewrites the whole URL. Furthermore, it logically can only happen when someone types the URL manually which makes redirecting really silly. Instead, just display the 'no messages' message along with empty message list. Implicitly, this also adds a message when someone goes beyond last page. Currently, he seems only blank list. Bug: https://bugs.gentoo.org/656386
Diffstat (limited to 'views')
-rw-r--r--views/listindex.erb8
-rw-r--r--views/listmonth.erb12
2 files changed, 10 insertions, 10 deletions
diff --git a/views/listindex.erb b/views/listindex.erb
index 30a0a17..32df615 100644
--- a/views/listindex.erb
+++ b/views/listindex.erb
@@ -1,11 +1,5 @@
<h1 class="first-header">Gentoo Archives: <%= list %></h1>
-<% if params[:no_messages] %>
-<div class="alert alert-warning">
- There are no messages in the archive for the requested month.
-</div>
-<% end %>
-
<table class="table">
<tr>
<th>Month</th>
@@ -18,4 +12,4 @@
<td><%= month['doc_count'] %></td>
</tr>
<% end %>
-</table> \ No newline at end of file
+</table>
diff --git a/views/listmonth.erb b/views/listmonth.erb
index b7ef11c..020c340 100644
--- a/views/listmonth.erb
+++ b/views/listmonth.erb
@@ -6,10 +6,16 @@
<%= partial :views, locals: { list: list, mode: mode } %>
-<% if no_threads %>
-<div class="alert alert-info">
- There were no threads that started this month, showing you all messages instead.
+<% if results['hits']['total'] == 0 %>
+<div class="alert alert-warning">
+ There are no messages in the archive for the requested month.
</div>
+<% else %>
+ <% if no_threads %>
+ <div class="alert alert-info">
+ There were no threads that started this month, showing you all messages instead.
+ </div>
+ <% end %>
<% end %>
<div class="table-responsive">