From 679b39236b56f25f52a5c1568d1f95863672b22e Mon Sep 17 00:00:00 2001 From: aditya-nambiar Date: Mon, 18 Aug 2014 18:37:30 +0530 Subject: [PATCH] template & subject linking --- js/angular-crmMailingAB.js | 23 ++++++++++++++++------- partials/abtesting/tab1.html | 12 +++++++----- partials/abtesting/tab3.html | 2 +- 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/js/angular-crmMailingAB.js b/js/angular-crmMailingAB.js index 42532f49cd..599393978d 100755 --- a/js/angular-crmMailingAB.js +++ b/js/angular-crmMailingAB.js @@ -151,6 +151,9 @@ $scope.sparestuff.isnew = false; $scope.sparestuff.allgroups = ""; $scope.mailid = []; + $scope.preventsubmit = false; + + mltokens = CRM.crmMailing.mailTokens; if ($scope.currentABTest.declare_winning_time != null) { $scope.ans = $scope.currentABTest.declare_winning_time.split(" "); @@ -216,7 +219,6 @@ } else { $scope.sparestuff.template = $scope.templates[0]; - $scope.currentABTest.testing_criteria_id=1; } @@ -329,7 +331,7 @@ if (data.is_error == 0) { $scope.mailB.id = data.id; $scope.currentABTest.mailing_id_b = $scope.mailB.id; - $scope.append_mails(); + //$scope.append_mails(); } }); }; @@ -337,6 +339,7 @@ $scope.savec = function (dat) { var flag = 0; var result = crmApi('Mailing', 'create', dat, true); + result.success(function (data) { if (data.is_error == 0) { $scope.mailC.id = data.id; @@ -498,7 +501,8 @@ for (var a in $scope.tmpList) { if ($scope.tmpList[a].id == $scope.mailA.msg_template_id) { $scope.mailA.body_html = $scope.tmpList[a].msg_html; - $scope.mailA.subject=$scope.tmpList[a].msg_subject; + if(typeof $scope.mailA.subject == 'undefined' || $scope.mailA.subject.length == 0) + {$scope.mailA.subject=$scope.tmpList[a].msg_subject;} } } } @@ -514,7 +518,8 @@ for (var a in $scope.tmpList) { if ($scope.tmpList[a].id == $scope.mailB.msg_template_id) { $scope.mailB.body_html = $scope.tmpList[a].msg_html; - $scope.mailB.subject=$scope.tmpList[a].msg_subject; + if(typeof $scope.mailB.subject == 'undefined' || $scope.mailB.subject.length ==0) + { $scope.mailB.subject=$scope.tmpList[a].msg_subject;} } } @@ -530,7 +535,8 @@ for (var a in $scope.tmpList) { if ($scope.tmpList[a].id == $scope.mailA.msg_template_id) { $scope.mailA.body_html = $scope.tmpList[a].msg_html; - $scope.mailA.subject=$scope.tmpList[a].msg_subject; + if(typeof $scope.mailA.subject == 'undefined' || $scope.mailA.subject.length == 0) + {$scope.mailA.subject=$scope.tmpList[a].msg_subject;} } } } @@ -545,7 +551,8 @@ for (var a in $scope.tmpList) { if ($scope.tmpList[a].id == $scope.mailB.msg_template_id) { $scope.mailB.body_html = $scope.tmpList[a].msg_html; - $scope.mailB.subject=$scope.tmpList[a].msg_subject; + if(typeof $scope.mailB.subject == 'undefined' || $scope.mailB.subject.length == 0) + { $scope.mailB.subject=$scope.tmpList[a].msg_subject;} } } @@ -639,6 +646,7 @@ }); }); + crmMailingAB.directive('nexttab', function () { return { // Restrict it to be an attribute in this case @@ -964,7 +972,8 @@ campaign_id: scope.mailB.campaign_id == null ? "" : scope.mailB.campaign_id, header_id: scope.mailB.header_id, footer_id: scope.mailB.footer_id, - is_completed: scope.mailA.is_completed + is_completed: scope.mailA.is_completed, +// api.mailing_job.create: 0 }); }); } diff --git a/partials/abtesting/tab1.html b/partials/abtesting/tab1.html index 185ae60162..b3e2ef48b1 100755 --- a/partials/abtesting/tab1.html +++ b/partials/abtesting/tab1.html @@ -1,23 +1,25 @@

What would you like to name the Test?


-


+ + *This field is required +

What would you like to test?



  + ng-checked="currentABTest.testing_criteria_id==1" > Subject Lines

  + ng-checked="currentABTest.testing_criteria_id==2" > From Names

  + ng-checked="currentABTest.testing_criteria_id==3" > Two different Emails

 
- + diff --git a/partials/abtesting/tab3.html b/partials/abtesting/tab3.html index 3e5c9d086b..145ed874e3 100755 --- a/partials/abtesting/tab3.html +++ b/partials/abtesting/tab3.html @@ -17,7 +17,7 @@

How will the winner be decided


-   Open

+   Open

  Total Unique Clicks

  Total -- 2.25.1