--- a/client/app/books/book.css Fri Apr 03 16:20:20 2015 +0200
+++ b/client/app/books/book.css Fri Apr 03 16:21:27 2015 +0200
@@ -48,6 +48,8 @@
.add-book input{
margin-bottom: 10px;
}
-.add-book button{
-
+
+.accordion-toggle .glyphicon{
+ font-size: 17px;
+ margin-left:5px;
}
\ No newline at end of file
--- a/client/app/books/books.html Fri Apr 03 16:20:20 2015 +0200
+++ b/client/app/books/books.html Fri Apr 03 16:21:27 2015 +0200
@@ -1,10 +1,14 @@
<p>Liste des books :</p>
-<ul class="row ">
- <li class="" ng-repeat="i in books | orderBy:'-date'">
- <div>
- <a class="visite" href="#/books/{{ i.id }}">{{ i.title }}</a>
- </div>
- </li>
-</ul>
+<accordion>
+ <accordion-group ng-repeat="i in books | orderBy:'-date'">
+ <accordion-heading>
+ {{ i.title }}
+ <a class="pull-right" ng-click="$event.stopPropagation();" href="#/slideshow/{{ i.id }}"><span class="glyphicon glyphicon-eye-open"></span></a>
+ <a class="pull-right" ng-click="$event.preventDefault(); $event.stopPropagation(); deleteItem($index)"><span class="glyphicon glyphicon-minus"></span></a>
+ <a class="pull-right" ng-click="$event.preventDefault(); $event.stopPropagation(); edit()"><span class="glyphicon glyphicon-wrench"></span></a>
+ </accordion-heading>
+ </accordion-group>
+</accordion>
+
<a class="btn btn-default" ng-click="addBook()"><span class="glyphicon glyphicon-plus"></span></a>
\ No newline at end of file
--- a/client/app/books/books_controller.js Fri Apr 03 16:20:20 2015 +0200
+++ b/client/app/books/books_controller.js Fri Apr 03 16:21:27 2015 +0200
@@ -16,6 +16,20 @@
$scope.books.push(newBook);
});
};
+ $scope.deleteItem = function(i){
+ if(0<=i && i<$scope.books.length){
+ if(window.confirm('Êtes-vous sûr(e) de vouloir effacer cet élément ? Cette action est irrémédiable.')){
+ ammicoApi.book.delete({idBook: $scope.books[i].id}, function(){
+ $scope.books.splice(i, 1);
+ },
+ function(error) {
+ if (error.status === 404){
+ $scope.books.splice(i, 1);
+ }
+ });
+ }
+ }
+ };
})
.controller('bookCtrl', function($scope, ammicoApi, $routeParams) {
$scope.slides = ammicoApi.booksSlides.query({idBook:$routeParams.idBook, format:'json'});