tellform/public/modules/core/controllers/header.client.controller.js

60 lines
1.6 KiB
JavaScript
Raw Normal View History

2015-06-29 22:51:29 +00:00
'use strict';
2015-06-30 20:57:20 +00:00
angular.module('core').controller('HeaderController', ['$rootScope','$scope','Menus', '$state',
function($rootScope, $scope, Menus, $state) {
// $rootScope.authentication = Auth;
// $rootScope.user = {},
2015-06-29 22:51:29 +00:00
$scope.isCollapsed = false;
$scope.hideNav = false;
$scope.menu = Menus.getMenu('topbar');
2015-06-30 19:42:02 +00:00
// Principal.identity().then(function(user){
// $rootScope.user = user;
// console.log('topbar')
// console.log($scope.user);
// },
// function(error){
// console.log(error);
// }).then(function(){
2015-06-30 20:57:20 +00:00
// $scope.signout = function() {
// $http.get('/auth/signout').success(function(response) {
// $state.go('home');
// }).error(function(error) {
// $scope.error = (error.message || error);
// });
2015-06-30 16:15:16 +00:00
2015-06-30 20:57:20 +00:00
// Principal.signout().then(
// function(result){
// $state.go('home');
// },
// function(error){
// $scope.error = (error.message || error);
// }
// );
// if( angular.isDefined(response_obj.error) ){
2015-06-30 19:42:02 +00:00
// $scope.error = response_obj.error;
// } else{
// $state.go('home');
// }
2015-06-30 16:15:16 +00:00
2015-06-30 20:57:20 +00:00
// };
2015-06-29 22:51:29 +00:00
2015-06-30 20:57:20 +00:00
$scope.toggleCollapsibleMenu = function() {
$scope.isCollapsed = !$scope.isCollapsed;
};
2015-06-29 22:51:29 +00:00
2015-06-30 20:57:20 +00:00
// Collapsing the menu after navigation
$scope.$on('$stateChangeSuccess', function(event, toState, toParams, fromState, fromParams) {
$scope.isCollapsed = false;
$scope.hideNav = false;
if ( angular.isDefined( toState.data ) ) {
2015-06-29 22:51:29 +00:00
2015-06-30 20:57:20 +00:00
if ( angular.isDefined( toState.data.hideNav ) ) {
$scope.hideNav = toState.data.hideNav;
}
}
2015-06-30 16:15:16 +00:00
});
2015-06-30 20:57:20 +00:00
// });
2015-06-29 22:51:29 +00:00
}
]);