From c8ac035c797445a4271d2025d92f4fa955eaad24 Mon Sep 17 00:00:00 2001 From: Adam Dawkins Date: Sun, 17 Feb 2019 01:09:02 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20Primitively=20display=20mentions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/jobs/fetch_mention_content_job.rb | 2 +- app/views/mentions/_mention.html.erb | 18 ++++++++++++++++++ app/views/notes/show.html.erb | 4 ++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 app/views/mentions/_mention.html.erb diff --git a/app/jobs/fetch_mention_content_job.rb b/app/jobs/fetch_mention_content_job.rb index 9fedee0..0b78fb1 100644 --- a/app/jobs/fetch_mention_content_job.rb +++ b/app/jobs/fetch_mention_content_job.rb @@ -10,7 +10,7 @@ def perform(mention) mention.update( title: collection.entry.try("name"), - content: collection.entry.try("content").try("value") + content: collection.entry.try("content").to_hash[:value] ) end end diff --git a/app/views/mentions/_mention.html.erb b/app/views/mentions/_mention.html.erb new file mode 100644 index 0000000..ad85009 --- /dev/null +++ b/app/views/mentions/_mention.html.erb @@ -0,0 +1,18 @@ +
+ <%= link_to mention.source, class: "u-url quiet" do %> + + <% end %> + <% unless mention.title.blank? %> +

<%= mention.title %>

+ <% end %> +

<%= mention.content %>

+ +
+ diff --git a/app/views/notes/show.html.erb b/app/views/notes/show.html.erb index 058132a..723fcae 100644 --- a/app/views/notes/show.html.erb +++ b/app/views/notes/show.html.erb @@ -1 +1,5 @@ <%= render @post, as: :note %> +<% if @post.mentions.any? %> +

Mentions

+ <%= render @post.mentions %> +<% end %>