From 51d54a28f0a0d07d462121fe0e4f82d8bed1c318 Mon Sep 17 00:00:00 2001 From: aditya-nambiar Date: Mon, 16 Jun 2014 17:03:24 -0400 Subject: [PATCH] Code Cleaned --- js/angular-crmMailingAB.js | 116 ++++------------------------- partials/abtesting/helloworld.html | 89 ++++++---------------- 2 files changed, 37 insertions(+), 168 deletions(-) diff --git a/js/angular-crmMailingAB.js b/js/angular-crmMailingAB.js index 332d5a4149..48e884e22b 100644 --- a/js/angular-crmMailingAB.js +++ b/js/angular-crmMailingAB.js @@ -11,8 +11,6 @@ var crmMailingAB = angular.module('crmMailingAB', ['ngRoute', 'ui.utils']); - -//------------------------------------------------------------------------------------------------------- crmMailingAB.config(['$routeProvider', function($routeProvider) { $routeProvider.when('/mailing', { @@ -25,9 +23,7 @@ } }); - $routeProvider.when('/mailing/abtesting', { - templateUrl: partialUrl('helloworld.html'), controller: 'TabsDemoCtrl', resolve: { @@ -37,13 +33,8 @@ mailingList: function($route, crmApi) { return crmApi('Mailing', 'get', {}); } - } - - }); - - } ]); //----------------------------------------- @@ -54,25 +45,25 @@ $scope.groups = metaData.values; $scope.mailings = mailingList.values; - $scope.adi=0; + $scope.tab_val=0; $scope.campaign_clicked= function(){ - if($scope.adi >= 0 ){ - $scope.adi =0; + if($scope.tab_val >= 0 ){ + $scope.tab_val =0; } }; $scope.compose_clicked=function(){ - if($scope.adi >=1){ - $scope.adi =1; + if($scope.tab_val >=1){ + $scope.tab_val =1; } }; $scope.rec_clicked=function(){ - if($scope.adi >=2){ - $scope.adi =2; + if($scope.tab_val >=2){ + $scope.tab_val =2; } }; $scope.preview_clicked=function(){ - if($scope.adi>=3){ - $scope.adi=3; + if($scope.tab_val>=3){ + $scope.tab_val=3; } }; $scope.templates = @@ -83,12 +74,6 @@ $scope.slide_value = 0; - $scope.$watch("automated", function() { - - console.log("Smsdd"); - - }); - $scope.setifyes= function(val){ if(val ==1) { $scope.ifyes = true; @@ -99,8 +84,6 @@ $scope.send_date ="10/4/2004"; - - }); crmMailingAB.directive('nexttab', function() { @@ -113,17 +96,16 @@ $(element).parent().parent().parent().tabs(scope.$eval(attrs.nexttab)); var myarr = new Array(1,2,3) $(element).parent().parent().parent().tabs({disabled:myarr}); - //$(element).parent().parent().parent().tabs({"enable":1}); $(element).on("click",function() { - scope.adi=scope.adi +1; + scope.tab_val=scope.tab_val +1; var myArray1 = new Array( ); - for ( var i = scope.adi+1; i < 4; i++ ) { + for ( var i = scope.tab_val+1; i < 4; i++ ) { myArray1.push(i); console.log( "try " + i ); } $(element).parent().parent().parent().tabs( "option", "disabled", myArray1 ); - $(element).parent().parent().parent().tabs({active:scope.adi}); + $(element).parent().parent().parent().tabs({active:scope.tab_val}); console.log("adiroxxx"); }); } @@ -132,17 +114,10 @@ crmMailingAB.directive('groupselect',function(){ return { - restrict : 'AE', - link: function(scope,element, attrs){ - $(element).select2({width:"400px",placeholder: "Select the groups you wish to include"}); $(element).select2("data",groups) - - - - } }; @@ -150,43 +125,25 @@ crmMailingAB.directive('sliderbar',function(){ return{ - restrict: 'AE', - link: function(scope,element, attrs){ - $(element).slider({min:1}); $(element).slider({ slide: function( event, ui ) { scope.slide_value = ui.value; scope.$apply(); - } }); - } - }; - }); - - crmMailingAB.directive('tpmax',function(){ return { - restrict: 'E', - - - link: function(scope,element,attr){ - - - scope.$watch('automated', function(val) { if(val=="Yes") { - console.log("yo"); - $(element).dialog({ title: 'Automated A/B Testing', width: 800, @@ -194,65 +151,33 @@ closed: false, cache: false, modal: true - }); - - - - - } - }); $(element).find("#closebutton").on("click",function(){ - console.log("you can do it"); $(element).dialog("close"); - }); - - - - - } - }; - - - }); crmMailingAB.directive('numbar',function(){ return{ - restrict: 'AE', - link: function(scope,element, attrs){ - $(element).spinner({max:attrs.numbar,min:0}); - - - } - }; - }); crmMailingAB.directive('datepick',function(){ - return { scope :{ foo : '=send_date' }, - - restrict: 'AE', - - - link: function(scope,element,attrs){ - + link: function(scope,element,attrs){ $(element).datepicker({ onSelect: function(date) { $(".ui-datepicker a").removeAttr("href"); @@ -262,20 +187,5 @@ }); } }; - - }); - - - - - - - - - - - - - })(angular, CRM.$, CRM._); \ No newline at end of file diff --git a/partials/abtesting/helloworld.html b/partials/abtesting/helloworld.html index d9eed593ce..f7c08a4e09 100644 --- a/partials/abtesting/helloworld.html +++ b/partials/abtesting/helloworld.html @@ -1,17 +1,5 @@ - - -
- - - -
- -

What would you like to test ?



-   Subject Lines

  From Names

  Two different Emails

@@ -38,32 +24,21 @@
-
- - - -
-
-

Select the groups you would like to add


- -  

You name is required.

Select the size of your test group


-   Percentage Selected - {{slide_value}}%
@@ -73,8 +48,6 @@   Total Unique Clicks

  Total Clicks on a particular link

- -

Do you want the A/B test to be automated

 Yes     No

@@ -102,7 +75,6 @@

-
@@ -110,45 +82,39 @@

Details


- - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + +
Test Criteria {{template.name}}
Groups Selected {{groups_selected}}
Size of Test Group {{slide_value}}
Winner Criteria{{winner_criteria}}
Automated{{automated}}
Minum Confidence Level{{conf}}%
If Level not Achieved{{ifnot}}
Declare Winner in{{days}} Days {{hours}} Hours {{minutes}} Minutes
Winner Criteria{{winner_criteria}}
Automated{{automated}}
Minum Confidence Level{{conf}}%
If Level not Achieved{{ifnot}}
Declare Winner in{{days}} Days {{hours}} Hours {{minutes}} Minutes

Preview Mailing


@@ -160,16 +126,9 @@    
- -


- -
- - - \ No newline at end of file -- 2.25.1