Files
fizzy/app/views/cards/container/_image.html.erb
T
Jorge Manrubia 4e72566856 Flatten card resource
We only need the parent collection for creating cards. Carrying it in the
rest of actions is a hassle.
2025-09-10 11:24:23 +02:00

18 lines
807 B
Plaintext

<% if card.image.attached? %>
<%= button_to card_image_path(card), method: :delete, class: "btn tooltip" do %>
<%= icon_tag "picture-remove" %>
<span class="for-screen-reader">Remove background image</span>
<% end %>
<% elsif !card.closed? %>
<%= form_with model: card, url: card_path(card), data: { controller: "form" } do |form| %>
<label class="btn input--file tooltip">
<%= 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",
aria: { label: "Add background image" },
data: { action: "upload-preview#previewImage form#submit", upload_preview_target: "input" } %>
</label>
<% end %>
<% end %>