Re-introduce menu on the result page

This commit is contained in:
Gaël Métais
2014-12-21 11:42:09 +01:00
parent 3dc4f4641c
commit ed4f448370
7 changed files with 50 additions and 5 deletions
+2 -1
View File
@@ -6,7 +6,8 @@ var yltApp = angular.module('YellowLabTools', [
'queueCtrl',
'runsFactory',
'resultsFactory',
'gradeDirective'
'menuService',
'gradeDirective',
]);
yltApp.config(['$routeProvider', '$locationProvider',
+4 -3
View File
@@ -1,8 +1,9 @@
var dashboardCtrl = angular.module('dashboardCtrl', ['resultsFactory']);
var dashboardCtrl = angular.module('dashboardCtrl', ['resultsFactory', 'menuService']);
dashboardCtrl.controller('DashboardCtrl', ['$scope', '$routeParams', 'Results', function($scope, $routeParams, Results) {
$scope.dashboard = "this is a dashboard";
dashboardCtrl.controller('DashboardCtrl', ['$scope', '$routeParams', 'Results', 'Menu', function($scope, $routeParams, Results, Menu) {
$scope.runId = $routeParams.runId;
$scope.Menu = Menu.setCurrentPage('dashboard', $scope.runId);
Results.get({runId: $routeParams.runId}, function(result) {
$scope.result = result;
console.log(result);
+34
View File
@@ -0,0 +1,34 @@
var menuService = angular.module('menuService', []);
menuService.factory('Menu', ['$location', function($location) {
var currentPage, currentRunId;
return {
getCurrentPage: function() {
return currentPage;
},
setCurrentPage: function(page, runId) {
currentPage = page;
currentRunId = runId;
return this;
},
changePage: function(page) {
switch (page) {
case 'index':
$location.path('/');
break;
case 'dashboard':
$location.path('/result/' + currentRunId);
break;
case 'timeline':
$location.path('/result/' + currentRunId + '/timeline');
break;
default:
console.err('Undefined Menu.changePage() destination');
}
}
}
}]);