adding fix for new request bug#5633
Open
Jberma23 wants to merge 1 commit into
Open
Conversation
Jberma23
marked this pull request as ready for review
July 17, 2026 00:28
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #5632
Description
Clicking "New Quantity Request" opens a Bootstrap modal, but the button itself gets stuck showing "Please wait..." after the modal is dismissed.
The cause is
rails-ujs. Itsdata-disable-withbehavior disables a link on click and only re-enables it once the next page load or AJAX request completes. A modal-toggle button never does either of those: it just opens a modal client-side. So the button disables on click and never gets re-enabled.modal_button_tobuilds on the shared_link_tohelper, which setsdata-disable-with: "Please wait..."as a default for every button unless the caller opts out. That default makes sense for buttons that navigate or submit a form, but a modal toggle never does either, so the fix is to optmodal_button_toout of it entirely rather than trying to reset the state after the fact with more JavaScript.I considered listening for the modal's
hidden.bs.modalevent and manually resetting the button's text and disabled state instead. That would work, but it's more code for a problem that doesn't need it:disable_withisn't relevant to a button that never navigates, so it's cleaner to just not apply it in the first place.Type of change
How Has This Been Tested?
Added helper specs for
modal_button_tocovering the default case and the case where the caller passes their owndataoptions, confirmingdata-disable-withis omitted in both.Added a system spec that opens the new request modal, dismisses it, and confirms the trigger button still reads "New Quantity Request" instead of "Please wait...".
[Run
bundle exec rakelocally and confirm new and existing specs pass before checking this box, then replace this line with a short note on the result.]To verify manually: sign in, go to the new request page, open the "New Quantity Request" modal, close it without submitting, and confirm the button label is unchanged.