[admin] Add page title

This commit is contained in:
nemunaire 2016-12-26 01:20:06 +01:00
parent 13c6d44953
commit 288e6a1c7f
4 changed files with 22 additions and 8 deletions

View File

@ -111,12 +111,15 @@ angular.module("FICApp")
$location.url("/themes/" + id); $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.theme = Theme.get({ themeId: $routeParams.themeId });
$scope.fields = ["name"]; $scope.fields = ["name", "authors"];
$scope.saveTheme = function() { $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> <p><input type="search" class="form-control" placeholder="Search" ng-model="query"></p>
<table class="table table-hover table-bordered"> <table class="table table-hover table-bordered">
<thead> <thead>

View File

@ -1,3 +1,5 @@
<h2>Thèmes</h2>
<p><input type="search" class="form-control" placeholder="Search" ng-model="query"></p> <p><input type="search" class="form-control" placeholder="Search" ng-model="query"></p>
<table class="table table-hover table-bordered"> <table class="table table-hover table-bordered">
<thead> <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"> <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]"> <input type="text" class="form-control" id="{{ field }}" ng-model="theme[field]">
</div> </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> </form>
<h3>Exercices</h3>
<div ng-controller="ExercicesListController"> <div ng-controller="ExercicesListController">
<p><input type="search" class="form-control" placeholder="Search" ng-model="query"></p> <p><input type="search" class="form-control" placeholder="Search" ng-model="query"></p>
<table class="table table-hover table-bordered"> <table class="table table-hover table-bordered">
@ -17,9 +24,9 @@
</tr> </tr>
</thead> </thead>
<tbody> <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"> <td ng-repeat="field in fields">
{{ team[field] }} {{ exercice[field] }}
</td> </td>
</tr> </tr>
</tbody> </tbody>