From 18da0e87cc18778c18001f0ced7c104fff28f1b4 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Fri, 12 Dec 2014 16:30:15 -0800 Subject: [PATCH] CRM-15578 - crmMailing2 - Extract misc, simple directives
--- js/angular-crmMailing2-directives.js | 43 +++++++++++++------ .../crmMailing2/{field => }/body_html.html | 1 - .../crmMailing2/{field => }/body_text.html | 3 +- partials/crmMailing2/edit-unified.html | 22 +++++----- partials/crmMailing2/edit-unified2.html | 22 +++++----- partials/crmMailing2/edit-wizard.html | 26 +++++------ partials/crmMailing2/edit.html | 24 ++++++----- .../crmMailing2/field/msg_template_id.html | 13 ------ partials/crmMailing2/field/recipients.html | 27 ------------ partials/crmMailing2/mailing.html | 37 ++++++++++++++-- 10 files changed, 113 insertions(+), 105 deletions(-) rename partials/crmMailing2/{field => }/body_html.html (87%) rename partials/crmMailing2/{field => }/body_text.html (86%) delete mode 100644 partials/crmMailing2/field/msg_template_id.html delete mode 100644 partials/crmMailing2/field/recipients.html diff --git a/js/angular-crmMailing2-directives.js b/js/angular-crmMailing2-directives.js index 93abce664d..63387786df 100644 --- a/js/angular-crmMailing2-directives.js +++ b/js/angular-crmMailing2-directives.js @@ -5,19 +5,36 @@ var crmMailing2 = angular.module('crmMailing2'); - crmMailing2.directive('crmMailingBlockPublication', function ($parse) { - return { - scope: { - crmMailing: '@' - }, - templateUrl: partialUrl('publication.html'), - link: function (scope, elm, attr) { - var model = $parse(attr.crmMailing); - scope.mailing = model(scope.$parent); - scope.crmMailingConst = CRM.crmMailing; - scope.ts = CRM.ts('CiviMail'); - } - }; + // The following directives have the same simple implementation -- load + // a template and export a "mailing" object into scope. + var simpleBlocks = { + crmMailingBlockHeaderFooter: partialUrl('headerFooter.html'), + crmMailingBlockMailing: partialUrl('mailing.html'), + crmMailingBlockPreview: partialUrl('preview.html'), + crmMailingBlockPublication: partialUrl('publication.html'), + crmMailingBlockResponses: partialUrl('responses.html'), + crmMailingBlockReview: partialUrl('review.html'), + crmMailingBlockSchedule: partialUrl('schedule.html'), + crmMailingBlockSummary: partialUrl('summary.html'), + crmMailingBlockTracking: partialUrl('tracking.html'), + crmMailingBodyHtml: partialUrl('body_html.html'), + crmMailingBodyText: partialUrl('body_text.html') + }; + _.each(simpleBlocks, function(templateUrl, directiveName){ + crmMailing2.directive(directiveName, function ($parse) { + return { + scope: { + crmMailing: '@' + }, + templateUrl: templateUrl, + link: function (scope, elm, attr) { + var model = $parse(attr.crmMailing); + scope.mailing = model(scope.$parent); + scope.crmMailingConst = CRM.crmMailing; + scope.ts = CRM.ts('CiviMail'); + } + }; + }); }); crmMailing2.directive('crmMailingReviewBool', function () { diff --git a/partials/crmMailing2/field/body_html.html b/partials/crmMailing2/body_html.html similarity index 87% rename from partials/crmMailing2/field/body_html.html rename to partials/crmMailing2/body_html.html index 5b30119e9c..4c4813f18b 100644 --- a/partials/crmMailing2/field/body_html.html +++ b/partials/crmMailing2/body_html.html @@ -1,5 +1,4 @@
diff --git a/partials/crmMailing2/field/body_text.html b/partials/crmMailing2/body_text.html similarity index 86% rename from partials/crmMailing2/field/body_text.html rename to partials/crmMailing2/body_text.html index 11f336a467..c4dc4600dc 100644 --- a/partials/crmMailing2/field/body_text.html +++ b/partials/crmMailing2/body_text.html @@ -1,8 +1,7 @@
- \ No newline at end of file + diff --git a/partials/crmMailing2/edit-unified.html b/partials/crmMailing2/edit-unified.html index 48bd90b9fb..2a717e3ace 100644 --- a/partials/crmMailing2/edit-unified.html +++ b/partials/crmMailing2/edit-unified.html @@ -1,19 +1,19 @@
-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
- \ No newline at end of file + diff --git a/partials/crmMailing2/edit-unified2.html b/partials/crmMailing2/edit-unified2.html index 983ee5d207..1c45e1a945 100644 --- a/partials/crmMailing2/edit-unified2.html +++ b/partials/crmMailing2/edit-unified2.html @@ -1,17 +1,17 @@
-
-
- +
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
diff --git a/partials/crmMailing2/edit-wizard.html b/partials/crmMailing2/edit-wizard.html index df1cbbff48..316404bc38 100644 --- a/partials/crmMailing2/edit-wizard.html +++ b/partials/crmMailing2/edit-wizard.html @@ -4,19 +4,19 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
- diff --git a/partials/crmMailing2/edit.html b/partials/crmMailing2/edit.html index 654d7b9b4c..8ea23f7b65 100644 --- a/partials/crmMailing2/edit.html +++ b/partials/crmMailing2/edit.html @@ -7,16 +7,16 @@
-
+
-
+
-
+
-
+
@@ -27,31 +27,33 @@
-
+
-
+
-
+
-
+
-
+
- diff --git a/partials/crmMailing2/field/msg_template_id.html b/partials/crmMailing2/field/msg_template_id.html deleted file mode 100644 index b512c1eef7..0000000000 --- a/partials/crmMailing2/field/msg_template_id.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - diff --git a/partials/crmMailing2/field/recipients.html b/partials/crmMailing2/field/recipients.html deleted file mode 100644 index 1e86be96da..0000000000 --- a/partials/crmMailing2/field/recipients.html +++ /dev/null @@ -1,27 +0,0 @@ - -
-
- -
- - -
-
- - -
diff --git a/partials/crmMailing2/mailing.html b/partials/crmMailing2/mailing.html index 1bb1c396ad..e559979fdc 100644 --- a/partials/crmMailing2/mailing.html +++ b/partials/crmMailing2/mailing.html @@ -5,8 +5,18 @@ Required vars: mailing, crmMailingConst
-
-
+
+ +
@@ -34,8 +44,27 @@ Required vars: mailing, crmMailingConst
-
-
+
+
+ +
+ + +
+
+
-- 2.25.1