frontend: add active class on tag menu

This commit is contained in:
nemunaire 2018-11-25 05:48:44 +01:00
parent c11f2403d2
commit 521507b8e3
2 changed files with 11 additions and 2 deletions

View file

@ -86,12 +86,12 @@
<a ng-repeat="(k,theme) in themes" ng-class="{active: k == current_theme}" class="dropdown-item" ng-href="/{{ theme.urlid }}">{{ theme.name }} <span class="badge badge-light"><span class="glyphicon glyphicon-fire" aria-hidden="true" ng-if="max_solved > 1 && theme.solved == max_solved" alt="Déjà {{ theme.solved }} challenges résolus dans ce thème"></span> <span class="glyphicon glyphicon-gift" aria-hidden="true" ng-if="theme.exercice_coeff_max > 1" alt="Des bonus existent pour au moins un challenge de ce thème"></span> <span ng-if="(my.team_id)">{{ theme.exercice_solved }}/</span>{{ theme.exercice_count }}</span></a>
</div>
</li>
<li class="nav-item dropdown">
<li class="nav-item dropdown" ng-class="{active: current_tag}">
<a class="nav-link dropdown-toogle" href="#" id="tagsMenu" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Tags
</a>
<div class="dropdown-menu">
<a ng-repeat="(tname,tag) in tags" class="dropdown-item" ng-href="/tags/{{ tname }}">#{{ tname }} <span class="badge badge-light"><span ng-if="(my.team_id)">{{ tag.solved }}/</span>{{ tag.count }}</span></a>
<a ng-repeat="(tname,tag) in tags" ng-class="{active: tname == current_tag}" class="dropdown-item" ng-href="/tags/{{ tname }}">#{{ tname }} <span class="badge badge-light"><span ng-if="(my.team_id)">{{ tag.solved }}/</span>{{ tag.count }}</span></a>
</div>
</li>
<li class="nav-item">

View file

@ -45,6 +45,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
.run(function($rootScope, $interval) {
$rootScope.current_theme = 0;
$rootScope.current_exercice = 0;
$rootScope.current_tag = undefined;
$rootScope.time = {};
$rootScope.recvTime = function(response) {
@ -197,6 +198,8 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
if (window.scrollY > 112)
window.scrollTo(window.scrollX, 112);
$rootScope.current_tag = undefined;
$scope.$watch("themesUrl", function(themesUrl) {
if (themesUrl != undefined)
$rootScope.current_theme = themesUrl[$routeParams.theme];
@ -338,6 +341,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
.controller("MyTeamController", function($scope, $http, $rootScope, $timeout) {
$rootScope.current_theme = 0;
$rootScope.current_exercice = 0;
$rootScope.current_tag = undefined;
if ($scope.my) {
$rootScope.title = $scope.my.name;
$rootScope.authors = $scope.my.members.map(function (cur) {
@ -399,6 +403,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
.controller("RegisterController", function($scope, $rootScope, $location, $http) {
$rootScope.current_theme = 0;
$rootScope.current_exercice = 0;
$rootScope.current_tag = undefined;
$rootScope.title = "Bienvenue au challenge forensic !";
$rootScope.authors = null;
@ -469,6 +474,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
.controller("TagController", function($scope, $rootScope, $routeParams) {
$rootScope.current_theme = 0;
$rootScope.current_exercice = 0;
$rootScope.current_tag = $routeParams.tag;
$rootScope.title = "Challenges " + $routeParams.tag;
$rootScope.authors = "";
@ -488,6 +494,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
.controller("RankController", function($scope, $rootScope) {
$rootScope.current_theme = 0;
$rootScope.current_exercice = 0;
$rootScope.current_tag = undefined;
$rootScope.title = "Classement général";
$rootScope.authors = "";
@ -506,12 +513,14 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
.controller("VideosController", function($scope, $rootScope) {
$rootScope.current_theme = 0;
$rootScope.current_exercice = 0;
$rootScope.current_tag = undefined;
$rootScope.title = "Vidéos de résolution";
$rootScope.authors = "";
})
.controller("HomeController", function($scope, $rootScope) {
$rootScope.current_theme = 0;
$rootScope.current_exercice = 0;
$rootScope.current_tag = undefined;
$rootScope.title = "Bienvenue au challenge forensic de l'ÉPITA !";
$rootScope.authors = "";
});