AlbumController, GalleryController update
This commit is contained in:
1 parent
8771c9bb57
commit
8542a2480a
6 files changed
+86
-133
No files matched your search
+12
-1
@@ -11,6 +11,8 @@ import TeamMemberProfile from './components/TeamMemberProfile';
|
||||
import AppController from './controllers/AppController';
|
||||
import HomeController from './controllers/HomeController';
|
||||
import TeamController from './controllers/TeamController';
|
||||
import GalleryController from './controllers/GalleryController';
|
||||
import AlbumController from './controllers/AlbumController';
|
||||
import DocumentsController from './controllers/DocumentsController';
|
||||
import CopyrightController from './controllers/CopyrightController';
|
||||
import ContactsController from './controllers/ContactsController';
|
||||
@@ -105,7 +107,6 @@ app.run(($location, $rootScope, $http) => {
|
||||
UppercaseFirst,
|
||||
require('./ui/timeline'),
|
||||
require('./pages/schedule'),
|
||||
require('./pages/gallery'),
|
||||
MainMenu,
|
||||
Breadcrumbs,
|
||||
Document,
|
||||
@@ -115,6 +116,8 @@ app.run(($location, $rootScope, $http) => {
|
||||
AppController,
|
||||
HomeController,
|
||||
TeamController,
|
||||
GalleryController,
|
||||
AlbumController,
|
||||
DocumentsController,
|
||||
CopyrightController,
|
||||
ContactsController,
|
||||
@@ -127,6 +130,14 @@ app.run(($location, $rootScope, $http) => {
|
||||
$scope.pageClass = 'page-schedule';
|
||||
});
|
||||
|
||||
app.controller('GalleryPageController', ($scope) => {
|
||||
$scope.pageClass = 'page-gallery';
|
||||
});
|
||||
|
||||
app.controller('AlbumPageController', ($scope) => {
|
||||
$scope.pageClass = 'page-album';
|
||||
});
|
||||
|
||||
app.controller('DocsPageController', ($scope) => {
|
||||
$scope.pageClass = 'page-docs';
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
})
|
||||
};
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -1,114 +0,0 @@
|
||||
module.exports = function (app) {
|
||||
app.directive("gFotorama", function () {
|
||||
return {
|
||||
restrict: "A",
|
||||
link: function (scope, element, attrs) {
|
||||
element.addClass('fotorama');
|
||||
var $fotorama = $(element.fotorama());
|
||||
var fotorama = $fotorama.data('fotorama');
|
||||
fotorama.setOptions({
|
||||
width: "100%",
|
||||
maxheight: 500,
|
||||
loop: true,
|
||||
nav: "thumbs"
|
||||
});
|
||||
|
||||
//$fotorama.on('fotorama:show', function (e, fotorama, extra) {
|
||||
$fotorama.on('fotorama:error', function (e, fotorama, extra) {
|
||||
console.log('## ' + e.type);
|
||||
console.log('active frame', fotorama.activeFrame);
|
||||
console.log('additional data', extra);
|
||||
});
|
||||
|
||||
scope.$watch(attrs.gFotorama, function (value) {
|
||||
console.log(value);
|
||||
fotorama.load(value);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
app.controller("GalleryPageController", function ($scope, api) {
|
||||
$scope.years = [];
|
||||
var years = [2015, 2014, 2013, 2012, 2011, 2010];
|
||||
years.forEach(function (year, year_index) {
|
||||
api.gallery.year(year)
|
||||
.success(function (albums) {
|
||||
if (albums.length) {
|
||||
$scope.years[year_index] = {
|
||||
year: year,
|
||||
albums: albums.map(function (album) {
|
||||
var preview = album.content[0];
|
||||
album.preview_url = preview.content.medium.url;
|
||||
//album.fotorama = album.content.map(productToFotorama);
|
||||
|
||||
return album;
|
||||
})
|
||||
};
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
app.controller("AlbumPageController", function ($scope, $rootScope, $http, $routeParams, team, api, menu) {
|
||||
menu.activate('/gallery');
|
||||
|
||||
var year_uri = $routeParams.year;
|
||||
var course_uri = $routeParams.course;
|
||||
var album_uri = $routeParams.album;
|
||||
api.gallery.album(
|
||||
year_uri,
|
||||
course_uri,
|
||||
album_uri
|
||||
)
|
||||
.success(function (album) {
|
||||
//var preview = album.content[0];
|
||||
//album.preview_url = preview.content.medium.url;
|
||||
//album.fotorama = album.content.map(productToFotorama);
|
||||
|
||||
album.teacherName = team.name(album['teacher']);
|
||||
|
||||
$scope.album = album;
|
||||
$scope.crumbs = [
|
||||
{
|
||||
url: '/gallery',
|
||||
name: 'Галерея'
|
||||
},
|
||||
{
|
||||
//url: '/gallery/{year}'.replace('{year}', year_uri),
|
||||
name: year_uri
|
||||
},
|
||||
{
|
||||
//url: '/gallery/{year}/{course}'
|
||||
// .replace('{year}', year_uri)
|
||||
// .replace('{course}', course_uri),
|
||||
name: album.course
|
||||
},
|
||||
{
|
||||
name: album.title
|
||||
}
|
||||
];
|
||||
$rootScope.title = album.title;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
function productToFotorama(product) {
|
||||
//var tpl = '<div class="album-item"><div><p>' + product.author + '</p><p>' + product.authorAge + ' лет</p></div></div>';
|
||||
|
||||
var $e = $('<div class="album-item"><div></div></div>');
|
||||
var $c = $e.find('.album-item div');
|
||||
$('<p></p>').text(product.author).appendTo($c);
|
||||
if (product['authorAge']) {
|
||||
$('<p></p>').text(product['authorAge'] + ' лет').appendTo($c);
|
||||
}
|
||||
|
||||
return {
|
||||
img: product.content["big"].url,
|
||||
thumb: product.content["small"].url,
|
||||
full: product.content["original"].url,
|
||||
//html: $.parseHTML(tpl)[0]
|
||||
html: $e
|
||||
};
|
||||
}
|
||||
@@ -1,27 +1,29 @@
|
||||
<breadcrumbs crumbs="crumbs"></breadcrumbs>
|
||||
<div class="content content_semi-wide" ng-controller="AlbumController">
|
||||
<breadcrumbs crumbs="crumbs"></breadcrumbs>
|
||||
|
||||
<div class="album-block" ng-controller="AlbumPageController">
|
||||
<h3>{{album.title}}</h3>
|
||||
<div class="album-block">
|
||||
<h3>{{album.title}}</h3>
|
||||
|
||||
<div class="album" ng-show="album">
|
||||
<div class="album-info">
|
||||
<p>Предмет: {{album.course}}</p>
|
||||
<p>Преподаватель: {{album.teacherName}}</p>
|
||||
<p class="description" ng-show="album.description">{{album.description}}</p>
|
||||
</div>
|
||||
<div class="album" ng-show="album">
|
||||
<div class="album-info">
|
||||
<p>Предмет: {{album.course}}</p>
|
||||
<p>Преподаватель: {{album.teacherName}}</p>
|
||||
<p class="description" ng-show="album.description">{{album.description}}</p>
|
||||
</div>
|
||||
|
||||
<div class="album-item" ng-repeat="product in album.content">
|
||||
<img ng-src="{{product.content.big.url}}" alt=""/>
|
||||
<div class="album-item" ng-repeat="product in album.content">
|
||||
<img ng-src="{{product.content.big.url}}" alt=""/>
|
||||
|
||||
<div class="product-info">
|
||||
<div>
|
||||
<p ng-show="product.title" class="title">{{product.title | removeNewline}}</p>
|
||||
<div class="product-info">
|
||||
<div>
|
||||
<p ng-show="product.title" class="title">{{product.title | removeNewline}}</p>
|
||||
|
||||
<p>{{product.author}}</p>
|
||||
<p>{{product.author}}</p>
|
||||
|
||||
<p ng-show="product.authorAge">{{product.authorAge}} лет</p>
|
||||
<p ng-show="product.authorAge">{{product.authorAge}} лет</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,4 +1,4 @@
|
||||
<div class="content content_wide" ng-controller="GalleryPageController">
|
||||
<div class="content content_wide" ng-controller="GalleryController">
|
||||
<div class="album-collection" ng-repeat="period in years">
|
||||
<h2 class="album-collection__title">{{period.year}}</h2>
|
||||
<div class="album-collection__body">
|
||||
|
||||
Reference in new issue
Block a user