Reimplements the recents feature
This commit is contained in:
22
webapp/js/directives.js
Normal file
22
webapp/js/directives.js
Normal file
@@ -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);
|
||||
});
|
||||
});
|
||||
3
webapp/js/directives/album.html
Normal file
3
webapp/js/directives/album.html
Normal file
@@ -0,0 +1,3 @@
|
||||
<div class="album">
|
||||
<img class="img-responsive img-album-cover" alt="{{album.titre}}" ng-src="{{album.CoverURL}}"/>
|
||||
</div>
|
||||
@@ -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',
|
||||
|
||||
20
webapp/js/services.js
Normal file
20
webapp/js/services.js
Normal file
@@ -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
|
||||
};
|
||||
}]);
|
||||
@@ -1 +1,3 @@
|
||||
<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>
|
||||
|
||||
Reference in New Issue
Block a user