* [gentoo-commits] proj/ag-web:master commit in: views/, /
@ 2015-02-22 0:29 Alex Legler
0 siblings, 0 replies; only message in thread
From: Alex Legler @ 2015-02-22 0:29 UTC (permalink / raw
To: gentoo-commits
commit: 35278c94afd68d99416398e4dff1a9a5499db8f4
Author: Alex Legler <alex <AT> a3li <DOT> li>
AuthorDate: Sun Feb 22 00:28:54 2015 +0000
Commit: Alex Legler <a3li <AT> gentoo <DOT> org>
CommitDate: Sun Feb 22 00:28:54 2015 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/ag-web.git;a=commit;h=35278c94
show raw mesages if there are no threads
---
ag-web.rb | 5 +++++
views/listmonth.erb | 6 ++++++
2 files changed, 11 insertions(+)
diff --git a/ag-web.rb b/ag-web.rb
index b178b71..182d269 100644
--- a/ag-web.rb
+++ b/ag-web.rb
@@ -106,6 +106,11 @@ get '/:list/threads/:year-:month/:page?' do
result = threads_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 to("/%s/messages/%s-%s?no_threads=1" % [params[:list], params[:year], params[:month]])
+ return
+ end
+
erb :listmonth, locals: { results: result, list: params[:list], current_page: current_page, max_pages: max_pages, mode: :threads }
rescue => e
$stderr.puts e.to_s
diff --git a/views/listmonth.erb b/views/listmonth.erb
index 4cdabe3..a986eb8 100644
--- a/views/listmonth.erb
+++ b/views/listmonth.erb
@@ -6,6 +6,12 @@
<%= partial :views, locals: { list: list, mode: mode } %>
+<% if params[:no_threads] %>
+<div class="alert alert-info">
+ There were no threads that started this month, showing you all messages instead.
+</div>
+<% end %>
+
<table class="table table-condensed table-hover ag-message-table">
<tr>
<th class="ag-message-table-subject">Subject</th>
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-02-22 0:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-22 0:29 [gentoo-commits] proj/ag-web:master commit in: views/, / Alex Legler
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox