AlbumController, GalleryController update
This commit is contained in:
1 parent
8771c9bb57
commit
8542a2480a
6 files changed
+86
-133
No files matched your search
@@ -0,0 +1,32 @@
|
||||
export default function (app) {
|
||||
app.controller('AlbumController', ($scope, $rootScope, $http, $routeParams, team, api, menu) => {
|
||||
menu.activate('/gallery');
|
||||
|
||||
let year_uri = $routeParams.year;
|
||||
let course_uri = $routeParams.course;
|
||||
let album_uri = $routeParams.album;
|
||||
|
||||
api.gallery.album(year_uri, course_uri, album_uri)
|
||||
.success(album => {
|
||||
album.teacherName = team.name(album['teacher']);
|
||||
|
||||
$scope.album = album;
|
||||
$scope.crumbs = [
|
||||
{
|
||||
url: '/gallery',
|
||||
name: 'Галерея'
|
||||
},
|
||||
{
|
||||
name: year_uri
|
||||
},
|
||||
{
|
||||
name: album.course
|
||||
},
|
||||
{
|
||||
name: album.title
|
||||
}
|
||||
];
|
||||
$rootScope.title = album.title;
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,22 @@
|
||||
export default function (app) {
|
||||
app.controller("GalleryController", ($scope, api) => {
|
||||
$scope.years = [];
|
||||
|
||||
let years = [2015, 2014, 2013, 2012, 2011, 2010];
|
||||
years.forEach((year, year_index) => {
|
||||
api.gallery.year(year)
|
||||
.success(albums => {
|
||||
if (albums.length) {
|
||||
$scope.years[year_index] = {
|
||||
year: year,
|
||||
albums: albums.map(album => {
|
||||
let preview = album.content[0];
|
||||
album.preview_url = preview.content.medium.url;
|
||||
return album;
|
||||
})
|
||||
};
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
};
|
||||
Reference in new issue
Block a user