crmMailing - Only display "Headers and Footers" if there are headers and footers
authorTim Otten <totten@civicrm.org>
Wed, 18 Sep 2019 17:55:24 +0000 (13:55 -0400)
committerTim Otten <totten@civicrm.org>
Mon, 18 Nov 2019 17:57:59 +0000 (09:57 -0800)
ang/crmMailing.js
ang/crmMailing/EditMailingCtrl.js
ang/crmMailing/EditMailingCtrl/2step.html
ang/crmMailing/EditMailingCtrl/workflow.html

index 95148bf27b3fd56d83831864ee30802b7d5bc030..6ce813ea6159562e88275a7c87ee9e786fbe92af 100644 (file)
@@ -47,6 +47,9 @@
           selectedMail: function($route, crmMailingMgr) {
             return crmMailingMgr.get($route.current.params.id);
           },
+          mailingFields: function(crmMetadata) {
+            return crmMetadata.getFields('Mailing');
+          },
           attachments: function($route, CrmAttachments) {
             var attachments = new CrmAttachments(function () {
               return {entity_table: 'civicrm_mailing', entity_id: $route.current.params.id};
index 91f6db3f3aa747fc18e1b36ec30f1620bc5654ca..5651d4f8d6a31fe058c30d848bd7abc926a09fec 100644 (file)
@@ -1,12 +1,13 @@
 (function(angular, $, _) {
 
-  angular.module('crmMailing').controller('EditMailingCtrl', function EditMailingCtrl($scope, selectedMail, $location, crmMailingMgr, crmStatus, attachments, crmMailingPreviewMgr, crmBlocker, CrmAutosaveCtrl, $timeout, crmUiHelp) {
+  angular.module('crmMailing').controller('EditMailingCtrl', function EditMailingCtrl($scope, selectedMail, $location, crmMailingMgr, crmStatus, attachments, crmMailingPreviewMgr, crmBlocker, CrmAutosaveCtrl, $timeout, crmUiHelp, mailingFields) {
     var APPROVAL_STATUSES = {'Approved': 1, 'Rejected': 2, 'None': 3};
 
     $scope.mailing = selectedMail;
     $scope.attachments = attachments;
     $scope.crmMailingConst = CRM.crmMailing;
     $scope.checkPerm = CRM.checkPerm;
+    $scope.mailingFields = mailingFields;
 
     var ts = $scope.ts = CRM.ts(null);
     $scope.hs = crmUiHelp({file: 'CRM/Mailing/MailingUI'});
index cabd6f307c698770c9caf2fcc958f0ae069931bc..d5fa639c9b100fa8fbf2ff340aa34d8e18e0d1a0 100644 (file)
@@ -17,7 +17,7 @@
           <div crm-ui-tab id="tab-attachment" crm-title="ts('Attachments')">
             <div crm-attachments="attachments"></div>
           </div>
-          <div crm-ui-tab id="tab-header" crm-title="ts('Header and Footer')">
+          <div crm-ui-tab id="tab-header" crm-title="ts('Header and Footer')" ng-if="mailingFields.header_id.options.length > 0 || mailingFields.footer_id.options.length > 0">
             <div crm-mailing-block-header-footer crm-mailing="mailing"></div>
           </div>
           <div crm-ui-tab id="tab-pub" crm-title="ts('Publication')">
index affa76d84ec178c81b006ec372acea8997214c53..9a6c21af2bbd73e24eef2531d48c9a8b1a9d9979 100644 (file)
@@ -13,7 +13,7 @@
           <div crm-mailing-body-text crm-mailing="mailing"></div>
         </div>
         <span ng-model="placeholder" crm-ui-validate="mailing.body_html || mailing.body_text"></span>
-        <div crm-ui-accordion="{title: ts('Header and Footer'), collapsed: true}">
+        <div crm-ui-accordion="{title: ts('Header and Footer'), collapsed: true}" ng-if="mailingFields.header_id.options.length > 0 || mailingFields.footer_id.options.length > 0">
           <div crm-mailing-block-header-footer crm-mailing="mailing"></div>
         </div>
         <div crm-ui-accordion="{title: ts('Attachments'), collapsed: true}">