2019-08-15 12:41:06 -05:00
|
|
|
<%- if @list && @list.topics.present? %>
|
2019-11-01 14:19:10 -05:00
|
|
|
<%- if @allow_create %>
|
|
|
|
<%= link_to @create_url, target: "_blank" do |link| %>
|
|
|
|
<button class="new-topic-btn btn btn-primary">
|
|
|
|
<span class="new-topic-btn__icon"></span>
|
|
|
|
<span class="new-topic-btn__text"><%= I18n.t('embed.new_topic') %></span>
|
|
|
|
</button>
|
|
|
|
<%- end %>
|
|
|
|
<%- end %>
|
2019-08-29 11:52:38 -05:00
|
|
|
<div class='topics-list' data-embed-state='loaded' <%- if @embed_id %>data-embed-id="<%= @embed_id %>"<%- end %>>
|
2019-08-15 12:41:06 -05:00
|
|
|
<%- @list.topics.each do |t| %>
|
2019-08-29 11:52:38 -05:00
|
|
|
<div class='topic-list-item'>
|
2019-09-02 09:25:44 -05:00
|
|
|
<%- if @template == "complete" %>
|
|
|
|
<div class='main-link'>
|
2019-09-09 11:03:53 -05:00
|
|
|
<div class="topic-column-wrapper">
|
|
|
|
<div class='topic-column details-column'>
|
2019-09-04 09:51:58 -05:00
|
|
|
<div class='topic-title-link'>
|
|
|
|
<a target="_parent" href="<%= t.url %>" class="title raw-link raw-topic-link" data-topic-id="<%= t.id %>"><%= t.title %></a>
|
2019-09-02 09:25:44 -05:00
|
|
|
</div>
|
2019-09-04 09:51:58 -05:00
|
|
|
|
|
|
|
<%- if t.posts_count > 1 %>
|
|
|
|
<div class="topic-last-posted-at" title="<%= t.last_posted_at.strftime("%B %e, %Y %l:%M%P") %>">
|
|
|
|
<%= "#{I18n.t('embed.last_reply')} #{time_ago_in_words(t.last_posted_at, scope: :'datetime.distance_in_words_verbose')}" %>
|
|
|
|
</div>
|
|
|
|
<%- end %>
|
|
|
|
<div class='topic-author-avatar-timestamp'>
|
2019-09-05 19:53:07 -05:00
|
|
|
<img src="<%= t.user.avatar_template.gsub('{size}', '40') %>">
|
2019-09-05 12:13:38 -05:00
|
|
|
<span class="topic-author-username">
|
|
|
|
<%= t.user.username %>
|
|
|
|
</span>
|
2019-09-04 09:51:58 -05:00
|
|
|
<span class="topic-created-at" title="<%= t.created_at.strftime("%B %e, %Y %l:%M%P") %>">
|
|
|
|
<%= "#{I18n.t('embed.created')} #{time_ago_in_words(t.created_at, scope: :'datetime.distance_in_words_verbose')}" %>
|
|
|
|
</span>
|
2019-09-02 09:25:44 -05:00
|
|
|
</div>
|
2019-09-04 09:51:58 -05:00
|
|
|
<div class='topic-stats'>
|
|
|
|
<%- if t.like_count > 0 %>
|
|
|
|
<div class='topic-like-count'>
|
|
|
|
<%= I18n.t('embed.likes', count: t.like_count) %>
|
|
|
|
</div>
|
|
|
|
<%- end %>
|
|
|
|
<%- if t.posts_count > 1 %>
|
|
|
|
<div class='topic-post-count'>
|
|
|
|
<%= I18n.t('embed.replies', count: (t.posts_count - 1)) %>
|
|
|
|
</div>
|
|
|
|
<%- end %>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2019-09-09 11:03:53 -05:00
|
|
|
<div class='topic-column featured-image-column'>
|
2019-09-04 09:51:58 -05:00
|
|
|
<%- if t.image_url.present? %>
|
|
|
|
<div class='topic-featured-image'>
|
|
|
|
<img src="<%= t.image_url %>">
|
|
|
|
</div>
|
|
|
|
<%- end %>
|
|
|
|
</div>
|
2019-09-02 09:25:44 -05:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<%- else %>
|
|
|
|
<div class='main-link'>
|
|
|
|
<a target="_parent" href="<%= t.url %>" class="title raw-link raw-topic-link" data-topic-id="<%= t.id %>"><%= t.title %></a>
|
|
|
|
</div>
|
|
|
|
<%- end %>
|
2019-08-15 12:41:06 -05:00
|
|
|
</div>
|
|
|
|
<%- end %>
|
2019-08-29 11:52:38 -05:00
|
|
|
</div>
|
2019-08-15 12:41:06 -05:00
|
|
|
<%- end %>
|