frontend: display tags and add new page to filter exercices by tag
This commit is contained in:
parent
9e2c0b2610
commit
ea56219fa1
@ -31,4 +31,8 @@ server {
|
||||
location /rank {
|
||||
rewrite ^/.*$ /index.html;
|
||||
}
|
||||
|
||||
location /tags/ {
|
||||
rewrite ^/.*$ /index.html;
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,9 @@ server {
|
||||
location /rank {
|
||||
rewrite ^/.*$ /index.html;
|
||||
}
|
||||
location /tags/ {
|
||||
rewrite ^/.*$ /index.html;
|
||||
}
|
||||
location /register {
|
||||
rewrite ^/.*$ /index.html;
|
||||
}
|
||||
|
@ -68,6 +68,11 @@ server {
|
||||
|
||||
rewrite ^/.*$ /index.html;
|
||||
}
|
||||
location /tags/ {
|
||||
include fic-auth.conf;
|
||||
|
||||
rewrite ^/.*$ /index.html;
|
||||
}
|
||||
location /register {
|
||||
include fic-auth.conf;
|
||||
|
||||
|
@ -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;
|
||||
|
12
frontend/static/views/tag.html
Normal file
12
frontend/static/views/tag.html
Normal file
@ -0,0 +1,12 @@
|
||||
<div class="card-columns">
|
||||
<div class="card" ng-repeat="ex in exercices">
|
||||
<div class="card-body">
|
||||
<h6 class="card-title">
|
||||
<a ng-href="/{{ex.theme.urlid}}">{{ex.theme.name}}</a> >
|
||||
<a ng-href="/{{ex.theme.urlid}}/{{ex.exercice.urlid}}">{{ex.exercice.title}}</a>
|
||||
<a ng-href="/tags/{{tag}}" class="badge badge-pill badge-secondary mr-2 float-right" ng-repeat="tag in themes[ex.tid].exercices[ex.eid].tags">#{{ tag }}</a>
|
||||
</h6>
|
||||
<p style="clear: both" class="card-text text-justify">Sunt omnis est quibusdam aperiam quos minima numquam. Omnis eos corrupti corrupti quia ut.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -20,6 +20,7 @@
|
||||
</div>
|
||||
<div class="jumbotron text-indent" style="margin-top: 15px" class="well well-lg" ng-if="(my.exercices[current_exercice])">
|
||||
<h3 class="display-4">{{ themes[current_theme].exercices[current_exercice].title }}</h3>
|
||||
<a ng-href="/tags/{{tag}}" class="badge badge-pill badge-secondary mr-2 mb-2" ng-repeat="tag in themes[current_theme].exercices[current_exercice].tags" ng-bind="tag"></a>
|
||||
<p class="lead text-justify" ng-bind-html="my.exercices[current_exercice].statement"></p>
|
||||
<div class="alert alert-{{my.exercices[current_exercice].issuekind}}" ng-if="my.exercices[current_exercice].issue" ng-bind-html="my.exercices[current_exercice].issue"></div>
|
||||
<hr class="my-3">
|
||||
|
Loading…
Reference in New Issue
Block a user