}
]);
- 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) {
(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 = {
'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"),
Controller: ABListingCtrl
Required vars: mailingABList
-->
-<div id="help">
- A/B Testing list
-</div>
<div ng-show="!$.isEmptyObject(mailingABList)">
<table class="display">
<thead>
<tr>
- <th>Title</th>
- <th>Id</th>
- <th>Test Type</th>
- <th></th>
+ <th>{{ts('Name')}}</th>
+ <th>{{ts('Status')}}</th>
+ <th>{{ts('Test Type')}}</th>
<th></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="mailingAB in mailingABList">
<td>{{mailingAB.name}}</td>
- <td>{{mailingAB.id}}</td>
- <td>{{testing_criteria[mailingAB.testing_criteria_id].label}}</td>
+ <td>{{crmMailingABStatus.getByName(mailingAB.status).label}}</td>
+ <td>{{crmMailingABCriteria.get(mailingAB.testing_criteria_id).label}}</td>
<td>
- <a class="action-item crm-hover-button" ng-href="#/abtest/{{mailingAB.id}}">Edit</a> 
- <a class="action-item crm-hover-button" ng-href="#/abtest/report/{{mailingAB.id}}">Results</a>
+ <a class="action-item crm-hover-button" ng-href="#/abtest/{{mailingAB.id}}" ng-show="mailingAB.status == 'Draft'">{{ts('Continue')}}</a>
+ <a class="action-item crm-hover-button" ng-href="#/abtest/{{mailingAB.id}}/report" ng-show="mailingAB.status != 'Draft'">{{ts('Results')}}</a>
</td>
</tr>
</tbody>
<div ng-show="$.isEmptyObject(mailingABList)" class="messages status no-popup">
<div class="icon inform-icon"></div>
- You have no A/B mailings
+ {{ts('You have no A/B mailings')}}
</div>
<div class="crm-submit-buttons">
<br>
- <a ng-href="#/abtest/new" class="button"><span><div class="icon add-icon"></div>New A/B Test</span></a>
+ <a ng-href="#/abtest/new" class="button"><span><div class="icon add-icon"></div>{{ts('New A/B Test')}}</span></a>
</div>