[admin] Add page title

This commit is contained in:
nemunaire 2016-12-26 01:20:06 +01:00 committed by Pierre-Olivier Mercier
parent 27ca960b2a
commit 6a4868b9b3
4 changed files with 22 additions and 8 deletions

View File

@ -111,12 +111,15 @@ angular.module("FICApp")
$location.url("/themes/" + id);
};
})
.controller("ThemeController", function($scope, Theme, $routeParams) {
.controller("ThemeController", function($scope, Theme, $routeParams, $location) {
$scope.theme = Theme.get({ themeId: $routeParams.themeId });
$scope.fields = ["name"];
$scope.fields = ["name", "authors"];
$scope.saveTheme = function() {
this.theme.$save({themeId: this.theme.themeId});
this.theme.$update();
}
$scope.deleteTheme = function() {
this.theme.$remove(function() { $location.url("/themes/");});
}
})

View File

@ -1,3 +1,5 @@
<h2>&Eacute;quipes</h2>
<p><input type="search" class="form-control" placeholder="Search" ng-model="query"></p>
<table class="table table-hover table-bordered">
<thead>

View File

@ -1,3 +1,5 @@
<h2>Thèmes</h2>
<p><input type="search" class="form-control" placeholder="Search" ng-model="query"></p>
<table class="table table-hover table-bordered">
<thead>

View File

@ -1,11 +1,18 @@
<form class="form" ng-submit="ssubmit()">
<h2>{{theme.name}} <small>{{theme.authors}}</small></h2>
<form class="form" ng-submit="saveTheme()" class="form-horizontal">
<div class="form-group" ng-repeat="field in fields">
<label for="{{ field }}">{{ field }}</label>
<label for="{{ field }}">{{ field | capitalize }}</label>
<input type="text" class="form-control" id="{{ field }}" ng-model="theme[field]">
</div>
<button class="btn btn-primary" ng-click="saveTheme()">Save</button>
<div class="text-right">
<button type="submit" class="btn btn-primary"><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>
</div>
</form>
<h3>Exercices</h3>
<div ng-controller="ExercicesListController">
<p><input type="search" class="form-control" placeholder="Search" ng-model="query"></p>
<table class="table table-hover table-bordered">
@ -17,9 +24,9 @@
</tr>
</thead>
<tbody>
<tr ng-repeat="team in teams | filter: query" ng-click="show(team.id)">
<tr ng-repeat="exercice in exercices | filter: query" ng-click="show(exercice.id)">
<td ng-repeat="field in fields">
{{ team[field] }}
{{ exercice[field] }}
</td>
</tr>
</tbody>