Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/assets/stylesheets/sidebar_admin.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,7 @@
display: inline-block;
}
}

h3.sidebar_title {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this css style relevant to issue #2?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not, didn't see that I changed that in Master my bad.

font-family: monospace;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% unless sidebar.asins.empty? %>
<h3 class="sidebar-title"><%= h sidebar.title %></h3>
<h3 class="sidebar_title"><%= h sidebar.title %></h3>
<div class="sidebar-body" id="amazon_links">
<% for asin in sidebar.asins %>
<% url = "http://rcm.amazon.com/e/cm?t=#{@sidebar.associate_id}&o=1&p=8&l=as1&asins=#{asin}&fc1=000000&IS2=1&lt1=_blank&lc1=0000ff&bc1=000000&bg1=ffffff&f=ifr" %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<% unless sidebar.archives.blank? %>
<h3 class="sidebar_title"><%= sidebar.title %></h3>
<div class="sidebar_body">
<ul id="archives">
<div class="sidebar-body">

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does changing the class here really help display the right months?

<ul>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you sure this is an unused ID?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<% sidebar.archives.each do |month| %>
<% counter = sidebar.show_count ? "<em>(#{month[:article_count]})</em>" : "" %>
<li>
<%= 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]) ) %>
</li>
<% end %>
</ul>
Expand Down
4 changes: 2 additions & 2 deletions lib/archives_sidebar/lib/archives_sidebar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down