Extract explaining and implementation hiding helper
This commit is contained in:
@@ -33,4 +33,11 @@ module CardsHelper
|
||||
title << "assigned to #{card.assignees.map(&:name).to_sentence}" if card.assignees.any?
|
||||
title.join(" ")
|
||||
end
|
||||
|
||||
def card_social_tags(card)
|
||||
tag.meta(property: "og:title", content: "#{card.title} | #{card.collection.name}") +
|
||||
tag.meta(property: "og:description", content: format_excerpt(@card&.description, length: 200)) +
|
||||
tag.meta(property: "og:image", content: @card.image.attached? ? "#{request.base_url}#{url_for(@card.image)}" : "#{request.base_url}/app-icon.png") +
|
||||
tag.meta(property: "og:url", content: card_url(@card))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,10 +3,7 @@
|
||||
<%= turbo_stream_from @card %>
|
||||
|
||||
<% content_for :head do %>
|
||||
<%= tag.meta property: "og:title", content: "#{@card.title} | #{@card.collection.name}" %>
|
||||
<%= tag.meta property: "og:description", content: format_excerpt(@card&.description, length: 200) %>
|
||||
<%= tag.meta property: "og:image", content: @card.image.attached? ? "#{request.base_url}#{url_for(@card.image)}" : "#{request.base_url}/app-icon.png" %>
|
||||
<%= tag.meta property: "og:url", content: card_url(@card) %>
|
||||
<%= card_social_tags(@card) %>
|
||||
<% end %>
|
||||
|
||||
<% content_for :header do %>
|
||||
|
||||
Reference in New Issue
Block a user