admin: improve usability of theme edition page
This commit is contained in:
parent
1e2a74f3ca
commit
971273a185
2 changed files with 37 additions and 39 deletions
|
@ -959,7 +959,7 @@ angular.module("FICApp")
|
||||||
|
|
||||||
.controller("AllExercicesListController", function($scope, Exercice, $routeParams, $location, $rootScope, $http) {
|
.controller("AllExercicesListController", function($scope, Exercice, $routeParams, $location, $rootScope, $http) {
|
||||||
$scope.exercices = Exercice.query();
|
$scope.exercices = Exercice.query();
|
||||||
$scope.fields = ["title", "statement", "overview", "videoURI"];
|
$scope.fields = ["title", "overview"];
|
||||||
|
|
||||||
$scope.show = function(id) {
|
$scope.show = function(id) {
|
||||||
$location.url("/exercices/" + id);
|
$location.url("/exercices/" + id);
|
||||||
|
|
|
@ -1,46 +1,44 @@
|
||||||
<h2>{{theme.name}} <small>{{theme.authors}}</small></h2>
|
<h2>{{theme.name}} <small>{{theme.authors}}</small></h2>
|
||||||
|
|
||||||
<form ng-submit="saveTheme()">
|
<div class="row">
|
||||||
<div class="form-group row" ng-repeat="field in fields">
|
<form ng-submit="saveTheme()" class="col-4">
|
||||||
<label for="{{ field }}" class="col-sm-1 col-form-label-sm">{{ field | capitalize }}</label>
|
<div class="form-group" ng-repeat="field in fields">
|
||||||
<div class="col-sm-11">
|
<label for="{{ field }}">{{ field | capitalize }}</label>
|
||||||
<input type="text" class="form-control form-control-sm" id="{{ field }}" ng-model="theme[field]" ng-if="field != 'intro'">
|
<input type="text" class="form-control form-control-sm" id="{{ field }}" ng-model="theme[field]" ng-if="field != 'intro'">
|
||||||
<textarea class="form-control form-control-sm" id="{{ field }}" ng-model="theme[field]" ng-if="field == 'intro'"></textarea>
|
<textarea class="form-control form-control-sm" id="{{ field }}" ng-model="theme[field]" ng-if="field == 'intro'"></textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="text-right" ng-show="theme.id">
|
||||||
<div class="text-right" ng-show="theme.id">
|
<button type="submit" class="btn btn-success"><span class="glyphicon glyphicon-save" aria-hidden="true"></span> Save</button>
|
||||||
<button type="submit" class="btn btn-success"><span class="glyphicon glyphicon-save" aria-hidden="true"></span> Save</button>
|
<button class="btn btn-danger" ng-click="deleteTheme()"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Delete</button>
|
||||||
<button class="btn btn-danger" ng-click="deleteTheme()"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Delete</button>
|
</div>
|
||||||
</div>
|
<div class="text-right" ng-show="!theme.id">
|
||||||
<div class="text-right" ng-show="!theme.id">
|
<button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Create theme</button>
|
||||||
<button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Create theme</button>
|
</div>
|
||||||
</div>
|
</form>
|
||||||
</form>
|
|
||||||
|
|
||||||
<hr>
|
<div ng-show="theme.id" class="col-md-8" ng-controller="ExercicesListController">
|
||||||
|
<h3>
|
||||||
|
Exercices ({{ exercices.length }})
|
||||||
|
<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 exercice</button>
|
||||||
|
<button ng-click="syncExo()" ng-class="{'disabled': inSync}" class="float-right btn btn-sm btn-light ml-2"><span class="glyphicon glyphicon-refresh" aria-hidden="true"></span> Synchroniser</button>
|
||||||
|
</h3>
|
||||||
|
|
||||||
<div ng-show="theme.id" ng-controller="ExercicesListController">
|
<p><input type="search" class="form-control" placeholder="Search" ng-model="query" autofocus></p>
|
||||||
<h3>
|
<table class="table table-hover table-bordered table-striped table-sm">
|
||||||
Exercices ({{ exercices.length }})
|
<thead class="thead-dark">
|
||||||
<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 exercice</button>
|
<tr>
|
||||||
<button ng-click="syncExo()" ng-class="{'disabled': inSync}" class="float-right btn btn-sm btn-light ml-2"><span class="glyphicon glyphicon-refresh" aria-hidden="true"></span> Synchroniser</button>
|
<th ng-repeat="field in fields">
|
||||||
</h3>
|
{{ field }}
|
||||||
|
</th>
|
||||||
<p><input type="search" class="form-control" placeholder="Search" ng-model="query" autofocus></p>
|
</tr>
|
||||||
<table class="table table-hover table-bordered table-striped table-sm">
|
</thead>
|
||||||
<thead class="thead-dark">
|
<tbody>
|
||||||
<tr>
|
<tr ng-repeat="exercice in exercices | filter: query" ng-click="show(exercice.id)">
|
||||||
<th ng-repeat="field in fields">
|
<td ng-repeat="field in fields">
|
||||||
{{ field }}
|
{{ exercice[field] }}
|
||||||
</th>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</tbody>
|
||||||
<tbody>
|
</table>
|
||||||
<tr ng-repeat="exercice in exercices | filter: query" ng-click="show(exercice.id)">
|
</div>
|
||||||
<td ng-repeat="field in fields">
|
|
||||||
{{ exercice[field] }}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
Reference in a new issue