Files
fizzy/app/views/cards/_image.html.erb
T
2025-04-09 14:50:58 +02:00

18 lines
764 B
Plaintext

<% if card.image.attached? %>
<%= button_to card_image_path(card), method: :delete, class: "btn" do %>
<%= icon_tag "picture-remove" %>
<span class="for-screen-reader">Clear background image</span>
<% end %>
<% else %>
<%= form_with model: card, url: collection_card_path(card.collection, card), data: { controller: "form" } do |form| %>
<label class="btn">
<%= icon_tag "picture-add" %>
<span class="for-screen-reader">Add background image</span>
<%= form.file_field :image, class: "input",
accept: "image/png, image/jpeg, image/jpg, image/webp",
data: { action: "upload-preview#previewImage form#submit", upload_preview_target: "input" },
hidden: true %>
</label>
<% end %>
<% end %>