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

Confirmation message before save #2843

Closed
filipegiusti opened this issue Jun 6, 2024 · 4 comments · Fixed by #2965
Closed

Confirmation message before save #2843

filipegiusti opened this issue Jun 6, 2024 · 4 comments · Fixed by #2965
Assignees
Labels
Enhancement Not necessarily a feature, but something has improved Help wanted We could use some help with this Javascript Pull requests that update Javascript code

Comments

@filipegiusti
Copy link
Contributor

Feature

When opening the edit page or when saving a resource, users should see a confirmation modal.

Current workarounds

I guess it could be achieve by manually replicating the default actions list and overriding the save button.

Screenshots or screen recordings

N/A.

Additional context

We would like the ability to ask for confirmation on saves depending on resource state because some of our resources have states that are low stakes (unpublished) and ones that are high stakes (published) and we would like to avoid human error on high stakes states.

Initially discussed this discord thread.

@adrianthedev adrianthedev added Enhancement Not necessarily a feature, but something has improved Help wanted We could use some help with this Javascript Pull requests that update Javascript code labels Jun 7, 2024
@G-Simpson
Copy link
Contributor

@filipegiusti Could you please post the context from the discord thread? I don't have access. Thanks

@adrianthedev
Copy link
Collaborator

Hey @G-Simpson. In case you want to join, use this link https://avo.cool/chat

@adrianthedev
Copy link
Collaborator

This would be a cool feature to have!

Approach

  • add the confirm_before_create|update|save option to BaseResource
  • create a Stimulus controller which gets attached in case the option is on
  • the stimulus controller will first show a modal
  • let's re-use the custom-confirm.js behavior to trigger the same modal. Some work will be required here to extract that functionality
  • the modal should trigger a proper submit on the form

BTW, you can check out that thread here on the public chat archives.

@G-Simpson
Copy link
Contributor

I'm happy to have a look at this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Not necessarily a feature, but something has improved Help wanted We could use some help with this Javascript Pull requests that update Javascript code
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants