From df62e829225ea84af5b174c06fb79dbb7772e8e2 Mon Sep 17 00:00:00 2001 From: Alexandre Tuleu Date: Thu, 11 Feb 2016 18:51:05 +0100 Subject: [PATCH] Reimplements the recents feature --- webapp/css/satbd.sateliite.bar.css | 65 ++++++++++++++++++---------- webapp/directives.js | 20 --------- webapp/js/directives.js | 22 ++++++++++ webapp/js/directives/album.html | 3 ++ webapp/js/route.js | 0 webapp/js/satbd.satellite.bar.js | 2 + webapp/js/services.js | 20 +++++++++ webapp/js/views/recents/recents.html | 2 + 8 files changed, 90 insertions(+), 44 deletions(-) delete mode 100644 webapp/directives.js create mode 100644 webapp/js/directives.js create mode 100644 webapp/js/directives/album.html delete mode 100644 webapp/js/route.js create mode 100644 webapp/js/services.js diff --git a/webapp/css/satbd.sateliite.bar.css b/webapp/css/satbd.sateliite.bar.css index fd6c4aa..7c67fc9 100644 --- a/webapp/css/satbd.sateliite.bar.css +++ b/webapp/css/satbd.sateliite.bar.css @@ -31,37 +31,54 @@ body > .container-fluid { } } -.album { - padding-top:15px; - padding-bottom:15px; - overflow:hidden; +.album-container { + display: inline-block; + position: relative; + overflow:hidden; } -@media (max-width: 767px) { - .album { - height: 70vw; - } -} -@media (min-width: 768px) and (max-width: 991px) { - .album { - height: 46vw; - } -} -@media (min-width: 992px) and (max-width: 1199px) { - .album { - height: 35vw; - } +.album-container:after { + padding-top:130%; + display: block; + content: ''; } -@media (min-width: 1200px) { - .album { - height: 23vw; - } +.album-container .album { + position: absolute; + top: 15px; + bottom: 0; + right: 0; + left: 15px; + overflow:hidden; } -img.cover { - width:100%; +.album-container .album .img-album-cover { + } +/* @media (max-width: 767px) { */ +/* .album { */ +/* height: 50vw; */ +/* } */ +/* } */ +/* @media (min-width: 768px) and (max-width: 991px) { */ +/* .album { */ +/* height: 33vw; */ +/* } */ +/* } */ +/* @media (min-width: 992px) and (max-width: 1199px) { */ +/* .album { */ +/* height: 25vw; */ +/* } */ +/* } */ +/* @media (min-width: 1200px) { */ +/* .album { */ +/* height: 16vw; */ +/* } */ +/* } */ + +/* img.cover { */ +/* width:100%; */ +/* } */ diff --git a/webapp/directives.js b/webapp/directives.js deleted file mode 100644 index 2177b92..0000000 --- a/webapp/directives.js +++ /dev/null @@ -1,20 +0,0 @@ -var directives = angular.module('satbd.satellite.bar.directives') - -directives.directive('album', function() { - return { - scope: { - id: '@album-id' - } - templateUrl: 'js/directives/album.html', - restrict: 'E', - }; -}); - -directives.controller('albumCtrl', function($scope,$html) { - $scope.init = function() { - $http.get('/api/albums/'+ $scope.id) - .success(function(data) { - $scope.album = data; - }); - }; -}); diff --git a/webapp/js/directives.js b/webapp/js/directives.js new file mode 100644 index 0000000..56a77d5 --- /dev/null +++ b/webapp/js/directives.js @@ -0,0 +1,22 @@ +var directives = angular.module('satbd.satellite.bar.directives',[]) + +directives.directive('album', function() { + return { + scope: { + id: '=albumId' + }, + templateUrl: 'js/directives/album.html', + restrict: 'A', + controller: 'AlbumCtrl' + }; +}); + +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); + }); +}); diff --git a/webapp/js/directives/album.html b/webapp/js/directives/album.html new file mode 100644 index 0000000..3e8f2ab --- /dev/null +++ b/webapp/js/directives/album.html @@ -0,0 +1,3 @@ +
+ {{album.titre}} +
diff --git a/webapp/js/route.js b/webapp/js/route.js deleted file mode 100644 index e69de29..0000000 diff --git a/webapp/js/satbd.satellite.bar.js b/webapp/js/satbd.satellite.bar.js index ffe85dd..00f6b71 100644 --- a/webapp/js/satbd.satellite.bar.js +++ b/webapp/js/satbd.satellite.bar.js @@ -3,6 +3,8 @@ angular.module('satbd.satellite.bar',[ 'ngRoute', 'satbd.satellite.bar.controllers', + 'satbd.satellite.bar.directives', + 'satbd.satellite.bar.services', 'satbd.satellite.bar.views.recents', 'satbd.satellite.bar.views.series', 'satbd.satellite.bar.views.authors', diff --git a/webapp/js/services.js b/webapp/js/services.js new file mode 100644 index 0000000..1ec17d3 --- /dev/null +++ b/webapp/js/services.js @@ -0,0 +1,20 @@ +var services = angular.module('satbd.satellite.bar.services',[]) + +services.factory('albumService',['$http','$log','$q', function($http,$log,$q) { + function get(id) { + return $http.get('/api/albums/'+ id).then(function (response) { + return response.data; + }); + } + + function search(terms) { + var defer = $q.defer(); + 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 733ee80..90b056d 100644 --- a/webapp/js/views/recents/recents.html +++ b/webapp/js/views/recents/recents.html @@ -1 +1,3 @@

Albums Récents

+ +