Skip to content

Instantly share code, notes, and snippets.

@vanakenm
Last active December 19, 2015 05:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vanakenm/5903451 to your computer and use it in GitHub Desktop.
Save vanakenm/5903451 to your computer and use it in GitHub Desktop.
<% content_for :header do %>
<%= javascript_include_tag "filters" %>
<% end %>
<h1>Show posts</h1>
<header>
<section id="statistics">
<p>Currently <%= @posts.size %> in <%= @posts.map(&:category).uniq.size %> different categories.</p>
<p>Most recent category: <%= @posts.first.category %>
</section>
<section id="filters">
<div class="btn-group sort">
<a class="btn dropdown-toogle" data-toogle="dropdown" href="#">All categories <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a data-filter-category="all_filter" href="#">All categories</a></li>
<li><a data-filter-category="opinion" href="#">Opinion</a></li>
<li><a data-filter-category="announcement" href="#">Announcement</a></li>
<li><a data-filter-category="debate" href="#">Debate</a></li>
</ul>
</div>
</section>
</header>
<% @posts.each do |post| %>
<article data-category="<%= post.category %>">
<header>
<h1><%= post.title %></h1>
<h2>By <%= post.author %></h2>
</header>
<section class="contents">
<%= post.contents %>
</section>
<footer>
Published on <%= post.publish_date %>
</footer>
</article>
<% end %>
</table>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment