diff --git a/app/views/index.server.view.pug b/app/views/index.server.view.pug index 10c29935..c7213641 100644 --- a/app/views/index.server.view.pug +++ b/app/views/index.server.view.pug @@ -42,6 +42,8 @@ block content script(type='text/javascript', src='https://cdnjs.cloudflare.com/ajax/libs/angular-strap/2.3.8/angular-strap.min.js') + script(src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular-animate.js") + //Application JavaScript Files each jsFile in jsFiles script(type='text/javascript', src=jsFile) diff --git a/public/modules/core/config/core.client.routes.js b/public/modules/core/config/core.client.routes.js index 22294347..010d9648 100755 --- a/public/modules/core/config/core.client.routes.js +++ b/public/modules/core/config/core.client.routes.js @@ -19,9 +19,7 @@ angular.module(ApplicationConfiguration.applicationModuleName).run(['$rootScope' $state.previous = fromState; var statesToIgnore = ['home', 'signin', 'resendVerifyEmail', 'verify', 'signup', 'signup-success', 'forgot', 'reset-invalid', 'reset', 'reset-success']; - - console.log(fromState); - console.log(toState); + //Redirect to listForms if user is authenticated if(statesToIgnore.indexOf(toState.name) > 0){ if(Auth.isAuthenticated()){ diff --git a/public/modules/forms/admin/controllers/admin-form.client.controller.js b/public/modules/forms/admin/controllers/admin-form.client.controller.js index 82a0be1a..ec657e2c 100644 --- a/public/modules/forms/admin/controllers/admin-form.client.controller.js +++ b/public/modules/forms/admin/controllers/admin-form.client.controller.js @@ -4,19 +4,12 @@ angular.module('forms').controller('AdminFormController', ['$rootScope', '$window', '$scope', '$stateParams', '$state', 'Forms', 'CurrentForm', '$http', '$uibModal', 'myForm', '$filter', '$translate', function($rootScope, $window, $scope, $stateParams, $state, Forms, CurrentForm, $http, $uibModal, myForm, $filter, $translate) { - //Set active tab to Create - $scope.activePill = 0; - - $scope.copied = false; - $scope.onCopySuccess = function (e) { - $scope.copied = true; - }; - $scope = $rootScope; $scope.animationsEnabled = true; $scope.myform = myForm; $rootScope.saveInProgress = false; $scope.oldForm = _.cloneDeep($scope.myform); + $scope.designTabActive = false CurrentForm.setForm($scope.myform); @@ -36,7 +29,6 @@ angular.module('forms').controller('AdminFormController', ['$rootScope', '$windo $scope.actualFormURL = window.location.protocol + '//' + window.location.host + $scope.formURL; } - var refreshFrame = $scope.refreshFrame = function(){ if(document.getElementById('iframe')) { document.getElementById('iframe').contentWindow.location.reload(); @@ -46,31 +38,59 @@ angular.module('forms').controller('AdminFormController', ['$rootScope', '$windo $scope.tabData = [ { heading: $filter('translate')('CREATE_TAB'), - route: 'viewForm.create' + route: 'viewForm.create', + active: false }, { heading: $filter('translate')('CONFIGURE_TAB'), - route: 'viewForm.configure.general' + route: 'viewForm.configure.general', + active: false }, { heading: $filter('translate')('ANALYZE_TAB'), - route: 'viewForm.analyze' + route: 'viewForm.analyze', + active: false }, { heading: $filter('translate')('SHARE_TAB'), - route: 'viewForm.share' + route: 'viewForm.share', + active: false }, { heading: $filter('translate')('DESIGN_TAB'), - route: 'viewForm.design' + route: 'viewForm.design', + active: false } ]; - $scope.go = function(route){ - $state.go(route); + $scope.go = function(tab){ + $state.go(tab.route); }; - $scope.designTabActive = false + function setActiveTab() { + var start = new Date().getTime(); + $scope.tabData.forEach(function(tab) { + tab.active = ($state.current.name === tab.route); + + if(tab.active && tab.route === 'viewForm.design'){ + $scope.designTabActive = true; + } else { + $scope.designTabActive = false; + } + }); + + var end = new Date().getTime(); + var time = end - start; + console.log('Execution time: ' + time); + } + + setActiveTab(); + + $scope.$on("$stateChangeSuccess", function() { + + setActiveTab(); + + }); $scope.deactivateDesignTab = function(){ $scope.designTabActive = false diff --git a/public/modules/forms/admin/views/admin-form.client.view.html b/public/modules/forms/admin/views/admin-form.client.view.html index 15677800..ab06ba21 100644 --- a/public/modules/forms/admin/views/admin-form.client.view.html +++ b/public/modules/forms/admin/views/admin-form.client.view.html @@ -57,13 +57,14 @@