frontend: display tags and add new page to filter exercices by tag
This commit is contained in:
parent
9e2c0b2610
commit
ea56219fa1
6 changed files with 48 additions and 0 deletions
|
@ -21,6 +21,10 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
controller: "VideosController",
|
||||
templateUrl: "views/videos.html"
|
||||
})
|
||||
.when("/tags/:tag", {
|
||||
controller: "TagController",
|
||||
templateUrl: "views/tag.html"
|
||||
})
|
||||
.when("/:theme", {
|
||||
controller: "ExerciceController",
|
||||
templateUrl: "views/theme.html"
|
||||
|
@ -466,6 +470,25 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
$location.url("/");
|
||||
}
|
||||
})
|
||||
.controller("TagController", function($scope, $rootScope, $routeParams) {
|
||||
$rootScope.current_theme = 0;
|
||||
$rootScope.current_exercice = 0;
|
||||
$rootScope.title = "Challenges " + $routeParams.tag;
|
||||
$rootScope.authors = "";
|
||||
|
||||
$scope.tag = $routeParams.tag;
|
||||
$scope.exercices = [];
|
||||
|
||||
$scope.$watch("themes", function(themes) {
|
||||
$scope.exercices = [];
|
||||
angular.forEach(themes, function(theme, tid) {
|
||||
angular.forEach(theme.exercices, function(exercice, eid) {
|
||||
if (exercice.tags.indexOf($scope.tag) >= 0)
|
||||
$scope.exercices.push({"exercice": exercice, "theme": theme, "eid": eid, "tid": tid});
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
.controller("RankController", function($scope, $rootScope) {
|
||||
$rootScope.current_theme = 0;
|
||||
$rootScope.current_exercice = 0;
|
||||
|
|
Reference in a new issue