Revert "Easier closing of dialogs" (introduces regression on date time picker)
This reverts commit 71630aaa77.
This commit is contained in:
@@ -1,42 +1,18 @@
|
||||
(function () {
|
||||
var isOpen = false;
|
||||
var isFormDirty = false;
|
||||
|
||||
function closeIfDirty() {
|
||||
if (isFormDirty == false) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return window.confirm($("body").data("js-modal-close-msg").replace(/\\n/g,"\n"));
|
||||
}
|
||||
|
||||
function onOverlayClick(e) {
|
||||
if (e.target.matches('#modal-overlay')) {
|
||||
if (closeIfDirty()) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
destroy();
|
||||
}
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
|
||||
function onBeforeUnload(e) {
|
||||
// Cancel the event as stated by the standard.
|
||||
e.preventDefault();
|
||||
|
||||
// Chrome requires returnValue to be set.
|
||||
e.returnValue = '';
|
||||
}
|
||||
|
||||
function onCloseButtonClick() {
|
||||
KB.trigger('modal.close');
|
||||
}
|
||||
|
||||
function onFormChange() {
|
||||
isFormDirty = true;
|
||||
window.addEventListener('beforeunload', onBeforeUnload, false);
|
||||
}
|
||||
|
||||
function onFormSubmit() {
|
||||
KB.trigger('modal.loading');
|
||||
submitForm();
|
||||
@@ -75,7 +51,6 @@
|
||||
function afterRendering() {
|
||||
var formElement = KB.find('#modal-content form');
|
||||
if (formElement) {
|
||||
formElement.on('change', onFormChange, false);
|
||||
formElement.on('submit', onFormSubmit, false);
|
||||
}
|
||||
|
||||
@@ -90,13 +65,6 @@
|
||||
_KB.tagAutoComplete();
|
||||
_KB.get('Task').onPopoverOpened();
|
||||
|
||||
if (formElement) {
|
||||
$('.form-date').datepicker('option', 'onSelect', onFormChange);
|
||||
$('.form-datetime').datepicker('option', 'onSelect', onFormChange);
|
||||
$(".color-picker").on('change', onFormChange);
|
||||
$(".tag-autocomplete").on('change', onFormChange);
|
||||
}
|
||||
|
||||
KB.trigger('modal.afterRender');
|
||||
}
|
||||
|
||||
@@ -154,8 +122,6 @@
|
||||
|
||||
function destroy() {
|
||||
isOpen = false;
|
||||
isFormDirty = false;
|
||||
window.removeEventListener('beforeunload', onBeforeUnload, false);
|
||||
var overlayElement = KB.find('#modal-overlay');
|
||||
|
||||
if (overlayElement) {
|
||||
|
||||
Reference in New Issue
Block a user