initialize: function(options) {
CRM.designerApp.vent.on('ufUnsaved', this.onUfChanged, this);
+ CRM.designerApp.vent.on('ufSaved', this.onUfSaved, this);
},
onClose: function() {
this.undoAlert && this.undoAlert.close && this.undoAlert.close();
onUfChanged: function(isUfUnsaved) {
this.isUfUnsaved = isUfUnsaved;
},
+ onUfSaved: function() {
+ CRM.designerApp.vent.off('ufUnsaved', this.onUfChanged, this);
+ this.isUfUnsaved = false;
+ },
onRender: function() {
var designerDialog = this;
designerDialog.$el.dialog({
designerDialog.undoAlert && designerDialog.undoAlert.close && designerDialog.undoAlert.close();
if (designerDialog.isUfUnsaved) {
- designerDialog.undoAlert = CRM.alert('<p>' + ts('Your changes to "%1" have not been saved.', {1: designerDialog.model.get('title')}) + '</p><a href="#" class="crm-undo">' + ts('Restore unsaved changes') + '</a>', ts('Unsaved Changes'), 'alert', {expires: 60000});
- $('.ui-notify-message a.crm-undo').click(function(e) {
+ designerDialog.undoAlert = CRM.alert('<p>' + ts('%1 has not been saved.', {1: designerDialog.model.get('title')}) + '</p><a href="#" class="crm-undo">' + ts('Restore') + '</a>', ts('Unsaved Changes'), 'alert', {expires: 60000});
+ $('.ui-notify-message a.crm-undo').button({icons: {primary: 'ui-icon-arrowreturnthick-1-w'}}).click(function(e) {
e.preventDefault();
designerDialog.undoState = true;
designerDialog.$el.dialog('open');
return;
}
var $dialog = this.$el.closest('.crm-designer-dialog'); // FIXME use events
- $dialog.block({message: 'Saving...', theme: true});
+ $dialog.block();
var profile = ufGroupModel.toStrictJSON();
profile["api.UFField.replace"] = {values: ufGroupModel.getRel('ufFieldCollection').toSortedJSON(), 'option.autoweight': 0};
CRM.api('UFGroup', 'create', profile, {
return;
}
var $dialog = this.$el.closest('.crm-designer-dialog'); // FIXME use events
- $dialog.block({message: 'Loading...', theme: true});
+ $dialog.block();
// CRM-12188
CRM.designerApp.clearPreviewArea();
$.post(CRM.url("civicrm/ajax/inline"), {