Refactor and extract code to partials.
This commit is contained in:
25
app/views/topics/_topic.html.erb
Normal file
25
app/views/topics/_topic.html.erb
Normal 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>
|
||||
<%= link_to t("community.show.topic.comments", count: topic.comments_count), community_topic_path(@community, topic, anchor: "comments") %>
|
||||
<span class="bullet"> • </span>
|
||||
<%= I18n.l topic.created_at.to_date %>
|
||||
<span class="bullet"> • </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>
|
||||
Reference in New Issue
Block a user