fix url tab bug with configure tabs
This commit is contained in:
parent
522dd85f89
commit
eaea95078c
|
@ -64,12 +64,19 @@ angular.module('forms').controller('AdminFormController', ['$rootScope', '$windo
|
|||
];
|
||||
|
||||
$scope.go = function(tab){
|
||||
$state.go(tab.route);
|
||||
var currParentState = $state.current.name.split('.').slice(0,2).join('.');
|
||||
var tabParentState = tab.route.split('.').slice(0,2).join('.');
|
||||
|
||||
if(currParentState !== tabParentState && tabParentState !== 'viewForm.configure.general'){
|
||||
$state.go(tab.route);
|
||||
}
|
||||
};
|
||||
|
||||
function setActiveTab() {
|
||||
$scope.tabData.forEach(function(tab) {
|
||||
tab.active = ($state.current.name === tab.route);
|
||||
var currentTabState = $state.current.name.split('.').slice(0,2).join('.');
|
||||
var tabRouteState = tab.route.split('.').slice(0,2).join('.');
|
||||
tab.active = (currentTabState === tabRouteState);
|
||||
|
||||
if(tab.active && tab.route === 'viewForm.design'){
|
||||
$scope.designTabActive = true;
|
||||
|
|
|
@ -6,6 +6,15 @@ angular.module('forms').run(['Menus',
|
|||
// Set top bar menu items
|
||||
Menus.addMenuItem('topbar', 'My Forms', 'forms', '', '/forms', false);
|
||||
}
|
||||
]).run(['$rootScope', '$state',
|
||||
function($rootScope, $state) {
|
||||
$rootScope.$on('$stateChangeStart', function(evt, to, params) {
|
||||
if (to.redirectTo) {
|
||||
evt.preventDefault();
|
||||
$state.go(to.redirectTo, params)
|
||||
}
|
||||
});
|
||||
}
|
||||
]).filter('secondsToDateTime', [function() {
|
||||
return function(seconds) {
|
||||
return new Date(1970, 0, 1).setSeconds(seconds);
|
||||
|
|
Loading…
Reference in a new issue