From 64e42c42150ac3c15f3db4bd5cc67f9511b3eaa6 Mon Sep 17 00:00:00 2001 From: John Prescott Date: Thu, 2 Oct 2014 09:57:24 +0100 Subject: [PATCH] abtesting/subject_lines.html - Use select2 for "Reply-To" Conflicts: js/angular-crmMailingAB.js --- js/angular-crmMailingAB.js | 48 +++++++++++++++++++++++---- partials/abtesting/subject_lines.html | 6 ++-- 2 files changed, 44 insertions(+), 10 deletions(-) diff --git a/js/angular-crmMailingAB.js b/js/angular-crmMailingAB.js index b7cb5180d9..c377ad8d16 100755 --- a/js/angular-crmMailingAB.js +++ b/js/angular-crmMailingAB.js @@ -579,10 +579,7 @@ $(element).on("click", function () { if (scope.tab_val == 0) { - scope.create_abtest(); - - } else { if (scope.tab_val == 2) { @@ -606,7 +603,6 @@ scope.a_b_update(); } } - scope.tab_upd(); var myArray1 = []; @@ -983,7 +979,6 @@ } } - scope.$apply(); e.preventDefault(); }) @@ -991,7 +986,48 @@ }; }); - crmMailingAB.directive('stopa', function () { + crmMailingAB.directive('replytoselect',function(){ + return { + restrict : 'AE', + link: function(scope, element, attrs){ + + function format(item){ + return item.label.replace(/&/g, '&') + .replace(/"/g, '"') + .replace(//g, '>'); + } + + CRM.api3('OptionGroup', 'get', { + "sequential": 1, + "name": "from_email_address" + }).done(function(result) { + var emailGroupId = result.id; + console.log(result); + CRM.api3('OptionValue', 'get', { + "sequential": 1, + "option_group_id": result.id + }).done(function(orgEmails) { + console.log(orgEmails); + + //$sce.trustAsHtml( + + $(element).select2({width:"200px", + data: orgEmails.values, + formatResult: format, + formatSelection: format, + placeholder:"Select reply to address"}); + + }); + + }); + + + } + }; + }); + + crmMailingAB.directive('stopa',function(){ return { restrict: 'AE', link: function (scope, element, attrs) { diff --git a/partials/abtesting/subject_lines.html b/partials/abtesting/subject_lines.html index 9d72d536c0..45678192a7 100755 --- a/partials/abtesting/subject_lines.html +++ b/partials/abtesting/subject_lines.html @@ -11,10 +11,8 @@ Reply to E-mail Address - + -- 2.25.1