Skip to content

Fix #2: Top Month Always Empty (archives_sidebar) #33

Open
tbduong wants to merge 2 commits intosf-wdi-30:masterfrom
tbduong:archive_sidebar
Open

Fix #2: Top Month Always Empty (archives_sidebar) #33
tbduong wants to merge 2 commits intosf-wdi-30:masterfrom
tbduong:archive_sidebar

Conversation

@tbduong
Copy link
Copy Markdown

@tbduong tbduong commented Sep 2, 2016

Fix for issue #2.
Issue: The top month of the archive month is always empty.

In archives_sidebar/_content.html.erb, line 8. Resolved-- by deleting +1 :
<%= 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]) ) %>

This line included a +1 to month. This resulted in an off-by-1 error, which essentially pulls in article(s) from the NEXT month, which have not yet been published. By removing the +1, the top month is no longer empty. (although now I see a routing issue, where the month # in the route does not match the # of the current month.

<% unless sidebar.archives.blank? %>
<h3 class="sidebar_title"><%= sidebar.title %></h3>
<div class="sidebar_body">
<h3 class="sidebar-title"><%= sidebar.title %></h3>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

How are these class changes relevant to the ordering of articles?

@nathanallen
Copy link
Copy Markdown

Nice catch that the route doesn't match!

@tbduong
Copy link
Copy Markdown
Author

tbduong commented Sep 2, 2016

Would the route need to get corrected for the pull request accept? Or are we okay to merge?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants