Merge pull request #22382 from colemanw/api4ExplorerFormatArrayParams
[civicrm-core.git] / ang / crmMailingAB.js
1 (function(angular, $, _) {
2
3 angular.module('crmMailingAB', CRM.angRequires('crmMailingAB'));
4 angular.module('crmMailingAB').config([
5 '$routeProvider',
6 function($routeProvider) {
7 $routeProvider.when('/abtest', {
8 templateUrl: '~/crmMailingAB/ListCtrl.html',
9 controller: 'CrmMailingABListCtrl',
10 resolve: {
11 mailingABList: function($route, crmApi) {
12 return crmApi('MailingAB', 'get', {rowCount: 0});
13 },
14 fields: function(crmMetadata) {
15 return crmMetadata.getFields('MailingAB');
16 }
17 }
18 });
19 $routeProvider.when('/abtest/new', {
20 template: '<p>' + ts('Initializing...') + '</p>',
21 controller: 'CrmMailingABNewCtrl',
22 resolve: {
23 abtest: function($route, CrmMailingAB) {
24 var abtest = new CrmMailingAB(null);
25 return abtest.load().then(function() {
26 return abtest.save();
27 });
28 }
29 }
30 });
31 $routeProvider.when('/abtest/:id', {
32 templateUrl: '~/crmMailingAB/EditCtrl/main.html',
33 controller: 'CrmMailingABEditCtrl',
34 resolve: {
35 mailingFields: function(crmMetadata) {
36 return crmMetadata.getFields('Mailing');
37 },
38 abtest: function($route, CrmMailingAB) {
39 var abtest = new CrmMailingAB($route.current.params.id == 'new' ? null : $route.current.params.id);
40 return abtest.load();
41 }
42 }
43 });
44 }
45 ]);
46
47 })(angular, CRM.$, CRM._);