got static url for configure tabs to work

This commit is contained in:
David Baldwynn 2017-10-31 12:32:23 -07:00
parent 12e1fd0947
commit aa8efe8508
4 changed files with 25 additions and 20 deletions

View file

@ -68,7 +68,6 @@ angular.module('forms').controller('AdminFormController', ['$rootScope', '$windo
};
function setActiveTab() {
var start = new Date().getTime();
$scope.tabData.forEach(function(tab) {
tab.active = ($state.current.name === tab.route);
@ -78,19 +77,11 @@ angular.module('forms').controller('AdminFormController', ['$rootScope', '$windo
$scope.designTabActive = false;
}
});
var end = new Date().getTime();
var time = end - start;
console.log('Execution time: ' + time);
}
setActiveTab();
$scope.$on("$stateChangeSuccess", function() {
setActiveTab();
});
$scope.$on("$stateChangeSuccess", setActiveTab());
$scope.deactivateDesignTab = function(){
$scope.designTabActive = false

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('forms').directive('configureFormDirective', ['$rootScope', '$filter',
function ($rootScope, $filter) {
angular.module('forms').directive('configureFormDirective', ['$rootScope', '$filter', '$state',
function ($rootScope, $filter, $state) {
return {
templateUrl: 'modules/forms/admin/views/directiveViews/form/configure-form.client.view.html',
restrict: 'E',
@ -16,21 +16,35 @@ angular.module('forms').directive('configureFormDirective', ['$rootScope', '$fil
$scope.configureTabs = [
{
heading: $filter('translate')('GENERAL_TAB'),
route: 'viewForm.configure.general'
route: 'viewForm.configure.general',
active: false
},
{
heading: $filter('translate')('SELF_NOTIFICATIONS_TAB'),
route: 'viewForm.configure.self_notifications'
route: 'viewForm.configure.self_notifications',
active: false
},
{
heading: $filter('translate')('RESPONDENT_NOTIFICATIONS_TAB'),
route: 'viewForm.configure.respondent_notifications'
route: 'viewForm.configure.respondent_notifications',
active: false
}
];
$scope.go = function(route){
$state.go(route);
$scope.go = function(tab){
tab.active = true;
$state.go(tab.route);
};
function setActiveTab() {
$scope.configureTabs.forEach(function(tab) {
tab.active = ($state.current.name === tab.route);
});
}
setActiveTab();
$scope.$on("$stateChangeSuccess", setActiveTab());
}
};
}

View file

@ -2,7 +2,7 @@
<div class="row">
<uib-tabset active="activePill" type="pills">
<uib-tab ng-repeat="tab in configureTabs" index="$index" heading="{{tab.heading}}" select="go(tab.route)">
<uib-tab ng-repeat="tab in configureTabs" active="tab.active" select="go(tab)" heading="{{tab.heading}}">
<div ui-view></div>
</uib-tab>
</uib-tabset>

View file

@ -75,10 +75,10 @@ angular.module('forms').config(['$stateProvider',
templateUrl: 'modules/forms/admin/views/adminTabs/configureTabs/general.html'
}).state('viewForm.configure.self_notifications', {
url: '/self_notifications',
templateUrl: 'modules/forms/admin/views/adminTabs/configureTabs/self_notifications.html'
templateUrl: 'modules/forms/admin/views/adminTabs/configureTabs/self-notifications.html'
}).state('viewForm.configure.respondent_notifications', {
url: '/respondent_notifications',
templateUrl: 'modules/forms/admin/views/adminTabs/configureTabs/respondent_notifications.html'
templateUrl: 'modules/forms/admin/views/adminTabs/configureTabs/respondent-notifications.html'
})
.state('viewForm.design', {