Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove image and file field from pet form #294

Merged
merged 1 commit into from
Oct 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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