2015-08-13 03:41:15 +08:00
<header class='discourse'>
2014-01-24 01:58:52 +08:00
<% if @topic_view.topic.posts_count < 2 %>
2014-01-13 23:59:28 +08:00
<%= link_to(I18n.t('embed.start_discussion'), @topic_view.topic.url, class: 'button', target: '_blank') %>
2014-01-15 05:06:04 +08:00
<% elsif @topic_view.topic.posts_count > 10 %>
2014-01-04 01:52:24 +08:00
<%= link_to(I18n.t('embed.continue'), @second_post_url, class: 'button', target: '_blank') %>
2014-01-13 23:59:28 +08:00
<% end %>
2015-11-21 02:05:45 +08:00
<span class='replies'><%= I18n.t('embed.replies', count: @reply_count) %></span>
2014-01-01 03:37:43 +08:00
</header>
<%- if @topic_view.posts.present? %>
<%- @topic_view.posts.each do |post| %>
2014-01-04 03:45:22 +08:00
<article class='post<%- if post.trashed? %> deleted<% end %>' id='post-<%= post.id.to_s %>'>
2014-03-24 03:22:02 +08:00
<%= link_to embed_post_date(post.created_at), post.url, title: post.created_at.strftime("%B %e, %Y %l:%M%P"), class: 'post-date', target: "_blank" %>
2014-03-21 02:02:21 +08:00
<%- if post.reply_to_post.present? && !post.cooked.index('aside') %>
2014-01-04 03:45:22 +08:00
<%= link_to I18n.t('embed.in_reply_to', username: post.reply_to_post.username), post.reply_to_post.url, 'data-link-to-post' => post.reply_to_post.id.to_s, :class => 'in-reply-to' %>
2014-01-04 01:52:24 +08:00
<%- end %>
2014-01-01 03:37:43 +08:00
<div class='author'>
2015-09-19 03:18:54 +08:00
<a href='/users/<%= post.username %>' target="_blank"><img src='<%= post.user.small_avatar_url %>' alt=''></a>
2014-05-10 03:14:00 +08:00
</div>
<div class='cooked'>
2014-03-21 04:04:50 +08:00
<h3 class='username'>
<a href='/users/<%= post.username %>' target="_blank" class='<% if post.user.staff? %>staff<% end %><% if post.user.new_user? %>new-user<% end %>'><%= post.user.username %></a>
2014-05-10 03:14:00 +08:00
<%- if post.user.title.present? %>
<span class='title'><%= post.user.title %></span>
<%- end %>
2014-03-21 04:04:50 +08:00
</h3>
2015-05-01 21:04:45 +08:00
<%= get_html(post.cooked) %>
2014-01-04 01:52:24 +08:00
<%- if post.reply_count > 0 %>
2014-01-04 03:45:22 +08:00
<%- if post.reply_count == 1 %>
2015-08-07 05:18:00 +08:00
<%= link_to I18n.t('embed.replies', count: post.reply_count), post.url, 'data-link-to-post' => post.replies.first.id.to_s, :class => 'post-replies button' %>
2014-01-04 03:45:22 +08:00
<% else %>
2015-08-07 05:18:00 +08:00
<%= link_to I18n.t('embed.replies', count: post.reply_count), post.url, class: 'post-replies button', target: "_blank" %>
2014-01-04 03:45:22 +08:00
<%- end %>
2014-01-04 01:52:24 +08:00
<%- end %>
</div>
2014-01-01 03:37:43 +08:00
</article>
<%- end %>
2014-01-13 23:59:28 +08:00
<% if @topic_view.topic.posts_count > 0 %>
2015-09-19 04:12:41 +08:00
<footer class="clearfix">
<%= link_to(image_tag(SiteSetting.logo_url, class: 'logo'), Discourse.base_url, target: '_blank') %>
2014-01-08 04:48:26 +08:00
<%= link_to(I18n.t('embed.continue'), @topic_view.posts.last.url, class: 'button', target: '_blank') %>
<%- if @posts_left > 0 %>
<span class='replies'><%= I18n.t('embed.more_replies', count: @posts_left) %></span>
<%- end %>
</footer>
2015-09-19 04:12:41 +08:00
<div class="clearfix"></div>
2014-01-08 04:48:26 +08:00
<% end %>
2014-01-01 03:37:43 +08:00
<% end %>