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

Implement Dirty forms component with Turbolinks and custom event support #258

Merged
merged 1 commit into from
Jan 19, 2017

Conversation

danguita
Copy link
Contributor

@danguita danguita commented Jan 19, 2017

Connects to #240.

What does this PR do?

This PR implements a JS component which will be responsible for warning for unsaved changes when leaving a page. It is supporting Turbolinks and implements custom events that can be triggered by other UI components.

This behavior can be skipped by adding the .skip-dirty-check class at form tag level.

How should this be manually tested?

We would need to check that changes are detected and the alert dialogs are shown as expected:

  • Detects changes any kind of form input controls (<input>, <select>, <textarea>).
  • Detects text changes in a WYSIWYG control (Trix).
  • Detects file attachments in a WYSIWYG control (Trix).
  • Detects changes in a date picker control.
  • It can intercept a Turbolinks event, or leave it to the beforeunload window event.
  • The confirm/alert dialogs are displayed when forms are dirty 🙌

Confirm dialog triggered while listening to Turbolinks events:

screen shot 2017-01-19 at 9 14 52 am

Native beforeunload event dialogs (leave and reload):

screen shot 2017-01-19 at 9 15 18 am

screen shot 2017-01-19 at 9 14 58 am

Copy link
Member

@ferblape ferblape left a comment

Choose a reason for hiding this comment

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

Works really well!

@ferblape ferblape merged commit a4cd3b1 into stable Jan 19, 2017
@ferblape ferblape deleted the 240-admin-dirty-form-checking-component branch January 19, 2017 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants