From deea897f1c12e9c817c3a267b85ac7c3ce41390c Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Wed, 18 Feb 2015 21:18:20 -0800 Subject: [PATCH] crmMailingAB - report.html - Include all the major sections from review.html as rows --- css/angular-crmMailingAB.css | 2 +- js/angular-crmMailing.js | 63 ++++++++++--------- js/angular-crmMailing/directives.js | 4 +- js/angular-crmMailingAB.js | 6 +- partials/crmMailing/review.html | 16 ++--- partials/crmMailingAB/report.html | 96 +++++++++++++++++++++++++---- 6 files changed, 131 insertions(+), 56 deletions(-) diff --git a/css/angular-crmMailingAB.css b/css/angular-crmMailingAB.css index b9fff37ead..5fd4234a8a 100644 --- a/css/angular-crmMailingAB.css +++ b/css/angular-crmMailingAB.css @@ -17,5 +17,5 @@ } .crm-mailing-ab-col { - width: 12em; + width: 18em; } diff --git a/js/angular-crmMailing.js b/js/angular-crmMailing.js index 1c0b3ff882..1b680bb502 100644 --- a/js/angular-crmMailing.js +++ b/js/angular-crmMailing.js @@ -179,34 +179,11 @@ $scope.$on('$destroy', myAutosave.stop); }); - // Controller for the edit-recipients fields ( - // WISHLIST: Move most of this to a (cache-enabled) service - // Scope members: - // - [input] mailing: object - // - [output] recipients: array of recipient records - angular.module('crmMailing').controller('EditRecipCtrl', function EditRecipCtrl($scope, dialogService, crmApi, crmMailingMgr, $q, crmMetadata) { - var ts = $scope.ts = CRM.ts(null); - $scope.recipients = null; - $scope.getRecipientsEstimate = function () { - var ts = $scope.ts; - if ($scope.recipients === null) { - return ts('(Estimating)'); - } - if ($scope.recipients.length === 0) { - return ts('No recipients'); - } - if ($scope.recipients.length === 1) { - return ts('~1 recipient'); - } - if (RECIPIENTS_PREVIEW_LIMIT > 0 && $scope.recipients.length >= RECIPIENTS_PREVIEW_LIMIT) { - return ts('>%1 recipients', {1: RECIPIENTS_PREVIEW_LIMIT}); - } - return ts('~%1 recipients', {1: $scope.recipients.length}); - }; - $scope.getIncludesAsString = function () { + angular.module('crmMailing').controller('ViewRecipCtrl', function EditRecipCtrl($scope) { + $scope.getIncludesAsString = function(mailing) { var first = true; var names = ''; - _.each($scope.mailing.recipients.groups.include, function (id) { + _.each(mailing.recipients.groups.include, function (id) { if (!first) { names = names + ', '; } @@ -214,7 +191,7 @@ names = names + group[0].title; first = false; }); - _.each($scope.mailing.recipients.mailings.include, function (id) { + _.each(mailing.recipients.mailings.include, function (id) { if (!first) { names = names + ', '; } @@ -224,10 +201,10 @@ }); return names; }; - $scope.getExcludesAsString = function () { + $scope.getExcludesAsString = function (mailing) { var first = true; var names = ''; - _.each($scope.mailing.recipients.groups.exclude, function (id) { + _.each(mailing.recipients.groups.exclude, function (id) { if (!first) { names = names + ', '; } @@ -235,7 +212,7 @@ names = names + group[0].title; first = false; }); - _.each($scope.mailing.recipients.mailings.exclude, function (id) { + _.each(mailing.recipients.mailings.exclude, function (id) { if (!first) { names = names + ', '; } @@ -245,6 +222,32 @@ }); return names; }; + }); + + // Controller for the edit-recipients fields ( + // WISHLIST: Move most of this to a (cache-enabled) service + // Scope members: + // - [input] mailing: object + // - [output] recipients: array of recipient records + angular.module('crmMailing').controller('EditRecipCtrl', function EditRecipCtrl($scope, dialogService, crmApi, crmMailingMgr, $q, crmMetadata) { + var ts = $scope.ts = CRM.ts(null); + $scope.recipients = null; + $scope.getRecipientsEstimate = function () { + var ts = $scope.ts; + if ($scope.recipients === null) { + return ts('(Estimating)'); + } + if ($scope.recipients.length === 0) { + return ts('No recipients'); + } + if ($scope.recipients.length === 1) { + return ts('~1 recipient'); + } + if (RECIPIENTS_PREVIEW_LIMIT > 0 && $scope.recipients.length >= RECIPIENTS_PREVIEW_LIMIT) { + return ts('>%1 recipients', {1: RECIPIENTS_PREVIEW_LIMIT}); + } + return ts('~%1 recipients', {1: $scope.recipients.length}); + }; // We monitor four fields -- use debounce so that changes across the // four fields can settle-down before AJAX. diff --git a/js/angular-crmMailing/directives.js b/js/angular-crmMailing/directives.js index 4767e3ccfc..3ebf10b6a5 100644 --- a/js/angular-crmMailing/directives.js +++ b/js/angular-crmMailing/directives.js @@ -175,7 +175,7 @@ crmOn: '@', crmTitle: '@' }, - template: '{{crmTitle}} ', + template: '{{evalTitle}} ', link: function (scope, element, attrs) { function refresh() { if (scope.$parent.$eval(attrs.crmOn)) { @@ -186,7 +186,7 @@ scope.spanClasses = {'crmMailing-inactive': true}; scope.iconClasses = {'ui-icon-close': true}; } - scope.crmTitle = scope.$parent.$eval(attrs.crmTitle); + scope.evalTitle = scope.$parent.$eval(attrs.crmTitle); } refresh(); diff --git a/js/angular-crmMailingAB.js b/js/angular-crmMailingAB.js index 115c46d4d0..77ff3583a4 100644 --- a/js/angular-crmMailingAB.js +++ b/js/angular-crmMailingAB.js @@ -211,11 +211,11 @@ if ($scope.abtest.ab.status != activeMailingStatus) { activeMailingStatus = $scope.abtest.ab.status; activeMailings = [ - {name: 'a', title: ts('Mailing A'), mailing: $scope.abtest.mailings.a}, - {name: 'b', title: ts('Mailing B'), mailing: $scope.abtest.mailings.b} + {name: 'a', title: ts('Mailing A'), mailing: $scope.abtest.mailings.a, attachments: $scope.abtest.attachments.a}, + {name: 'b', title: ts('Mailing B'), mailing: $scope.abtest.mailings.b, attachments: $scope.abtest.attachments.b} ]; if ($scope.abtest.ab.status == 'Final') { - activeMailings.push({name: 'c', title: ts('Final'), mailing: $scope.abtest.mailings.c}); + activeMailings.push({name: 'c', title: ts('Final'), mailing: $scope.abtest.mailings.c, attachments: $scope.abtest.attachments.c}); } } return activeMailings; diff --git a/partials/crmMailing/review.html b/partials/crmMailing/review.html index d6a8660711..662c2a1d14 100644 --- a/partials/crmMailing/review.html +++ b/partials/crmMailing/review.html @@ -9,13 +9,15 @@ Required vars: mailing {{mailing.name}}
-
-
{{getRecipientsEstimate()}}
-
- ({{ts('Include:')}} {{getIncludesAsString()}}) -
-
- ({{ts('Exclude:')}} {{getExcludesAsString()}}) +
+
+ +
+ ({{ts('Include:')}} {{getIncludesAsString(mailing)}}) +
+
+ ({{ts('Exclude:')}} {{getExcludesAsString(mailing)}}) +
diff --git a/partials/crmMailingAB/report.html b/partials/crmMailingAB/report.html index 7083ae82bf..6a8cab1663 100644 --- a/partials/crmMailingAB/report.html +++ b/partials/crmMailingAB/report.html @@ -1,38 +1,108 @@
+ + + + + + + + + + + + + + + + + + + + + - - + + - - + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + +
+ +
{{ts('Delivery Summary')}}{{am.title}}
{{statType.title}} + + {{stats[am.name][statType.name] || ts('n/a')}} +
{{ts('Details')}} {{am.title}}
{{ts('HTML')}}
{{ts('Mailing Name')}} - {{ts('View')}} + {{am.mailing.name}}
{{ts('Text')}}
{{ts('From')}} - {{ts('View')}} + "{{am.mailing.from_name}}" <{{am.mailing.from_email}}>
{{statType.title}}
{{ts('Subject')}} - {{stats[am.name][statType.name] || ts('n/a')}} - + {{am.mailing.subject}}
{{ts('Recipients')}} - +
+ {{ts('Include:')}} {{getIncludesAsString(am.mailing)}} +
+
+ {{ts('Exclude:')}} {{getExcludesAsString(am.mailing)}} +
+
{{ts('Content')}} + {{ts('HTML')}} + {{ts('Text')}} +
{{ts('Attachments')}} + +
{{ts('Tracking')}} +
+
+
{{ts('Responding')}} +
+
+ +
{{ts('Publication')}} + {{am.mailing.visibility}}
-- 2.25.1