projects
/
civicrm-core.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
CRM-14843 - fixes for upgrade script including INSERT IGNORE usage.
[civicrm-core.git]
/
js
/
Common.js
diff --git
a/js/Common.js
b/js/Common.js
index 2818abc18cebdc0a8b232ab486646b9f34db71d1..abc5cae3919372b766bb09156a5cef8341ce8d66 100644
(file)
--- a/
js/Common.js
+++ b/
js/Common.js
@@
-245,14
+245,15
@@
CRM.validate = CRM.validate || {
*/
CRM.utils.initialValueChanged = function(el) {
var isDirty = false;
*/
CRM.utils.initialValueChanged = function(el) {
var isDirty = false;
- $(':input:visible,
:input.select2-offscreen', el
).each(function () {
+ $(':input:visible,
.select2-container:visible+:input.select2-offscreen', el).not('[type=submit], [type=button], .crm-action-menu'
).each(function () {
var initialValue = $(this).data('crm-initial-value');
var initialValue = $(this).data('crm-initial-value');
- if (initialValue !== undefined && initialValue != $(this).val()) {
+ // skip change of value for submit buttons
+ if (initialValue !== undefined && !_.isEqual(initialValue, $(this).val())) {
isDirty = true;
}
});
return isDirty;
isDirty = true;
}
});
return isDirty;
- }
+ }
;
/**
* Wrapper for select2 initialization function; supplies defaults
/**
* Wrapper for select2 initialization function; supplies defaults
@@
-504,21
+505,22
@@
CRM.validate = CRM.validate || {
})
.on('dialogclose', function(e) {
// Restore scrollbars when closing modal
})
.on('dialogclose', function(e) {
// Restore scrollbars when closing modal
- if ($('.ui-dialog .modal-dialog').not(e.target).length < 1) {
+ if ($('.ui-dialog .modal-dialog
:visible
').not(e.target).length < 1) {
$('body').css({overflow: ''});
}
})
.on('submit', function(e) {
$('body').css({overflow: ''});
}
})
.on('submit', function(e) {
- // CRM-14353 - disable changes warn when submitting
the
form
- $(
this).removeAttr('data-warn-changes
');
+ // CRM-14353 - disable changes warn when submitting
a
form
+ $(
'[data-warn-changes]').attr('data-warn-changes', 'false
');
})
})
- ;
-
- window.onbeforeunload = function() {
- if (CRM.utils.initialValueChanged($('form[data-warn-changes]'))) {
- return ts('You have unsaved changes.');
- }
- };
+ ;
+
+ // CRM-14353 - Warn of unsaved changes for forms which have opted in
+ window.onbeforeunload = function() {
+ if (CRM.utils.initialValueChanged($('form[data-warn-changes=true]:visible'))) {
+ return ts('You have unsaved changes.');
+ }
+ };
/**
* Function to make multiselect boxes behave as fields in small screens
/**
* Function to make multiselect boxes behave as fields in small screens
@@
-762,6
+764,16
@@
CRM.validate = CRM.validate || {
return dialog.dialog(settings).trigger('crmLoad');
};
return dialog.dialog(settings).trigger('crmLoad');
};
+ /** provides a local copy of ts for a domain */
+ CRM.ts = function(domain) {
+ return function(message, options) {
+ if (domain) {
+ options = $.extend(options || {}, {domain: domain});
+ }
+ return ts(message, options);
+ };
+ };
+
/**
* @see https://wiki.civicrm.org/confluence/display/CRMDOC/Notification+Reference
*/
/**
* @see https://wiki.civicrm.org/confluence/display/CRMDOC/Notification+Reference
*/
@@
-850,12
+862,6
@@
CRM.validate = CRM.validate || {
catch (e) {}
});
catch (e) {}
});
- /**
- * Temporary stub to get around name conflict with legacy jQuery.autocomplete plugin
- * FIXME: Remove this before 4.5 release
- */
- $.widget('civi.crmAutocomplete', $.ui.autocomplete, {});
-
$(function () {
// Trigger crmLoad on initial content for consistency. It will also be triggered for ajax-loaded content.
$('.crm-container').trigger('crmLoad');
$(function () {
// Trigger crmLoad on initial content for consistency. It will also be triggered for ajax-loaded content.
$('.crm-container').trigger('crmLoad');