diff options
author | 2015-02-23 01:11:38 +0100 | |
---|---|---|
committer | 2015-02-23 01:11:38 +0100 | |
commit | 43d37380314a9066b1e20255bf152b8d0ca6fc5b (patch) | |
tree | 4350027d7f0384256bc82e07cc5b16a8999df496 /ag-web.rb | |
parent | Move full archives list to a separate page (diff) | |
download | frontend-43d37380314a9066b1e20255bf152b8d0ca6fc5b.tar.gz frontend-43d37380314a9066b1e20255bf152b8d0ca6fc5b.tar.bz2 frontend-43d37380314a9066b1e20255bf152b8d0ca6fc5b.zip |
Redirect back to the main list page if there are no messages at all in a given month
Diffstat (limited to 'ag-web.rb')
-rw-r--r-- | ag-web.rb | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -130,6 +130,11 @@ 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], current_page: current_page, max_pages: max_pages, mode: :messages } rescue => e $stderr.puts e.to_s |