$result = array();
$result['crmMailing'] = array(
'ext' => 'civicrm',
- 'js' => array('js/angular-Mailing.js' , 'js/angularsanitize.js' , 'packages/ckeditor/ckeditor.js'),
+ 'js' => array(
+ 'js/angular-Mailing.js' ,
+ 'js/angularsanitize.js' ,
+ 'packages/ckeditor/ckeditor.js'
+ ),
+ );
+ $result['crmMailing2'] = array(
+ 'ext' => 'civicrm',
+ 'js' => array('js/angular-crmMailing2.js'),
);
$result['crmMailingAB'] = array(
'ext' => 'civicrm',
var idCount = 0;
angular.module('crmUi', [])
+
+ // example <div crm-ui-accordion crm-title="ts('My Title')">...content...</div>
+ .directive('crmUiAccordion', function() {
+ return {
+ scope: {
+ crmTitle: '@'
+ },
+ template: '<div><b>(Accordion: {{$parent.$eval(crmTitle)}})</b><span ng-transclude/></div>',
+ transclude: true,
+ link: function (scope, element, attrs) {}
+ };
+ })
+
// example: <form name="myForm">...<label crm-ui-label crm-for="myField">My Field</span>...<input name="myField"/>...</form>
//
// Label adapts based on <input required>, <input ng-required>, or any other validation.
}
};
})
+
+ // example <div crm-ui-tab crm-title="ts('My Title')">...content...</div>
+ .directive('crmUiTab', function($parse) {
+ return {
+ scope: {
+ crmTitle: '@'
+ },
+ template: '<div><b>(Tab: {{$parent.$eval(crmTitle)}})</b><span ng-transclude/></div>',
+ transclude: true,
+ link: function (scope, element, attrs) {}
+ };
+ })
+
+ // example: <div crm-ui-tab-set><div crm-ui-tab crm-title="Tab 1">...</div><div crm-ui-tab crm-title="Tab 2">...</div></div>
+ .directive('crmUiTabSet', function() {
+ return {
+ template: '<div><span ng-transclude/></div>',
+ transclude: true,
+ link: function (scope, element, attrs) {}
+ };
+ })
+
+ // example: <div crm-ui-wizard><div crm-ui-wizard-step crm-title="Step 1">...</div><div crm-ui-wizard-step crm-title="Step 2">...</div></div>
+ .directive('crmUiWizard', function() {
+ return {
+ template: '<div><span ng-transclude/></div>',
+ transclude: true,
+ link: function (scope, element, attrs) {}
+ };
+ })
+
+ .directive('crmUiWizardFooter', function() {
+ return {
+ template: '<div><span ng-transclude/></div>',
+ transclude: true,
+ link: function (scope, element, attrs) {}
+ };
+ })
+
+ // example <div crm-ui-wizard-step crm-title="ts('My Title')">...content...</div>
+ .directive('crmUiWizardStep', function() {
+ return {
+ scope: {
+ crmTitle: '@'
+ },
+ template: '<div><b>(Step: {{$parent.$eval(crmTitle)}})</b><span ng-transclude/></div>',
+ transclude: true,
+ link: function (scope, element, attrs) {}
+ };
+ })
+
// Example: <button crm-confirm="{message: ts('Are you sure you want to continue?')}" on-yes="frobnicate(123)">Frobincate</button>
// Example: <button crm-confirm="{type: 'disable', obj: myObject}" on-yes="myObject.is_active=0; myObject.save()">Disable</button>
.directive('crmConfirm', function () {
--- /dev/null
+(function (angular, $, _) {
+ var partialUrl = function (relPath) {
+ return CRM.resourceUrls['civicrm'] + '/partials/crmMailing2/' + relPath;
+ };
+
+ var crmMailing2 = angular.module('crmMailing2', ['ngRoute', 'ui.utils', 'crmUi']); // TODO ngSanitize, unsavedChanges
+
+ /**
+ * Initialize a new mailing
+ * TODO Move to separate file or service
+ */
+ var createMailing = function () {
+ return {
+ visibility: "Public Pages",
+ url_tracking: "1",
+ dedupe_email: "1",
+ forward_replies: "0",
+ auto_responder: "0",
+ open_tracking: "1"
+ };
+ };
+
+ crmMailing2.config(['$routeProvider',
+ function ($routeProvider) {
+ $routeProvider.when('/mailing2', {
+ template: '<div></div>',
+ controller: 'ListMailingsCtrl'
+ });
+
+ $routeProvider.when('/mailing2/:id', {
+ templateUrl: partialUrl('edit.html'),
+ controller: 'EditMailingCtrl',
+ resolve: {
+ selectedMail: function ($route, crmApi) {
+ return ($route.current.params.id == 'new')
+ ? createMailing()
+ : crmApi('Mailing', 'getsingle', {id: $route.current.params.id});
+ }
+ }
+ });
+ }
+ ]);
+
+ crmMailing2.controller('ListMailingsCtrl', function ($scope) {
+ // We haven't implemented this in Angular, but some users may get clever
+ // about typing URLs, so we'll provide a redirect.
+ window.location = CRM.url('civicrm/mailing/browse/unscheduled', {
+ reset: 1,
+ scheduled: 'false'
+ });
+ });
+
+ crmMailing2.controller('EditMailingCtrl', function ($scope, selectedMail) {
+ $scope.partialUrl = partialUrl;
+ $scope.ts = CRM.ts('CiviMail');
+ $scope.deleteMe = 'deleteMe';
+ });
+
+})(angular, CRM.$, CRM._);
--- /dev/null
+attachments.html
--- /dev/null
+<div crm-ui-wizard>
+ <div crm-ui-wizard-step crm-title="ts('Define Mailing')">
+ <div crm-ui-accordion crm-title="ts('Summary')">
+ <div ng-include="partialUrl('summary.html')" />
+ </div>
+ <div crm-ui-tabset>
+ <div crm-ui-tab crm-title="ts('Mailing')">
+ <div ng-include="partialUrl('mailing.html')" />
+ </div>
+ <div crm-ui-tab crm-title="ts('Attachments')">
+ <div ng-include="partialUrl('attachments.html')" />
+ </div>
+ <div crm-ui-tab crm-title="ts('Header and Footer')">
+ <div ng-include="partialUrl('headerFooter.html')" />
+ </div>
+ <div crm-ui-tab crm-title="ts('Publication')">
+ <div ng-include="partialUrl('publication.html')" />
+ </div>
+ <div crm-ui-tab crm-title="ts('Responses')">
+ <div ng-include="partialUrl('responses.html')" />
+ </div>
+ <div crm-ui-tab crm-title="ts('Tracking')">
+ <div ng-include="partialUrl('tracking.html')" />
+ </div>
+ </div>
+ <div crm-ui-accordion crm-title="ts('Preview')">
+ <div ng-include="partialUrl('preview.html')" />
+ </div>
+ </div>
+ <div crm-ui-wizard-step crm-title="ts('Review and Schedule')">
+ <div crm-ui-accordion crm-title="ts('Review')">
+ <div ng-include="partialUrl('review.html')" />
+ </div>
+ <div crm-ui-accordion crm-title="ts('Schedule')">
+ <div ng-include="partialUrl('schedule.html')" />
+ <button ng-click="mailing.send();
+ gotoListing();">Schedule</button>
+ </div>
+ </div>
+ <div crm-ui-wizard-footer>
+ <button ng-click="mailing.save();
+ gotoListing();">Save Draft</button>
+ <button ng-click="mailing.destroy();
+ gotoListing();">Abort</button>
+ </div>
+
+</div>
--- /dev/null
+headerFooter.html
--- /dev/null
+mailing.html
--- /dev/null
+preview.html
--- /dev/null
+publication.html
--- /dev/null
+responses.html
--- /dev/null
+review.html
--- /dev/null
+schedule.html
--- /dev/null
+summary.html
--- /dev/null
+tracking.html