From cc3a8925d79fafd1c09f86da41312ab5c1602a0a Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Tue, 30 Sep 2014 15:30:27 +0100 Subject: [PATCH] crmMailingAB.js - Consolidate 4 TAB_clicked() functions into one gotoTab() --- js/angular-crmMailingAB.js | 28 ++++++++-------------------- partials/abtesting/main.html | 8 ++++---- 2 files changed, 12 insertions(+), 24 deletions(-) diff --git a/js/angular-crmMailingAB.js b/js/angular-crmMailingAB.js index ef07cc72aa..de685ebd03 100755 --- a/js/angular-crmMailingAB.js +++ b/js/angular-crmMailingAB.js @@ -165,27 +165,15 @@ $scope.tab_val = 0; $scope.max_tab = ($scope.sparestuff.isnew == true) ? 0 : 4; - $scope.campaign_clicked = function () { - if ($scope.max_tab >= 0) { - $scope.tab_val = 0; - } - }; - - $scope.compose_clicked = function () { - if ($scope.max_tab >= 1) { - $scope.tab_val = 1; - } - }; - $scope.rec_clicked = function () { - if ($scope.max_tab >= 2) { - $scope.tab_val = 2; - } - }; - $scope.preview_clicked = function () { - if ($scope.max_tab >= 3) { - $scope.tab_val = 3; + /** + * Example: gotoTab('campaign') + */ + $scope.gotoTab = function(name) { + var TABS = {campaign: 0, compose: 1, rec: 2, preview: 3}; // FIXME + if ($scope.max_tab >= TABS[name]) { + $scope.tab_val = TABS[name]; } - }; + } $scope.preview = false; $scope.slide_value = 0; diff --git a/partials/abtesting/main.html b/partials/abtesting/main.html index e45da6a38f..7259da1f60 100755 --- a/partials/abtesting/main.html +++ b/partials/abtesting/main.html @@ -1,9 +1,9 @@
-- 2.25.1