diff options
author | Gerben <gerben@treora.com> | 2018-03-23 15:10:42 +0100 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2018-03-23 22:10:42 +0800 |
commit | 2dc6f15eca007105fb6c3972265e6da53696bdf1 (patch) | |
tree | 2775c7b19061663edf401d3af1adc87bb86c5453 /public | |
parent | e64aa18dc97f2cf25bc642c7d987a4a3bed494ac (diff) | |
download | gitea-2dc6f15eca007105fb6c3972265e6da53696bdf1.tar.gz gitea-2dc6f15eca007105fb6c3972265e6da53696bdf1.zip |
Don't warn users about *every* dirty form (#3707)
The choice regarding which forms should or should not trigger a warning
is subjective. I tried to be consistent and not warn about forms that:
- run an action, rather than edit data: search, send an email.
- delete data: a warning about losing data would be confusing
Note that forms on sign-in pages were already ignored (using a selector,
rather than an explicit class on the form element).
Fixes #3698.
Diffstat (limited to 'public')
-rw-r--r-- | public/js/index.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/public/js/index.js b/public/js/index.js index 1e795a5044..8b3d7c3d7d 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -1663,8 +1663,11 @@ function selectRange($list, $select, $from) { } $(function () { - if ($('.user.signin').length > 0) return; - $('form').areYouSure(); + // Warn users that try to leave a page after entering data into a form. + // Except on sign-in pages, and for forms marked as 'ignore-dirty'. + if ($('.user.signin').length === 0) { + $('form:not(.ignore-dirty)').areYouSure(); + } // Parse SSH Key $("#ssh-key-content").on('change paste keyup',function(){ |