Skip to content

Commit

Permalink
Remove data-disable-with attributes on the page update form
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnaegle authored and rob mathews committed Aug 4, 2021
1 parent 31a9844 commit af5b6da
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/views/comfy/admin/cms/pages/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
= comfy_admin_partial "comfy/admin/cms/partials/page_form_after", form: form

= form.form_actions do
= submit_tag t(".preview"), name: "preview", formtarget: "comfy-cms-preview", id: nil, class: "btn btn-secondary", data: {disable_with: false}
= submit_tag t(@page.new_record?? ".create" : ".update"), class: "btn btn-primary ml-sm-1", data: {disable_with: false}
= submit_tag t(".preview"), name: "preview", formtarget: "comfy-cms-preview", id: nil, class: "btn btn-secondary"
= submit_tag t(@page.new_record?? ".create" : ".update"), class: "btn btn-primary ml-sm-1"
= link_to t(".cancel"), comfy_admin_cms_site_pages_path, class: "btn btn-link"

2 comments on commit af5b6da

@prexdev
Copy link

@prexdev prexdev commented on af5b6da Mar 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello,
why was this change made?
Is there any contraindication to reverting to the previous behavior?

Thank you

@saldan
Copy link

@saldan saldan commented on af5b6da Mar 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, the use of Rails UJS is deprecated in Rails 7 (it is no more on by default) but until Rails 6 the data attribute is in charge of leaving the preview button enabled once clicked, in order to let confirm the changes or not if the preview is ok.
A better implementation could take in consideration the presence of UJS or a different and custom implementation (excluding Rails UJS and data attribute) and a configuration setting.
The use of config.action_view.automatically_disable_submit_tag = false is not advisable if UJS is used in frontend side where the behaviour could be expected.
Any advise @johnnaegle ?

Please sign in to comment.