Update sidebar and navbar buttons

This commit is contained in:
Reynaldo Reyes
2016-06-07 22:46:40 -04:00
parent a904766db6
commit 68edae2ed0
3 changed files with 15 additions and 5 deletions

View File

@@ -5,8 +5,8 @@
.module('app') .module('app')
.controller('NavbarCtrl', NavbarCtrl) .controller('NavbarCtrl', NavbarCtrl)
NavbarCtrl.$inject = ['$scope', 'authentication', '$state', 'professors']; NavbarCtrl.$inject = ['$scope', 'authentication', '$state', 'professors', 'data'];
function NavbarCtrl($scope, authentication, $state, professors) { function NavbarCtrl($scope, authentication, $state, professors, data) {
var vm = this; var vm = this;
var user = authentication.currentUser(); var user = authentication.currentUser();
var professorid = user._id; var professorid = user._id;
@@ -19,11 +19,14 @@
console.log("Error al obtener los datos."); console.log("Error al obtener los datos.");
}); });
vm.profile = function (){
data.professorId = professorid;
$state.go('ProfessorUpdate');
};
vm.logout = function () { vm.logout = function () {
authentication.logout(); authentication.logout();
$state.go('login'); $state.go('login');
}; };
}; };
})(); })();

View File

@@ -16,6 +16,13 @@
<div class="container-fluid"> <div class="container-fluid">
<br> <br>
<span>Bienvenido(a)! Profesor(a) {{vm.professor.lastname}}</span> <span>Bienvenido(a)! Profesor(a) {{vm.professor.lastname}}</span>
<button class="btn-primary btn"
style=" margin: 10px"
ng-click= "vm.profile()">
<span class="glyphicon glyphicon-user"
aria-hidden="true"></span>
Mi Perfil
</button>
<button class="btn-danger btn" <button class="btn-danger btn"
style=" margin: 10px" style=" margin: 10px"
ng-click= "vm.logout()"> ng-click= "vm.logout()">

View File

@@ -37,7 +37,7 @@
{ {
state: 'ProfessorCreate', state: 'ProfessorCreate',
text: 'Nuevo Profesor' text: 'Nuevo Profesor'
} }
] ]
} }
]; ];