From 63430d3c162388d36bdf87348ed6f7e6ce0ee13d Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Sat, 20 Dec 2014 00:50:48 -0800 Subject: [PATCH] CRM-15578 - crmMailingAB - Improve listing * Translate strings * Remove unused help section * Display status --- js/angular-crmMailingAB.js | 6 ++++-- js/angular-crmMailingAB/services.js | 32 +++++++++++++++++++++-------- partials/crmMailingAB/list.html | 22 ++++++++------------ 3 files changed, 37 insertions(+), 23 deletions(-) diff --git a/js/angular-crmMailingAB.js b/js/angular-crmMailingAB.js index c9c5030929..ea8839f293 100644 --- a/js/angular-crmMailingAB.js +++ b/js/angular-crmMailingAB.js @@ -33,9 +33,11 @@ } ]); - angular.module('crmMailingAB').controller('CrmMailingABListCtrl', function ($scope, mailingABList, crmMailingABCriteria) { + angular.module('crmMailingAB').controller('CrmMailingABListCtrl', function ($scope, mailingABList, crmMailingABCriteria, crmMailingABStatus) { + var ts = $scope.ts = CRM.ts('CiviMail'); $scope.mailingABList = mailingABList.values; - $scope.testing_criteria = crmMailingABCriteria.getAll(); + $scope.crmMailingABCriteria = crmMailingABCriteria; + $scope.crmMailingABStatus = crmMailingABStatus; }); angular.module('crmMailingAB').controller('CrmMailingABEditCtrl', function ($scope, abtest, crmMailingABCriteria, crmMailingMgr, crmMailingPreviewMgr, crmStatus, $q, $location) { diff --git a/js/angular-crmMailingAB/services.js b/js/angular-crmMailingAB/services.js index 345b52abea..c602fda731 100644 --- a/js/angular-crmMailingAB/services.js +++ b/js/angular-crmMailingAB/services.js @@ -1,5 +1,19 @@ (function (angular, $, _) { + function OptionGroup(values) { + this.get = function get(value) { + var r = _.where(values, {value: '' + value}); + return r.length > 0 ? r[0] : null; + }; + this.getByName = function get(name) { + var r = _.where(values, {name: '' + name}); + return r.length > 0 ? r[0] : null; + }; + this.getAll = function getAll() { + return values; + }; + } + angular.module('crmMailingAB').factory('crmMailingABCriteria', function () { // TODO Get data from server var values = { @@ -7,15 +21,17 @@ '2': {value: '2', name: 'From names', label: ts('Test different "From" lines')}, '3': {value: '3', name: 'Two different emails', label: ts('Test entirely different emails')} }; - return { - get: function get(value) { - var r = _.where(values, {value: '' + value}); - return r.length > 0 ? r[0] : null; - }, - getAll: function getAll() { - return values; - } + return new OptionGroup(values); + }); + + angular.module('crmMailingAB').factory('crmMailingABStatus', function () { + // TODO Get data from server + var values = { + '1': {value: '1', name: 'Draft', label: ts('Draft')}, + '2': {value: '2', name: 'Testing', label: ts('Testing')}, + '3': {value: '3', name: 'Final', label: ts('Final')} }; + return new OptionGroup(values); }); // CrmMailingAB is a data-model which combines an AB test (APIv3 "MailingAB"), three mailings (APIv3 "Mailing"), diff --git a/partials/crmMailingAB/list.html b/partials/crmMailingAB/list.html index 780a3454c4..67b987257c 100644 --- a/partials/crmMailingAB/list.html +++ b/partials/crmMailingAB/list.html @@ -2,29 +2,25 @@ Controller: ABListingCtrl Required vars: mailingABList --> -
- A/B Testing list -
- - - - + + + - - + + @@ -33,11 +29,11 @@ Required vars: mailingABList
- You have no A/B mailings + {{ts('You have no A/B mailings')}}
-- 2.25.1
TitleIdTest Type{{ts('Name')}}{{ts('Status')}}{{ts('Test Type')}}
{{mailingAB.name}}{{mailingAB.id}}{{testing_criteria[mailingAB.testing_criteria_id].label}}{{crmMailingABStatus.getByName(mailingAB.status).label}}{{crmMailingABCriteria.get(mailingAB.testing_criteria_id).label}} - Edit  - Results + {{ts('Continue')}} + {{ts('Results')}}