Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tbduong
Copy link

@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.

@@ -1,11 +1,11 @@
<% unless sidebar.archives.blank? %>
<h3 class="sidebar_title"><%= sidebar.title %></h3>
<div class="sidebar_body">
<h3 class="sidebar-title"><%= sidebar.title %></h3>

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

Nice catch that the route doesn't match!

@tbduong
Copy link
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