attachment: disable Delete button during request

Prevent users from clicking the Delete button more than once.
This commit is contained in:
Pierre de La Morinerie 2020-06-26 15:55:44 +02:00 committed by Pierre de La Morinerie (Rebase PR Action)
parent 1fcb3c4ff2
commit d25e173f11

View file

@ -18,7 +18,7 @@
= render partial: "shared/attachment/show", locals: { attachment: attachment, user_can_upload: true } = render partial: "shared/attachment/show", locals: { attachment: attachment, user_can_upload: true }
- if user_can_destroy - if user_can_destroy
.attachment-action .attachment-action
= link_to 'Supprimer', attachment_url(attachment.id, { signed_id: attachment.blob.signed_id }), remote: true, method: :delete, class: 'button small danger' = link_to 'Supprimer', attachment_url(attachment.id, { signed_id: attachment.blob.signed_id }), remote: true, method: :delete, class: 'button small danger', data: { disable: true }
.attachment-action .attachment-action
= button_tag 'Remplacer', type: 'button', class: 'button small', data: { 'toggle-target': ".attachment-input-#{attachment_id}" } = button_tag 'Remplacer', type: 'button', class: 'button small', data: { 'toggle-target': ".attachment-input-#{attachment_id}" }