admin: add related theme in exercice list page

This commit is contained in:
nemunaire 2018-12-08 21:17:37 +01:00
parent 78b6211b94
commit 81ce648b5d
2 changed files with 14 additions and 1 deletions

View file

@ -946,7 +946,14 @@ angular.module("FICApp")
} }
}) })
.controller("AllExercicesListController", function($scope, Exercice, $routeParams, $location, $rootScope, $http, $filter) { .controller("AllExercicesListController", function($scope, Exercice, Theme, $routeParams, $location, $rootScope, $http, $filter) {
$http({
url: "/api/themes.json",
method: "GET"
}).then(function(response) {
$scope.themes = response.data
});
$scope.exercices = Exercice.query(); $scope.exercices = Exercice.query();
$scope.exercice = {}; // Array used to save fields to updates in selected exercices $scope.exercice = {}; // Array used to save fields to updates in selected exercices
$scope.fields = ["title", "overview"]; $scope.fields = ["title", "overview"];

View file

@ -30,6 +30,9 @@
<th ng-repeat="field in fields"> <th ng-repeat="field in fields">
{{ field }} {{ field }}
</th> </th>
<th>
Thème
</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -40,6 +43,9 @@
<td ng-repeat="field in fields" ng-click="show(exercice.id)"> <td ng-repeat="field in fields" ng-click="show(exercice.id)">
{{ exercice[field] }} {{ exercice[field] }}
</td> </td>
<td>
<a ng-href="themes/{{ exercice.id_theme }}">{{ themes[exercice.id_theme].name }}</a>
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>