From ce1ee99c9f2529628769fcc2d949fa6bbc6cb37d Mon Sep 17 00:00:00 2001 From: Alexandre Tuleu Date: Fri, 12 Feb 2016 11:37:36 +0100 Subject: [PATCH] Improves album directives --- webapp/css/satbd.sateliite.bar.css | 17 +++++++---------- webapp/js/directives.js | 5 ++--- webapp/js/directives/album.html | 8 ++++++-- webapp/js/services.js | 8 ++++++-- webapp/js/views/recents/recents.html | 4 +++- 5 files changed, 24 insertions(+), 18 deletions(-) diff --git a/webapp/css/satbd.sateliite.bar.css b/webapp/css/satbd.sateliite.bar.css index 7c67fc9..b32e0ef 100644 --- a/webapp/css/satbd.sateliite.bar.css +++ b/webapp/css/satbd.sateliite.bar.css @@ -31,31 +31,28 @@ body > .container-fluid { } } -.album-container { +.cover-container { + width:100%; display: inline-block; position: relative; overflow:hidden; } -.album-container:after { - padding-top:130%; +.cover-container:after { + padding-top:100%; display: block; content: ''; } -.album-container .album { +.cover-container .cover { position: absolute; - top: 15px; + top: 0; bottom: 0; right: 0; - left: 15px; + left: 0; overflow:hidden; } -.album-container .album .img-album-cover { - -} - /* @media (max-width: 767px) { */ /* .album { */ diff --git a/webapp/js/directives.js b/webapp/js/directives.js index 56a77d5..3f18b3f 100644 --- a/webapp/js/directives.js +++ b/webapp/js/directives.js @@ -6,7 +6,7 @@ directives.directive('album', function() { id: '=albumId' }, templateUrl: 'js/directives/album.html', - restrict: 'A', + restrict: 'E', controller: 'AlbumCtrl' }; }); @@ -15,8 +15,7 @@ directives.controller('AlbumCtrl', function($scope,$http,$log,albumService) { albumService.get($scope.id) .then(function(data) { $scope.album = data; - $log.info('Got : ' + data.ID); }, function(err) { - $log.error('Got error :' + err); + $log.error('Could not fetch album' + $scope.id + ' :' + err); }); }); diff --git a/webapp/js/directives/album.html b/webapp/js/directives/album.html index 3e8f2ab..b5e15f1 100644 --- a/webapp/js/directives/album.html +++ b/webapp/js/directives/album.html @@ -1,3 +1,7 @@ -
- {{album.titre}} +
+
+ {{album.titre}} +
+

{{album.serie}}

+ diff --git a/webapp/js/services.js b/webapp/js/services.js index 1ec17d3..bb9c8ee 100644 --- a/webapp/js/services.js +++ b/webapp/js/services.js @@ -1,9 +1,13 @@ var services = angular.module('satbd.satellite.bar.services',[]) services.factory('albumService',['$http','$log','$q', function($http,$log,$q) { + function cleanupFields(album) { + album.serie = album.série; + return album; + } function get(id) { return $http.get('/api/albums/'+ id).then(function (response) { - return response.data; + return cleanupFields(response.data); }); } @@ -12,7 +16,7 @@ services.factory('albumService',['$http','$log','$q', function($http,$log,$q) { defer.reject('Search is not implemented'); return defer.promise; } - + return { get: get, search: search diff --git a/webapp/js/views/recents/recents.html b/webapp/js/views/recents/recents.html index 90b056d..eb185eb 100644 --- a/webapp/js/views/recents/recents.html +++ b/webapp/js/views/recents/recents.html @@ -1,3 +1,5 @@

Albums Récents

-
+
+ +