diff options
author | Yaco <franco@reevo.org> | 2020-06-04 11:01:00 -0300 |
---|---|---|
committer | Yaco <franco@reevo.org> | 2020-06-04 11:01:00 -0300 |
commit | fc7369835258467bf97eb64f184b93691f9a9fd5 (patch) | |
tree | daabd60089d2dd76d9f5fb416b005fbe159c799d /www/crm/wp-content/plugins/civicrm/civicrm/ang/crmMailing.js |
first commit
Diffstat (limited to 'www/crm/wp-content/plugins/civicrm/civicrm/ang/crmMailing.js')
-rw-r--r-- | www/crm/wp-content/plugins/civicrm/civicrm/ang/crmMailing.js | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/www/crm/wp-content/plugins/civicrm/civicrm/ang/crmMailing.js b/www/crm/wp-content/plugins/civicrm/civicrm/ang/crmMailing.js new file mode 100644 index 00000000..95148bf2 --- /dev/null +++ b/www/crm/wp-content/plugins/civicrm/civicrm/ang/crmMailing.js @@ -0,0 +1,61 @@ +(function (angular, $, _) { + + angular.module('crmMailing', CRM.angRequires('crmMailing')); + + angular.module('crmMailing').config([ + '$routeProvider', + function ($routeProvider) { + $routeProvider.when('/mailing', { + template: '<div></div>', + controller: 'ListMailingsCtrl' + }); + + if (!CRM || !CRM.crmMailing) { + return; + } + + $routeProvider.when('/mailing/new', { + template: '<p>' + ts('Initializing...') + '</p>', + controller: 'CreateMailingCtrl', + resolve: { + selectedMail: function(crmMailingMgr) { + var m = crmMailingMgr.create({ + template_type: CRM.crmMailing.templateTypes[0].name + }); + return crmMailingMgr.save(m); + } + } + }); + + $routeProvider.when('/mailing/new/:templateType', { + template: '<p>' + ts('Initializing...') + '</p>', + controller: 'CreateMailingCtrl', + resolve: { + selectedMail: function($route, crmMailingMgr) { + var m = crmMailingMgr.create({ + template_type: $route.current.params.templateType + }); + return crmMailingMgr.save(m); + } + } + }); + + $routeProvider.when('/mailing/:id', { + templateUrl: '~/crmMailing/EditMailingCtrl/base.html', + controller: 'EditMailingCtrl', + resolve: { + selectedMail: function($route, crmMailingMgr) { + return crmMailingMgr.get($route.current.params.id); + }, + attachments: function($route, CrmAttachments) { + var attachments = new CrmAttachments(function () { + return {entity_table: 'civicrm_mailing', entity_id: $route.current.params.id}; + }); + return attachments.load(); + } + } + }); + } + ]); + +})(angular, CRM.$, CRM._); |