summaryrefslogtreecommitdiffstats
path: root/public
diff options
context:
space:
mode:
authorGerben <gerben@treora.com>2018-03-23 15:10:42 +0100
committerLunny Xiao <xiaolunwen@gmail.com>2018-03-23 22:10:42 +0800
commit2dc6f15eca007105fb6c3972265e6da53696bdf1 (patch)
tree2775c7b19061663edf401d3af1adc87bb86c5453 /public
parente64aa18dc97f2cf25bc642c7d987a4a3bed494ac (diff)
downloadgitea-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.js7
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(){