Various fixes

This commit is contained in:
Reynaldo Reyes
2016-05-20 23:00:34 -04:00
parent b220f21065
commit 48e8b73111
55 changed files with 714 additions and 690 deletions

View File

@@ -5,49 +5,68 @@
.module('app')
.controller('SidebarCtrl', SidebarCtrl)
SidebarCtrl.$inject = ['$scope'];
function SidebarCtrl($scope) {
SidebarCtrl.$inject = ['$scope', 'authentication'];
function SidebarCtrl($scope, authentication) {
var that = this;
$scope.showChilds = function(item){
item.active = !item.active;
$scope.showChilds = function(index){
$scope.items[index].active = !$scope.items[index].active;
collapseAnother(index);
};
$scope.items = [
{
text: 'Módulo de Administración',
subItems: [
{
state: 'ProfessorList',
text: 'Listado de Profesores'
},
{
state: 'ProfessorCreate',
text: 'Nuevo Profesor'
}
]
},
{
text: 'Módulo de Materias',
subItems: [
{
state: 'CourseList',
text: 'Listado de Materias'
},
{
state: 'CourseCreate',
text: 'Nueva Materia'
}
]
},
{
text: 'Módulo de Reportes',
subItems: [
{
state: 'courseReport',
text: 'Reportes por Materia'
}
]
var collapseAnother = function(index){
for(var i=0; i<$scope.items.length; i++){
if(i!=index){
$scope.items[i].active = false;
}
}
];
};
$scope.items = [];
var permission = authentication.currentUser();
if(permission.role=='admin'){
$scope.items = [
{
text: 'Módulo de Administración',
subItems: [
{
state: 'ProfessorList',
text: 'Listado de Profesores'
},
{
state: 'ProfessorCreate',
text: 'Nuevo Profesor'
}
]
}
];
}
if(permission.role=='professor'){
$scope.items = [
{
text: 'Módulo de Materias',
subItems: [
{
state: 'CourseList',
text: 'Listado de Materias'
},
{
state: 'CourseCreate',
text: 'Nueva Materia'
}
]
},
{
text: 'Módulo de Reportes',
subItems: [
{
state: 'courseReport',
text: 'Reportes por Materia'
}
]
}
];
}
};
})();