Skip to content

Commit 4b29946

Browse files
committed
NO PEEKING - manufacture nasty bug
1 parent f32293b commit 4b29946

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

app/controllers/setup_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def update_or_create_first_post_with_user(user)
5252
allow_pings: 1,
5353
published: 1,
5454
permalink: 'hello-world',
55-
tags: [Tag.first],
55+
tags: [Tag.create(name: 'general', display_name: 'General')],
5656
user: user)
5757
end
5858
end

lib/archives_sidebar/app/views/archives_sidebar/_content.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<% sidebar.archives.each do |month| %>
66
<% counter = sidebar.show_count ? "<em>(#{month[:article_count]})</em>" : "" %>
77
<li>
8-
<%= link_to"#{month[:name]} #{counter}".html_safe, articles_by_month_path(month[:year], "%02i" % month[:month]) %>
8+
<%= link_to"#{month[:name]} #{counter}".html_safe, articles_by_month_path( month[:year], "%02i" % (month[:month]+1) ) %>
99
</li>
1010
<% end %>
1111
</ul>

lib/archives_sidebar/lib/archives_sidebar.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ class ArchivesSidebar < Sidebar
22
description 'Displays links to monthly archives'
33
setting :title, 'Archives'
44
setting :show_count, true, label: 'Show article counts', input_type: :checkbox
5-
setting :count, 10, label: 'Number of Months'
5+
setting :count, 12, label: 'Number of Months'
66

77
attr_accessor :archives
88

@@ -30,11 +30,11 @@ def parse_request(_contents, _params)
3030
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])
3131

3232
@archives = article_counts.map do |entry|
33-
month = entry.month.to_i
33+
month = (entry.month.to_i%12)+1
3434
year = entry.year.to_i
3535
{
3636
name: I18n.l(Date.new(year, month), format: '%B %Y'),
37-
month: month,
37+
month: month - 1,
3838
year: year,
3939
article_count: entry.count
4040
}

0 commit comments

Comments
 (0)