# HG changeset patch # User rougeronj # Date 1427109764 -3600 # Node ID 21ecbde9e080508a9d9b35bdae461ea29e906b65 # Parent 4a155e6fb4097feb97a8797637289469d564f5c0 add books controller to handle list of books diff -r 4a155e6fb409 -r 21ecbde9e080 client/app/books/book.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/app/books/book.css Mon Mar 23 12:22:44 2015 +0100 @@ -0,0 +1,43 @@ +.gallery .item { + overflow:hidden; position:relative; height: 250px; padding: 5px; +} + +.img-ctn { + height: 100%; width: 100%; border: 1px solid #DDD; padding: 5px; overflow: hidden; +} + +.img-ctn:hover { + background-color: #DDD; +} + +.img-ctn p { + background-color: #ddd; + bottom: -5px; + display: none; + padding: 2px 5px; + position: absolute; + width: calc(100% - 22px); +} + +.img-ctn:hover p, .img-ctn:hover .gallery-buttons { + display: block; +} + +.gallery .item img { + margin: 0 auto; + max-height: 100%; +} + +.gallery-buttons{ + display: none; + position: absolute; + right: 10px; + top: 10px; +} + +.subtitle { + border-top: 1px solid #000; + border-bottom: 1px dotted #000; + margin-top: 20px; + padding: 6px 0 10px; +} diff -r 4a155e6fb409 -r 21ecbde9e080 client/app/books/book.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/app/books/book.html Mon Mar 23 12:22:44 2015 +0100 @@ -0,0 +1,15 @@ +

Books {{idBook}} :

+ + diff -r 4a155e6fb409 -r 21ecbde9e080 client/app/books/books.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/app/books/books.html Mon Mar 23 12:22:44 2015 +0100 @@ -0,0 +1,9 @@ +

Liste des books :

+ + \ No newline at end of file diff -r 4a155e6fb409 -r 21ecbde9e080 client/app/books/books_controller.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/app/books/books_controller.js Mon Mar 23 12:22:44 2015 +0100 @@ -0,0 +1,29 @@ +(function(){ + 'use strict'; + + angular.module('ammicoBooks',['ngRoute']) + .service('booksModel', function(searchApi) { + this.books = searchApi.getResource.query({action:'books', format:'json'}); + }) + .controller('booksCtrl', function($scope, $location, booksModel){ + $scope.books = booksModel.books; + $scope.searchSubmit = function(){ + $location.path('/search/' + $scope.q); + }; + }) + .controller('bookCtrl', function($scope, searchApi, $routeParams, booksModel) { + $scope.slides = searchApi.getResource.query({action:'books/'+$routeParams.idBook+'/slides', format:'json'}, function(data){ + if (typeof(booksModel.slide) === 'undefined') + booksModel.slides = []; + booksModel.slides[$routeParams.idBook] = data; + }); + + $scope.deleteItem = function(i){ + if(0<=i && i<$scope.slides.length){ + if(window.confirm('Êtes-vous sûr(e) de vouloir effacer cet élément ? Cette action est irrémédiable.')){ + $scope.slides.splice(i, 1); + } + } + }; + }); +})(); diff -r 4a155e6fb409 -r 21ecbde9e080 client/app/books/books_controller_test.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/app/books/books_controller_test.js Mon Mar 23 12:22:44 2015 +0100 @@ -0,0 +1,7 @@ +'use strict'; + +describe("books_controller_test", function(){ + it("should assert something",function(){ + expect(true).toBe(true); + }) +})