Skip to content
Snippets Groups Projects
Commit 0ba99b98 authored by Sharif Nada's avatar Sharif Nada
Browse files

initial commit

parent 97d55e92
No related branches found
No related tags found
No related merge requests found
<header class='discourse' data-embed-state='loaded'>
<% if @reply_count < 1 %>
<%= link_to(I18n.t('embed.start_discussion'), @topic_view.topic.url, class: 'button', target: '_blank') %>
<% elsif @reply_count >= 10 %>
<%= link_to(I18n.t('embed.continue'), @second_post_url, class: 'button', target: '_blank') %>
<% end %>
<span class='replies'><%= I18n.t('embed.replies', count: @reply_count) %></span>
</header>
<%- if @topic_view.posts.present? %>
<%- @topic_view.posts.each do |post| %>
<article class='post<%- if post.trashed? %> deleted<% end %>' id='post-<%= post.id.to_s %>'>
<%= link_to embed_post_date(post.created_at), post.full_url, title: post.created_at.strftime("%B %e, %Y %l:%M%P"), class: 'post-date', target: "_blank" %>
<%- if post.reply_to_post.present? && !post.cooked.index('aside') %>
<%= link_to I18n.t('embed.in_reply_to', username: post.reply_to_post.username), post.reply_to_post.full_url, 'data-link-to-post' => post.reply_to_post.id.to_s, :class => 'in-reply-to', target: "_blank" %>
<%- end %>
<div class='author'>
<a href='<%= Discourse.base_url %>/u/<%= post.username %>' target="_blank"><img src='<%= post.user.small_avatar_url %>' alt=''></a>
</div>
<div class='cooked'>
<h3 class='username'>
<a href='<%= Discourse.base_url %>/u/<%= post.username %>' target="_blank" class='<% if post.user.staff? %>staff<% end %><% if post.user.new_user? %>new-user<% end %>'><%= post.user.name %></a>
<%- if post.user.title.present? %>
<span class='title'><%= post.user.title %></span>
<%- end %>
</h3>
<%= get_html(post) %>
<%- if post.reply_count > 0 && post.replies.exists? %>
<%- if post.reply_count == 1 %>
<%= link_to I18n.t('embed.replies', count: post.reply_count), post.full_url, 'data-link-to-post' => post.replies.first.id.to_s, :class => 'post-replies button', target: "_blank" %>
<% else %>
<%= link_to I18n.t('embed.replies', count: post.reply_count), post.full_url, class: 'post-replies button', target: "_blank" %>
<%- end %>
<%- end %>
</div>
</article>
<%- end %>
<% if @topic_view.topic.posts_count > 0 %>
<footer class="clearfix">
<%= link_to(image_tag(SiteSetting.site_logo_url, class: 'logo'), Discourse.base_url, target: '_blank') %>
<%= link_to(I18n.t('embed.continue'), @topic_view.posts.last.full_url, class: 'button', target: '_blank') %>
<%- if @posts_left > 0 %>
<span class='replies'><%= I18n.t('embed.more_replies', count: @posts_left) %></span>
<%- end %>
</footer>
<div class="clearfix"></div>
<% end %>
<% end %>
# frozen_string_literal: true
# name: discourse-custom-embed
# about: A simple plugin to used to show real names in Discourse embeds
# version: 0.0.1
# authors: Sharif Nada
# url: https://github.com/ATB-UQ/discourse-custom-embed
# required_version: 3.1.0
after_initialize do
::EmbedController.prepend_view_path File.expand_path("../custom_views", __FILE__)
end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment