Disable save button if profile unchanged CRM-12198
authorColeman Watts <coleman@civicrm.org>
Sat, 23 Mar 2013 04:46:29 +0000 (21:46 -0700)
committerColeman Watts <coleman@civicrm.org>
Sat, 23 Mar 2013 04:46:29 +0000 (21:46 -0700)
js/view/crm.designer.js

index ccc68b28717808115c9ccee570e023c082813a20..f5631f1a72cf3393b28917e4c4cdb3264ae38d9c 100644 (file)
       '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()) {