From b10d4274daabb51b7116b5b2a096400825b08709 Mon Sep 17 00:00:00 2001 From: aditya-nambiar Date: Mon, 16 Jun 2014 16:47:12 -0400 Subject: [PATCH] Groups API used --- js/angular-crmMailingAB.js | 18 ++++++++++++------ partials/abtesting/helloworld.html | 17 ++++++++--------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/js/angular-crmMailingAB.js b/js/angular-crmMailingAB.js index 609f3100c9..332d5a4149 100644 --- a/js/angular-crmMailingAB.js +++ b/js/angular-crmMailingAB.js @@ -31,25 +31,29 @@ templateUrl: partialUrl('helloworld.html'), controller: 'TabsDemoCtrl', resolve: { + metaData: function($route, crmApi) { + return crmApi('Group', 'get', {}); + }, mailingList: function($route, crmApi) { return crmApi('Mailing', 'get', {}); - }, - allgroups: function($route,crmApi){ - return crmApi('Group','get',{}); } } }); + + } ]); //----------------------------------------- // Add a new record by name. // Ex: - crmMailingAB.controller('TabsDemoCtrl', function($scope, crmApi, mailingList) { + crmMailingAB.controller('TabsDemoCtrl', function($scope, crmApi, metaData, mailingList) { + $scope.groups = metaData.values; + $scope.mailings = mailingList.values; $scope.adi=0; $scope.campaign_clicked= function(){ if($scope.adi >= 0 ){ @@ -133,9 +137,11 @@ link: function(scope,element, attrs){ - $(document).ready(function() { $(element).select2({width:"400px",placeholder: "Select the groups you wish to include"}); + $(element).select2({width:"400px",placeholder: "Select the groups you wish to include"}); + $(element).select2("data",groups) + + - }); } }; diff --git a/partials/abtesting/helloworld.html b/partials/abtesting/helloworld.html index 3da00ae097..d9eed593ce 100644 --- a/partials/abtesting/helloworld.html +++ b/partials/abtesting/helloworld.html @@ -5,9 +5,11 @@ + -
    @@ -54,12 +56,9 @@

    Select the groups you would like to add


    -   + +

    You name is required.

    @@ -119,7 +118,7 @@ Groups Selected - + {{groups_selected}} Size of Test Group -- 2.25.1