CRM-13783 - ProfileBuilder - Create new custom field in popup dialog
authorColeman Watts <coleman@civicrm.org>
Sun, 17 Nov 2013 23:11:14 +0000 (15:11 -0800)
committerColeman Watts <coleman@civicrm.org>
Sun, 17 Nov 2013 23:11:14 +0000 (15:11 -0800)
js/view/crm.designer.js
templates/CRM/UF/Page/ProfileTemplates.tpl

index 9077eb39bf081c6d92ba7dd6b719c473e20fafea..2bea05605fede92320cdac3ecef70bedaa933b62 100644 (file)
     events: {
       'keyup .crm-designer-palette-search input': 'doSearch',
       'click .crm-designer-palette-clear-search': 'clearSearch',
-      'click .crm-designer-palette-refresh': 'doRefresh',
       'click .crm-designer-palette-toggle': 'toggleAll'
     },
     initialize: function() {
     },
     doAddField: function(section) {
       var paletteView = this;
-      var openAddNewWindow = function() {
-        var url = CRM.url('civicrm/admin/custom/group/field/add', {
-          reset: 1,
-          action: 'add',
-          gid: section.custom_group_id
-        });
-        window.open(url, '_blank');
-      };
-
-      if (paletteView.hideAddFieldAlert) {
-        openAddNewWindow();
-      } else {
-        CRM.confirm(function() {
-            paletteView.hideAddFieldAlert = true;
-            openAddNewWindow();
-          }, {
-            title: ts('Add Field'),
-            message: ts('A new window or tab will open. Use the new window to add your field, and then return to this window and click "Refresh."')
+      var url = CRM.url('civicrm/admin/custom/group/field/add', {
+        reset: 1,
+        action: 'add',
+        gid: section.custom_group_id
+      });
+      CRM.loadForm(url, {
+        resetButton: 'next_new',
+        onSuccess: function(data, settings) {
+          paletteView.doRefresh();
+          if (data.buttonName != 'next_new') {
+            $(settings.target).dialog('close');
           }
-        );
-      }
+        }
+      });
       return false;
     },
-    doRefresh: function(event) {
+    doRefresh: function() {
       var ufGroupModel = this.model;
       CRM.Schema.reloadModels()
         .done(function(data){
index 312dc4dd92c77cdbca5c79569c1d6b258ba9307c..32e9cc2bbc7cedd950abb2a4e6f1ae4ab17af886 100644 (file)
@@ -29,8 +29,7 @@
       <a class="crm-designer-palette-clear-search" href="#" title="{ts}Clear search{/ts}"><img src="{$config->resourceBase}i/close.png" class="action-icon" alt="X" /></a>
       <div class="crm-designer-palette-controls">
         <a href="#" class="crm-designer-palette-toggle" rel="open_all">{ts}Open All{/ts}</a>&nbsp; |&nbsp;
-        <a href="#" class="crm-designer-palette-toggle" rel="close_all">{ts}Close All{/ts}</a>&nbsp; |&nbsp;
-        <a href="#" class="crm-designer-palette-refresh">{ts}Refresh{/ts}</a>
+        <a href="#" class="crm-designer-palette-toggle" rel="close_all">{ts}Close All{/ts}</a>
       </div>
     </div>