Commit | Line | Data |
---|---|---|
679996bb TO |
1 | (function(angular, $, _) { |
2 | ||
0b199194 | 3 | angular.module('crmMailingAB', CRM.angRequires('crmMailingAB')); |
679996bb TO |
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 | abtest: function($route, CrmMailingAB) { | |
36 | var abtest = new CrmMailingAB($route.current.params.id == 'new' ? null : $route.current.params.id); | |
37 | return abtest.load(); | |
38 | } | |
39 | } | |
40 | }); | |
41 | } | |
42 | ]); | |
43 | ||
44 | })(angular, CRM.$, CRM._); |