frontend: update the page title when navigate

This commit is contained in:
nemunaire 2019-01-21 00:35:07 +01:00
parent 56faf7b8db
commit 525b3d6b56
2 changed files with 14 additions and 1 deletions

View File

@ -2,7 +2,7 @@
<html lang="fr" ng-app="FICApp"> <html lang="fr" ng-app="FICApp">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Challenge Forensic</title> <title ng-bind="'Challenge Forensic' + ($root.title?' - '+$root.title:'')">Challenge Forensic</title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico"> <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico">

View File

@ -414,8 +414,21 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
if (exercicesUrl != undefined) if (exercicesUrl != undefined)
$rootScope.current_exercice = exercicesUrl[$routeParams.theme + "/" + $routeParams.exercice]; $rootScope.current_exercice = exercicesUrl[$routeParams.theme + "/" + $routeParams.exercice];
}) })
$scope.$watchGroup(["themes", "current_theme", "current_exercice"], function(newValues) {
var themes = newValues[0];
var current_theme = newValues[1];
var current_exercice = newValues[2];
if (themes != undefined && themes[current_theme] != undefined && themes[current_theme].exercices != undefined && themes[current_theme].exercices[current_exercice] != undefined)
$rootScope.title = themes[current_theme].name + " > " + themes[current_theme].exercices[current_exercice].title;
});
} else { } else {
$rootScope.current_exercice = 0; $rootScope.current_exercice = 0;
$scope.$watchGroup(["themes", "current_theme"], function(newValues) {
var themes = newValues[0];
var current_theme = newValues[1];
if (themes != undefined && themes[current_theme] != undefined)
$rootScope.title = themes[current_theme].name;
});
} }
var cbh; var cbh;