From: Coleman Watts Date: Sat, 23 Mar 2013 04:46:29 +0000 (-0700) Subject: Disable save button if profile unchanged CRM-12198 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=95269eab36b2439f9513de906e8aa97819ffc3b7;p=civicrm-core.git Disable save button if profile unchanged CRM-12198 --- diff --git a/js/view/crm.designer.js b/js/view/crm.designer.js index ccc68b2871..f5631f1a72 100644 --- a/js/view/crm.designer.js +++ b/js/view/crm.designer.js @@ -188,9 +188,20 @@ 'click .crm-designer-preview': 'doPreview' }, onRender: function() { - this.$('.crm-designer-save').button(); + this.$('.crm-designer-save').button().attr({ + disabled: 'disabled', + style: 'opacity:.5; box-shadow:none; cursor:default;' + }); this.$('.crm-designer-preview').button(); }, + initialize: function(options) { + CRM.designerApp.vent.on('ufUnsaved', this.onUfChanged, this); + }, + onUfChanged: function(isUfUnsaved) { + if (isUfUnsaved) { + this.$('.crm-designer-save').removeAttr('style').removeAttr('disabled'); + } + }, doSave: function(event) { var ufGroupModel = this.model; if (ufGroupModel.getRel('ufFieldCollection').hasDuplicates()) {