Skip to content

Instantly share code, notes, and snippets.

@hogihung
Created March 24, 2014 01:31
Show Gist options
  • Save hogihung/9732669 to your computer and use it in GitHub Desktop.
Save hogihung/9732669 to your computer and use it in GitHub Desktop.
Bloccit Topic#Show
<h1><%= @topic.name %></h1>
<% if policy(@topic).update? %>
<%= link_to "Edit Topic", edit_topic_path, class: 'btn btn-success' %>
<% end %>
<div class="row">
<div class="col-md-8">
<p class="lead"><%= @topic.description %></p>
<% @posts.each do |post| %>
<div class="media">
<div class="media-body">
<h4 class="media-heading">
<%= link_to (markdown post.title), [@topic, post] %>
<%= image_tag(post.image) if post.image? %>
</h4>
<small>
<%= image_tag(post.user.avatar.tiny.url) if post.user.avatar? %>
submitted <%= time_ago_in_words(post.created_at) %> ago by
<%= post.user.name %><br />
<%= post.comments.count %> Comments
</small>
</div>
</div>
<% end %>
<%= will_paginate @posts %>
</div>
<div class="col-md-4">
<% if policy(Post.new).create? %>
<%= link_to "New Post", new_topic_post_path(@topic), class: 'btn btn-success' %>
<% end %>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment