Skip to content
Snippets Groups Projects
Commit 8e509f00 authored by Jared Hancock's avatar Jared Hancock
Browse files

Warn if leaving unsaved sorting preferences

parent 890cd6fc
No related branches found
No related tags found
No related merge requests found
......@@ -115,8 +115,8 @@ $(document).ready(function(){
});
}
$("form#save :input").change(function() {
var fObj = $(this).closest('form');
var warnOnLeave = function (el) {
var fObj = el.closest('form');
if(!fObj.data('changed')){
fObj.data('changed', true);
$('input[type=submit]', fObj).css('color', 'red');
......@@ -124,6 +124,10 @@ $(document).ready(function(){
return 'Are you sure you want to leave? Any changes or info you\'ve entered will be discarded!';
});
}
};
$("form#save :input").change(function() {
warnOnLeave($(this));
});
$("form#save :input[type=reset]").click(function() {
......@@ -453,6 +457,7 @@ $(document).ready(function(){
'helper': fixHelper,
'stop': function(e, ui) {
var attr = ui.item.parent('tbody').data('sort');
warnOnLeave(ui.item);
$('input[name^='+attr+']', ui.item.parent('tbody')).each(function(i, el) {
$(el).val(i+1);
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment