From 86249df3d09bb2bc3fccaa704dba44f22b73da0c Mon Sep 17 00:00:00 2001 From: anonym0us3 Date: Fri, 5 Feb 2016 14:37:37 -0800 Subject: [PATCH 1/2] adjusted partial to have the link go to the correct month --- .../app/views/archives_sidebar/_content.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/archives_sidebar/app/views/archives_sidebar/_content.html.erb b/lib/archives_sidebar/app/views/archives_sidebar/_content.html.erb index 7d74c3347..6a8a29b1a 100644 --- a/lib/archives_sidebar/app/views/archives_sidebar/_content.html.erb +++ b/lib/archives_sidebar/app/views/archives_sidebar/_content.html.erb @@ -5,7 +5,7 @@ <% sidebar.archives.each do |month| %> <% counter = sidebar.show_count ? "(#{month[:article_count]})" : "" %>
  • - <%= link_to"#{month[:name]} #{counter}".html_safe, articles_by_month_path( month[:year], "%02i" % (month[:month]+1) ) %> + <%= link_to"#{month[:name]} #{counter}".html_safe, articles_by_month_path( month[:year], "%02i" % (month[:month]) ) %>
  • <% end %> From 774bb747fecbafb9def8f32db39e1fc0b3ab2ba3 Mon Sep 17 00:00:00 2001 From: anonym0us3 Date: Fri, 5 Feb 2016 14:38:42 -0800 Subject: [PATCH 2/2] fixed ruby files to not mess with the incoming month infos. since the incoming year is correct (and is NOT being messed with), the months should be treated accordingly --- lib/archives_sidebar/lib/archives_sidebar.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/archives_sidebar/lib/archives_sidebar.rb b/lib/archives_sidebar/lib/archives_sidebar.rb index b77559ca6..74655138c 100644 --- a/lib/archives_sidebar/lib/archives_sidebar.rb +++ b/lib/archives_sidebar/lib/archives_sidebar.rb @@ -30,11 +30,11 @@ def parse_request(_contents, _params) article_counts = Content.find_by_sql(["select count(*) as count, #{date_func} from contents where type='Article' and published = ? and published_at < ? group by year,month order by year desc,month desc limit ? ", true, Time.now, count.to_i]) @archives = article_counts.map do |entry| - month = (entry.month.to_i%12)+1 + month = entry.month.to_i year = entry.year.to_i { name: I18n.l(Date.new(year, month), format: '%B %Y'), - month: month - 1, + month: month, year: year, article_count: entry.count }