dashboard: use last path item to handle TP number selection

This commit is contained in:
nemunaire 2020-02-28 13:23:11 +01:00
parent 6086b82181
commit 8d55ecc3af
3 changed files with 39 additions and 14 deletions

View file

@ -38,7 +38,13 @@ angular.module("AdLinApp", ["ngResource", "ngSanitize"])
angular.module("AdLinApp")
.run(function($rootScope, $location) {
$rootScope.tutoid = 0;
if (window.location.pathname.split("/").length >= 3) {
$rootScope.tutoid = parseInt(window.location.pathname.split("/")[2], 10);
}
if (!$rootScope.tutoid || isNaN($rootScope.tutoid)) {
$rootScope.tutoid = 1;
}
$rootScope.tutoid--;
})
.controller("StudentsController", function($scope, $interval, Student) {
$scope.students = Student.query();