+ PageGallery component

This commit is contained in:
tmshv committed 2016-02-25 18:53:57 +03:00
1 parent c51bdfbd10
commit 60b66123ef
6 files changed
+36 -35

No files matched your search

+2 -6
View File
@@ -19,9 +19,9 @@ import FooterLinks from './components/FooterLinks';
import PageSchool from './components/PageSchool';
import PageSchedule from './components/PageSchedule';
import PageCollective from './components/PageCollective';
import PageGallery from './components/PageGallery';
import AppController from './controllers/AppController';
import GalleryController from './controllers/GalleryController';
import AlbumController from './controllers/AlbumController';
import DocumentsController from './controllers/DocumentsController';
import CopyrightController from './controllers/CopyrightController';
@@ -93,8 +93,8 @@ app.run(($location, $rootScope, $http) => {
PageSchool,
PageSchedule,
PageCollective,
PageGallery,
AppController,
GalleryController,
AlbumController,
DocumentsController,
CopyrightController,
@@ -106,10 +106,6 @@ app.run(($location, $rootScope, $http) => {
ScheduleRecord,
FooterLinks,
function (app) {
app.controller('GalleryPageController', ($scope) => {
$scope.pageClass = 'page-gallery';
});
app.controller('AlbumPageController', ($scope) => {
$scope.pageClass = 'page-album';
});
+28
View File
@@ -0,0 +1,28 @@
import template from '../../templates/components/page-gallery.html';
export default function (app) {
app.component('pageCollective', {
template: template,
controller: function (api) {
this.pageClass = 'page-gallery';
this.years = [];
[2015, 2014, 2013, 2012, 2011, 2010]
.forEach((year, year_index) => {
api.gallery.year(year)
.success(albums => {
if (albums.length) {
this.years[year_index] = {
year: year,
albums: albums.map(album => {
let preview = album.content[0];
album.preview_url = preview.content.medium.url;
return album;
})
};
}
})
});
}
});
};
+1 -2
View File
@@ -37,8 +37,7 @@ export let routes = [
},
{
name: '/gallery',
templateUrl: '/views/gallery.html',
controller: 'GalleryPageController',
template: '<page-gallery></page-gallery>',
title: 'Работы учащихся'
},
{
@@ -1,22 +0,0 @@
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;
})
};
}
})
});
});
};
@@ -0,0 +1,5 @@
<div class="content content_wide">
<album-collection ng-repeat="i in $ctrl.years"
title="{{i.year}}" albums="i.albums"
></album-collection>
</div>
-5
View File
@@ -1,5 +0,0 @@
<div class="content content_wide" ng-controller="GalleryController">
<album-collection ng-repeat="i in years"
title="{{i.year}}" albums="i.albums"
></album-collection>
</div>