Skip to content

Commit

Permalink
crmMailingAB - Only display "Headers and Footers" if there are header…
Browse files Browse the repository at this point in the history
…s and footers
  • Loading branch information
totten committed Sep 18, 2019
1 parent 988944e commit a93b3ae
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 3 additions & 0 deletions ang/crmMailingAB.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
templateUrl: '~/crmMailingAB/EditCtrl/main.html',
controller: 'CrmMailingABEditCtrl',
resolve: {
mailingFields: function(crmMetadata) {
return crmMetadata.getFields('Mailing');
},
abtest: function($route, CrmMailingAB) {
var abtest = new CrmMailingAB($route.current.params.id == 'new' ? null : $route.current.params.id);
return abtest.load();
Expand Down
3 changes: 2 additions & 1 deletion ang/crmMailingAB/EditCtrl.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(function(angular, $, _) {

angular.module('crmMailingAB').controller('CrmMailingABEditCtrl', function($scope, abtest, crmMailingABCriteria, crmMailingMgr, crmMailingPreviewMgr, crmStatus, $q, $location, crmBlocker, $interval, $timeout, CrmAutosaveCtrl, dialogService) {
angular.module('crmMailingAB').controller('CrmMailingABEditCtrl', function($scope, abtest, crmMailingABCriteria, crmMailingMgr, crmMailingPreviewMgr, crmStatus, $q, $location, crmBlocker, $interval, $timeout, CrmAutosaveCtrl, dialogService, mailingFields) {
$scope.abtest = abtest;
var ts = $scope.ts = CRM.ts(null);
var block = $scope.block = crmBlocker();
Expand All @@ -9,6 +9,7 @@
$scope.crmMailingABCriteria = crmMailingABCriteria;
$scope.crmMailingConst = CRM.crmMailing;
$scope.checkPerm = CRM.checkPerm;
$scope.mailingFields = mailingFields;

$scope.isSubmitted = function isSubmitted() {
return _.size(abtest.mailings.a.jobs) > 0 || _.size(abtest.mailings.b.jobs) > 0;
Expand Down
6 changes: 3 additions & 3 deletions ang/crmMailingAB/EditCtrl/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
<div crm-attachments="abtest.attachments.a"></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="abtest.mailings.a"></div>
</div>
<div crm-ui-tab id="tab-pub" crm-title="ts('Publication')">
Expand Down Expand Up @@ -101,7 +101,7 @@
<div crm-ui-tab id="tab-attachmentA" crm-title="ts('Attachments')">
<div crm-attachments="abtest.attachments.a"></div>
</div>
<div crm-ui-tab id="tab-headerA" crm-title="ts('Header and Footer')">
<div crm-ui-tab id="tab-headerA" 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="abtest.mailings.a"></div>
</div>
<div crm-ui-tab id="tab-pubA" crm-title="ts('Publication')">
Expand Down Expand Up @@ -136,7 +136,7 @@
<div crm-ui-tab id="tab-attachmentB" crm-title="ts('Attachments')">
<div crm-attachments="abtest.attachments.b"></div>
</div>
<div crm-ui-tab id="tab-headerB" crm-title="ts('Header and Footer')">
<div crm-ui-tab id="tab-headerB" 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="abtest.mailings.b"></div>
</div>
<div crm-ui-tab id="tab-pubB" crm-title="ts('Publication')">
Expand Down

0 comments on commit a93b3ae

Please sign in to comment.