public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Alex Legler" <a3li@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/ag-web:master commit in: views/, /
Date: Sun, 22 Feb 2015 00:29:11 +0000 (UTC)	[thread overview]
Message-ID: <1424564934.35278c94afd68d99416398e4dff1a9a5499db8f4.a3li@gentoo> (raw)

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>


                 reply	other threads:[~2015-02-22  0:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1424564934.35278c94afd68d99416398e4dff1a9a5499db8f4.a3li@gentoo \
    --to=a3li@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox