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};
(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'});
<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')">
<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}">