diff options
-rw-r--r-- | ag-web.rb | 9 | ||||
-rw-r--r-- | views/listindex.erb | 8 | ||||
-rw-r--r-- | views/listmonth.erb | 12 |
3 files changed, 10 insertions, 19 deletions
@@ -125,10 +125,6 @@ get '/:list/threads/:year-:month/:page?' do if result['hits']['total'] == 0 result = messages_in_month(params[:list], params[:year], params[:month], current_page) no_threads = true - if result['hits']['total'] == 0 - redirect '/%s/?no_messages=1' % params[:list] - return - end end max_pages = (result['hits']['total'].to_f / PER_PAGE).ceil @@ -163,11 +159,6 @@ get '/:list/messages/:year-:month/:page?' do result = messages_in_month(params[:list], params[:year], params[:month], current_page) max_pages = (result['hits']['total'].to_f / PER_PAGE).ceil - if result['hits']['total'] == 0 - redirect '/%s/?no_messages=1' % params[:list] - return - end - erb :listmonth, locals: { results: result, list: params[:list], 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"> |