Refactor and extract code to partials.

This commit is contained in:
taitus
2017-09-06 14:41:58 +02:00
parent 79d4a82bfa
commit f0667937fb
5 changed files with 64 additions and 63 deletions

View File

@@ -0,0 +1,25 @@
<div id="<%= dom_id(topic) %>" class="panel column">
<div class="small-8 column">
<h3><%= link_to topic.title, community_topic_path(@community, topic) %></h3>
<p class="topic-info">
<span class="icon-comments"></span>&nbsp;
<%= link_to t("community.show.topic.comments", count: topic.comments_count), community_topic_path(@community, topic, anchor: "comments") %>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<%= I18n.l topic.created_at.to_date %>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<%= topic.author.name %>
</p>
</div>
<div class="small-4 column text-right">
<% if topic.author == current_user %>
<%= link_to t("community.show.topic.edit_button"), edit_community_topic_path(@community.id, topic), class: 'button small hollow' %>
<%= link_to t("community.show.topic.destroy_button"), community_topic_path(@community.id, topic), method: :delete, class: 'button hollow alert small' %>
<% end %>
</div>
</div>