|
|
|
@ -3,6 +3,10 @@ |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
var localize = function (key) { |
|
|
|
return abp.localization.getResource('AbpUi')(key); |
|
|
|
}; |
|
|
|
|
|
|
|
/* A simple jQuery plug-in to make a button busy. */ |
|
|
|
$.fn.buttonBusy = function (isBusy) { |
|
|
|
return $(this).each(function () { |
|
|
|
@ -127,4 +131,32 @@ |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
$.fn.needConfirmationOnUnsavedClose = function () { |
|
|
|
var $form = $(this); |
|
|
|
var formSaved = false; |
|
|
|
var unEditedForm = JSON.stringify($form.serializeFormToObject()); |
|
|
|
|
|
|
|
var modal = $(this).find('.modal'); |
|
|
|
|
|
|
|
$(modal).on("hide.bs.modal", function (e) { |
|
|
|
var currentForm = JSON.stringify($form.serializeFormToObject()); |
|
|
|
var thereAreUnsavedChanges = currentForm !== unEditedForm; |
|
|
|
|
|
|
|
if (!formSaved && thereAreUnsavedChanges) { |
|
|
|
e.preventDefault(); |
|
|
|
abp.message.confirm(localize('AreYouSureYouWantToCancelEditingWarningMessage'), |
|
|
|
function (result) { |
|
|
|
if (result) { |
|
|
|
formSaved = true; |
|
|
|
$(modal).modal('toggle'); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
$(this).bind('ajax:complete',function () { |
|
|
|
formSaved = true; |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
})(jQuery); |