diff --git a/app/helpers/cards_helper.rb b/app/helpers/cards_helper.rb index 5a3836361..5a4a35d62 100644 --- a/app/helpers/cards_helper.rb +++ b/app/helpers/cards_helper.rb @@ -40,4 +40,10 @@ module CardsHelper 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 + + def button_to_remove_card_image(card) + button_to(card_image_path(card), method: :delete, class: "btn", data: { controller: "tooltip" }) do + icon_tag("trash") + tag.span("Remove background image", class: "for-screen-reader") + end + end end diff --git a/app/views/cards/show.html.erb b/app/views/cards/show.html.erb index 2c6c2a3d8..a211e93fa 100644 --- a/app/views/cards/show.html.erb +++ b/app/views/cards/show.html.erb @@ -21,11 +21,6 @@ <%= render "cards/messages", card: @card if @card.published? || @card.drafted? %> <%= render "layouts/lightbox" do %> - <% if @card.image.attached? %> - <%= button_to card_image_path(@card), method: :delete, class: "btn", data: { controller: "tooltip" } do %> - <%= icon_tag "trash" %> - Remove background image - <% end %> - <% end %> + <%= button_to_remove_card_image(@card) if @card.image.attached? %> <% end %>