From 140759127d15e58b905276896b78b847f4ce6ca5 Mon Sep 17 00:00:00 2001 From: bachtsui Date: Fri, 5 Feb 2016 14:22:40 -0800 Subject: [PATCH 1/2] Testing --- 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..a65c419b8 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 } From 5ac34295c001805d9f20c0287d87e26ced5cfdf2 Mon Sep 17 00:00:00 2001 From: bachtsui Date: Fri, 5 Feb 2016 14:39:44 -0800 Subject: [PATCH 2/2] Same changes from Issue 2 --- .../app/views/archives_sidebar/_content.html.erb | 2 +- lib/archives_sidebar/lib/archives_sidebar.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 %> diff --git a/lib/archives_sidebar/lib/archives_sidebar.rb b/lib/archives_sidebar/lib/archives_sidebar.rb index a65c419b8..74655138c 100644 --- a/lib/archives_sidebar/lib/archives_sidebar.rb +++ b/lib/archives_sidebar/lib/archives_sidebar.rb @@ -30,7 +30,7 @@ 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) + month = entry.month.to_i year = entry.year.to_i { name: I18n.l(Date.new(year, month), format: '%B %Y'),