From ed4f4483707f3ac6eefe749de9ffc36e900daaae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20M=C3=A9tais?= Date: Sun, 21 Dec 2014 11:42:09 +0100 Subject: [PATCH] Re-introduce menu on the result page --- front/src/js/app.js | 3 +- front/src/js/controllers/dashboardCtrl.js | 7 +++-- front/src/js/services/menuService.js | 34 +++++++++++++++++++++++ front/src/main.html | 1 + front/src/views/dashboard.html | 1 + front/src/views/resultSubHeader.html | 7 +++++ server_config/settings.json | 2 +- 7 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 front/src/js/services/menuService.js create mode 100644 front/src/views/resultSubHeader.html diff --git a/front/src/js/app.js b/front/src/js/app.js index 47c3210..0c48a13 100644 --- a/front/src/js/app.js +++ b/front/src/js/app.js @@ -6,7 +6,8 @@ var yltApp = angular.module('YellowLabTools', [ 'queueCtrl', 'runsFactory', 'resultsFactory', - 'gradeDirective' + 'menuService', + 'gradeDirective', ]); yltApp.config(['$routeProvider', '$locationProvider', diff --git a/front/src/js/controllers/dashboardCtrl.js b/front/src/js/controllers/dashboardCtrl.js index fcc5d95..2d8e22b 100644 --- a/front/src/js/controllers/dashboardCtrl.js +++ b/front/src/js/controllers/dashboardCtrl.js @@ -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); diff --git a/front/src/js/services/menuService.js b/front/src/js/services/menuService.js new file mode 100644 index 0000000..c6ec6f4 --- /dev/null +++ b/front/src/js/services/menuService.js @@ -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'); + } + } + } + +}]); \ No newline at end of file diff --git a/front/src/main.html b/front/src/main.html index 1d55d31..f062e71 100644 --- a/front/src/main.html +++ b/front/src/main.html @@ -20,6 +20,7 @@ + diff --git a/front/src/views/dashboard.html b/front/src/views/dashboard.html index d43ee3d..ee492c7 100644 --- a/front/src/views/dashboard.html +++ b/front/src/views/dashboard.html @@ -1,3 +1,4 @@ +

Grades

diff --git a/front/src/views/resultSubHeader.html b/front/src/views/resultSubHeader.html new file mode 100644 index 0000000..e583b36 --- /dev/null +++ b/front/src/views/resultSubHeader.html @@ -0,0 +1,7 @@ +
Tested url:   {{result.params.url}}
+ +
+
New test
+ + +
\ No newline at end of file diff --git a/server_config/settings.json b/server_config/settings.json index 5c69980..e03ad0f 100644 --- a/server_config/settings.json +++ b/server_config/settings.json @@ -6,5 +6,5 @@ "1234567890": "contact@gaelmetais.com" }, "maxAnonymousRunsPerDay": 50, - "maxAnonymousCallsPerDay": 1000 + "maxAnonymousCallsPerDay": 2000 } \ No newline at end of file