Skip to content

Commit

Permalink
remove file upload and rendering of images from form as we are handli…
Browse files Browse the repository at this point in the history
…ng these in the Files tab of Pet show page. Also convert link_to to button_to as the former was not working (#294)
  • Loading branch information
kasugaijin authored Oct 21, 2023
1 parent 797ae66 commit 69100b3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 36 deletions.
31 changes: 1 addition & 30 deletions app/views/organizations/pets/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<div class='form-group d-flex'>
<div class='me-3'>
<span class='form-control'>
<span class=''>
<%= form.date_select :birth_date,
start_year: Date.today.year - 20,
end_year: Date.today.year %>
Expand Down Expand Up @@ -71,35 +71,6 @@
</div>
</div>

<div class='form-group mt-3'>
<%= form.file_field :append_images, multiple: true,
class: "custom-attachments",
label: 'Attach images' %>

<% pet.errors.full_messages_for(:images).each do |message| %>
<div class="alert alert-danger mt-1" role="alert"><%= message %></div>
<% end %>
</div>

<div>
<% if pet.images.attached? %>
<p><%= t('.uploaded_images') %></p>
<div class='row row-cols-1 row-cols-lg-5 g-6'>
<% pet.images.each do |image| %>
<% if image.created_at %>
<div class='d-flex flex-column align-items-center'>
<%= image_tag image, class: 'uploaded-image rounded mt-2 mb-2' %>
<%= link_to t('general.delete'),
purge_attachment_path(image),
data: { turbo_method: "delete" },
class: 'delete-button' %>
</div>
<% end %>
<% end %>
</div>
<% end %>
</div>

<%= form.submit t('general.save'), class: 'btn btn-outline-dark mb-3 mt-4' %>

<% end %>
Expand Down
12 changes: 6 additions & 6 deletions app/views/organizations/pets/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,12 @@
</ul>
</div>
</div>
<%= link_to t('general.delete'), pet_path(@pet), class: 'btn btn-outline-danger mt-2',
data:
{
turbo_method: :delete,
turbo_confirm: t('organization_pets.show.are_you_sure_delete')
} %>
<%=
button_to t('general.delete'),
pet_path(@pet), method: :delete,
class: 'btn btn-outline-danger mt-2',
data: { turbo_confirm: t('.are_you_sure_delete') }
%>
</div>
</div>

Expand Down

0 comments on commit 69100b3

Please sign in to comment.