summaryrefslogtreecommitdiff
path: root/www/crm/wp-content/plugins/civicrm/civicrm/ang/crmMailingAB/BlockSetup.js
diff options
context:
space:
mode:
Diffstat (limited to 'www/crm/wp-content/plugins/civicrm/civicrm/ang/crmMailingAB/BlockSetup.js')
-rw-r--r--www/crm/wp-content/plugins/civicrm/civicrm/ang/crmMailingAB/BlockSetup.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/www/crm/wp-content/plugins/civicrm/civicrm/ang/crmMailingAB/BlockSetup.js b/www/crm/wp-content/plugins/civicrm/civicrm/ang/crmMailingAB/BlockSetup.js
new file mode 100644
index 00000000..5809cdd0
--- /dev/null
+++ b/www/crm/wp-content/plugins/civicrm/civicrm/ang/crmMailingAB/BlockSetup.js
@@ -0,0 +1,32 @@
+(function(angular, $, _) {
+
+ // example:
+ // scope.myAbtest = new CrmMailingAB();
+ // <crm-mailing-ab-block-setup="{abName: 1, group_percentage: 1}" crm-abtest="myAbtest" />
+ var simpleDirectives = {
+ crmMailingAbBlockSetup: '~/crmMailingAB/BlockSetup.html'
+ };
+ _.each(simpleDirectives, function(templateUrl, directiveName) {
+ angular.module('crmMailingAB').directive(directiveName, function($parse, crmMailingABCriteria, crmUiHelp) {
+ var scopeDesc = {crmAbtest: '@'};
+ scopeDesc[directiveName] = '@';
+
+ return {
+ scope: scopeDesc,
+ templateUrl: templateUrl,
+ link: function(scope, elm, attr) {
+ var model = $parse(attr.crmAbtest);
+ scope.abtest = model(scope.$parent);
+ scope.crmMailingConst = CRM.crmMailing;
+ scope.crmMailingABCriteria = crmMailingABCriteria;
+ scope.ts = CRM.ts(null);
+ scope.hs = crmUiHelp({file: 'CRM/Mailing/MailingUI'});
+
+ var fieldsModel = $parse(attr[directiveName]);
+ scope.fields = fieldsModel(scope.$parent);
+ }
+ };
+ });
+ });
+
+})(angular, CRM.$, CRM._);