49 lines
1.1 KiB
JavaScript
49 lines
1.1 KiB
JavaScript
var directives = angular.module('satbd.satellite.bar.directives',[
|
|
'ui.bootstrap',
|
|
'ngAnimate'
|
|
])
|
|
|
|
directives.directive('album', function() {
|
|
return {
|
|
scope: {
|
|
id: '=albumId'
|
|
},
|
|
templateUrl: 'js/directives/album.html',
|
|
restrict: 'E',
|
|
controller: 'AlbumCtrl'
|
|
};
|
|
});
|
|
|
|
directives.controller('AlbumCtrl', function($scope,$http,$log,$uibModal,albumService) {
|
|
$scope.album = { Note:-1};
|
|
albumService.get($scope.id)
|
|
.then(function(data) {
|
|
$scope.album = data;
|
|
}, function(err) {
|
|
$log.error('Could not fetch album ' + $scope.id + ' :' + err);
|
|
});
|
|
$scope.openAlbumModal = function() {
|
|
var albumModalInstance = $uibModal.open({
|
|
templateUrl: 'html/albumModal.html',
|
|
controller: 'AlbumModalInstanceCtrl',
|
|
size: 'lg',
|
|
keyboard: true,
|
|
resolve: {
|
|
album: function() {
|
|
return $scope.album;
|
|
}
|
|
}
|
|
});
|
|
};
|
|
});
|
|
|
|
directives.controller('AlbumModalInstanceCtrl', function($scope,$uibModalInstance,album) {
|
|
$scope.album = album;
|
|
$scope.ok = function() {
|
|
$uibModalInstance.close('');
|
|
};
|
|
$scope.getLink = function(n) {
|
|
return $scope.album[n];
|
|
}
|
|
});
|