dev/core#651 Fix group by on export soft credits (possible recent regression, clearly...
[civicrm-core.git] / ang / crmMailing.js
1 (function (angular, $, _) {
2
3 angular.module('crmMailing', CRM.angRequires('crmMailing'));
4
5 angular.module('crmMailing').config([
6 '$routeProvider',
7 function ($routeProvider) {
8 $routeProvider.when('/mailing', {
9 template: '<div></div>',
10 controller: 'ListMailingsCtrl'
11 });
12
13 if (!CRM || !CRM.crmMailing) {
14 return;
15 }
16
17 $routeProvider.when('/mailing/new', {
18 template: '<p>' + ts('Initializing...') + '</p>',
19 controller: 'CreateMailingCtrl',
20 resolve: {
21 selectedMail: function(crmMailingMgr) {
22 var m = crmMailingMgr.create({
23 template_type: CRM.crmMailing.templateTypes[0].name
24 });
25 return crmMailingMgr.save(m);
26 }
27 }
28 });
29
30 $routeProvider.when('/mailing/new/:templateType', {
31 template: '<p>' + ts('Initializing...') + '</p>',
32 controller: 'CreateMailingCtrl',
33 resolve: {
34 selectedMail: function($route, crmMailingMgr) {
35 var m = crmMailingMgr.create({
36 template_type: $route.current.params.templateType
37 });
38 return crmMailingMgr.save(m);
39 }
40 }
41 });
42
43 $routeProvider.when('/mailing/:id', {
44 templateUrl: '~/crmMailing/EditMailingCtrl/base.html',
45 controller: 'EditMailingCtrl',
46 resolve: {
47 selectedMail: function($route, crmMailingMgr) {
48 return crmMailingMgr.get($route.current.params.id);
49 },
50 attachments: function($route, CrmAttachments) {
51 var attachments = new CrmAttachments(function () {
52 return {entity_table: 'civicrm_mailing', entity_id: $route.current.params.id};
53 });
54 return attachments.load();
55 }
56 }
57 });
58 }
59 ]);
60
61 })(angular, CRM.$, CRM._);