1 (function (angular
, $, _
) {
3 angular
.module('crmMailing', CRM
.angRequires('crmMailing'));
5 angular
.module('crmMailing').config([
7 function ($routeProvider
) {
8 $routeProvider
.when('/mailing', {
9 template
: '<div></div>',
10 controller
: 'ListMailingsCtrl'
13 if (!CRM
|| !CRM
.crmMailing
) {
17 $routeProvider
.when('/mailing/new', {
18 template
: '<p>' + ts('Initializing...') + '</p>',
19 controller
: 'CreateMailingCtrl',
21 selectedMail: function(crmMailingMgr
) {
22 var m
= crmMailingMgr
.create({
23 template_type
: CRM
.crmMailing
.templateTypes
[0].name
25 return crmMailingMgr
.save(m
);
30 $routeProvider
.when('/mailing/new/:templateType', {
31 template
: '<p>' + ts('Initializing...') + '</p>',
32 controller
: 'CreateMailingCtrl',
34 selectedMail: function($route
, crmMailingMgr
) {
35 var m
= crmMailingMgr
.create({
36 template_type
: $route
.current
.params
.templateType
38 return crmMailingMgr
.save(m
);
43 $routeProvider
.when('/mailing/:id', {
44 templateUrl
: '~/crmMailing/EditMailingCtrl/base.html',
45 controller
: 'EditMailingCtrl',
47 selectedMail: function($route
, crmMailingMgr
) {
48 return crmMailingMgr
.get($route
.current
.params
.id
);
50 attachments: function($route
, CrmAttachments
) {
51 var attachments
= new CrmAttachments(function () {
52 return {entity_table
: 'civicrm_mailing', entity_id
: $route
.current
.params
.id
};
54 return attachments
.load();
61 })(angular
, CRM
.$, CRM
._
);