admin: New page to list forge link per theme and exercice

This commit is contained in:
nemunaire 2025-03-31 15:42:07 +02:00
commit 7d775fe26d
5 changed files with 98 additions and 0 deletions

View file

@ -49,6 +49,10 @@ angular.module("FICApp", ["ngRoute", "ngResource", "ngSanitize"])
controller: "ExerciceController",
templateUrl: "views/exercice-resolution.html"
})
.when("/forge-links", {
controller: "ForgeLinksController",
templateUrl: "views/exercices-forgelink.html"
})
.when("/tags", {
controller: "TagsListController",
templateUrl: "views/tags.html"
@ -2189,6 +2193,16 @@ angular.module("FICApp")
};
})
.controller("ForgeLinksController", function ($scope, $http) {
$http({
url: "api/exercices_forge_bindings.json",
}).then(function (response) {
$scope.forge_links = response.data;
}, function (response) {
$scope.addToast('danger', 'An error occurs when generating exercice forge links: ', response.data.errmsg);
});
})
.controller("ExerciceTagsController", function ($scope, ExerciceTags, $routeParams, $rootScope) {
$scope.tags = ExerciceTags.query({ exerciceId: $routeParams.exerciceId });

View file

@ -0,0 +1,14 @@
<h1>Accès rapide aux exercices</h1>
<div ng-repeat="theme in forge_links">
<h2>
<a ng-href="{{ theme.forge_link }}" target="_blank">
{{ theme.name }}
</a>&nbsp;: {{ theme.path }}
</h2>
<ul>
<li ng-repeat="exercice in theme.exercices">
<a ng-href="{{ exercice.forge_link }}" target="_blank">{{ exercice.name }}</a>&nbsp;: <span class="text-monospace">{{ exercice.path }}</span>
</li>
</ul>
</div>

View file

@ -2,6 +2,7 @@
Thèmes
<button type="button" ng-click="show('new')" class="float-right btn btn-sm btn-primary ml-2"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Ajouter un thème</button>
<button type="button" ng-click="sync()" ng-class="{'disabled': inSync}" class="float-right btn btn-sm btn-secondary ml-2"><span class="glyphicon glyphicon-refresh" aria-hidden="true"></span> Synchroniser</button>
<a href="forge-links" class="float-right btn btn-sm btn-dark ml-2"><span class="glyphicon glyphicon-folder-open" aria-hidden="true"></span> Liens d'accès à la forge</a>
</h2>
<p><input type="search" class="form-control" placeholder="Search" ng-model="query" ng-keypress="validateSearch($event)" autofocus></p>