jipiboily/monologue

View on GitHub
app/views/monologue/sidebar/_archive.html.erb

Summary

Maintainability
Test Coverage
<%= sidebar_section_for(t(".archive")) do  %>
  <div class="archive">
    <ul>
      <% DateTime.now.year.downto(@first_post_year) do |year| %>
        <li>
          <span class="js-year blog-year" ><%= year %></span>
          <ul class="js-months" style="display:none">
            <% 12.downto(1) do |month|
                year_month = "#{year} #{month}"
              %>
              <% if @archive_posts[year_month]%>
                <li>
                  <span class="js-month blog-month" ><%= Date::MONTHNAMES[month] %></span>
                  <ul class="js-posts" style="display:none">
                    <% @archive_posts[year_month].sort.reverse.each do |post| %>
                      <li><%= link_to post.title, post.full_url %></li>
                    <% end %>
                  </ul>
                </li>
              <% end %>
            <% end %>
          </ul>
        </li>
      <% end %>
    </ul>
  </div>
<% end  %>