From e038321fa6a5958b3bac9a598b91c06fc8bbb191 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Wed, 18 Feb 2015 20:08:53 -0800 Subject: [PATCH] crmMailingAB - report.html - Loop over mailings --- js/angular-crmMailingAB.js | 15 ++++++++++++ partials/crmMailingAB/report.html | 38 ++++++++++--------------------- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/js/angular-crmMailingAB.js b/js/angular-crmMailingAB.js index 89d49bdfe2..115c46d4d0 100644 --- a/js/angular-crmMailingAB.js +++ b/js/angular-crmMailingAB.js @@ -206,6 +206,21 @@ angular.module('crmMailingAB').controller('CrmMailingABReportCtrl', function ($scope, crmApi, crmMailingStats) { var ts = $scope.ts = CRM.ts(null); + var activeMailingStatus = null, activeMailings = null; + $scope.getActiveMailings = function() { + 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} + ]; + if ($scope.abtest.ab.status == 'Final') { + activeMailings.push({name: 'c', title: ts('Final'), mailing: $scope.abtest.mailings.c}); + } + } + return activeMailings; + }; + crmMailingStats.getStats({ a: $scope.abtest.ab.mailing_id_a, b: $scope.abtest.ab.mailing_id_b, diff --git a/partials/crmMailingAB/report.html b/partials/crmMailingAB/report.html index d76ca77371..7083ae82bf 100644 --- a/partials/crmMailingAB/report.html +++ b/partials/crmMailingAB/report.html @@ -3,48 +3,34 @@ {{ts('Details')}} - {{ts('Mailing A')}} - {{ts('Mailing B')}} - {{ts('Final')}} + {{am.title}} {{ts('HTML')}} - {{ts('View')}} - {{ts('View')}} - {{ts('View')}} + + {{ts('View')}} + {{ts('Text')}} - {{ts('View')}} - {{ts('View')}} - {{ts('View')}} + + {{ts('View')}} + {{statType.title}} - - {{stats.a[statType.name] || ts('n/a')}} - - - - {{stats.b[statType.name] || ts('n/a')}} - - - - {{stats.a[statType.name] || ts('n/a')}} - + + {{stats[am.name][statType.name] || ts('n/a')}} + - - - - - + + - -- 2.25.1