Improves album directives
This commit is contained in:
@@ -31,31 +31,28 @@ body > .container-fluid {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.album-container {
|
.cover-container {
|
||||||
|
width:100%;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow:hidden;
|
overflow:hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.album-container:after {
|
.cover-container:after {
|
||||||
padding-top:130%;
|
padding-top:100%;
|
||||||
display: block;
|
display: block;
|
||||||
content: '';
|
content: '';
|
||||||
}
|
}
|
||||||
|
|
||||||
.album-container .album {
|
.cover-container .cover {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 15px;
|
top: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
left: 15px;
|
left: 0;
|
||||||
overflow:hidden;
|
overflow:hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.album-container .album .img-album-cover {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* @media (max-width: 767px) { */
|
/* @media (max-width: 767px) { */
|
||||||
/* .album { */
|
/* .album { */
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ directives.directive('album', function() {
|
|||||||
id: '=albumId'
|
id: '=albumId'
|
||||||
},
|
},
|
||||||
templateUrl: 'js/directives/album.html',
|
templateUrl: 'js/directives/album.html',
|
||||||
restrict: 'A',
|
restrict: 'E',
|
||||||
controller: 'AlbumCtrl'
|
controller: 'AlbumCtrl'
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
@@ -15,8 +15,7 @@ directives.controller('AlbumCtrl', function($scope,$http,$log,albumService) {
|
|||||||
albumService.get($scope.id)
|
albumService.get($scope.id)
|
||||||
.then(function(data) {
|
.then(function(data) {
|
||||||
$scope.album = data;
|
$scope.album = data;
|
||||||
$log.info('Got : ' + data.ID);
|
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
$log.error('Got error :' + err);
|
$log.error('Could not fetch album' + $scope.id + ' :' + err);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
<div class="album">
|
<div class="cover-container">
|
||||||
<img class="img-responsive img-album-cover" alt="{{album.titre}}" ng-src="{{album.CoverURL}}"/>
|
<div class="cover">
|
||||||
|
<img class="img-responsive img-album-cover" alt="{{album.titre}}" ng-src="{{album.CoverURL}}"/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<p>{{album.serie}}</p>
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
var services = angular.module('satbd.satellite.bar.services',[])
|
var services = angular.module('satbd.satellite.bar.services',[])
|
||||||
|
|
||||||
services.factory('albumService',['$http','$log','$q', function($http,$log,$q) {
|
services.factory('albumService',['$http','$log','$q', function($http,$log,$q) {
|
||||||
|
function cleanupFields(album) {
|
||||||
|
album.serie = album.série;
|
||||||
|
return album;
|
||||||
|
}
|
||||||
function get(id) {
|
function get(id) {
|
||||||
return $http.get('/api/albums/'+ id).then(function (response) {
|
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');
|
defer.reject('Search is not implemented');
|
||||||
return defer.promise;
|
return defer.promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
get: get,
|
get: get,
|
||||||
search: search
|
search: search
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
<h1> Albums Récents </h1>
|
<h1> Albums Récents </h1>
|
||||||
|
|
||||||
<div class="col-xs-6 col-sm-4 col-md-3 col-lg-2 album-container" album ng-repeat="id in albumIDs" album-id="id"></div>
|
<div class="col-xs-6 col-sm-4 col-md-3 col-lg-2" ng-repeat="id in albumIDs">
|
||||||
|
<album album-id="id"></album>
|
||||||
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user