frontend: add a menu items regrouping tags
This commit is contained in:
parent
c43bafa21b
commit
d0bd722c92
2 changed files with 18 additions and 0 deletions
|
|
@ -86,6 +86,14 @@
|
|||
<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">
|
||||
<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>
|
||||
</div>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/rank">Classement</a>
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -102,14 +102,24 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
.controller("DataController", function($sce, $scope, $http, $rootScope, $timeout, $location) {
|
||||
var actMenu = function() {
|
||||
if ($scope.my && $scope.themes) {
|
||||
var tags = {};
|
||||
angular.forEach($scope.themes, function(theme, key) {
|
||||
$scope.themes[key].exercice_solved = 0;
|
||||
angular.forEach(theme.exercices, function(exercice, k) {
|
||||
if ($scope.my.exercices && $scope.my.exercices[k] && $scope.my.exercices[k].solved) {
|
||||
$scope.themes[key].exercice_solved++;
|
||||
}
|
||||
angular.forEach(exercice.tags, function(tag) {
|
||||
if (!tags[tag])
|
||||
tags[tag] = {count: 1, solved: 0};
|
||||
else
|
||||
tags[tag].count += 1;
|
||||
if ($scope.my.exercices && $scope.my.exercices[k] && $scope.my.exercices[k].solved)
|
||||
tags[tag].solved += 1;
|
||||
});
|
||||
});
|
||||
});
|
||||
$scope.tags = tags;
|
||||
}
|
||||
}
|
||||
$rootScope.refresh = function(justMy) {
|
||||
|
|
|
|||
Reference in a new issue