+ gallery page
This commit is contained in:
1 parent
241812c6cf
commit
c72f44ea8b
11 files changed
+195
-2
No files matched your search
@@ -33,6 +33,18 @@ app.config(function ($locationProvider, $routeProvider) {
|
||||
controller: "TeamPageController",
|
||||
title:"Преподаватели"
|
||||
},
|
||||
{
|
||||
name: "/gallery",
|
||||
templateUrl: "/views/gallery.html",
|
||||
controller: "GalleryPageController",
|
||||
title:"Работы учащихся"
|
||||
},
|
||||
{
|
||||
name: "/gallery/:year/:course/:album",
|
||||
templateUrl: "/views/gallery-album.html",
|
||||
controller: "AlbumPageController",
|
||||
title:"Работы учащихся"
|
||||
},
|
||||
{
|
||||
name: "/docs",
|
||||
templateUrl: "/views/docs.html",
|
||||
@@ -76,6 +88,7 @@ require("./filters/uppercase-first")(app);
|
||||
require("./pages/home")(app);
|
||||
require("./pages/schedule")(app);
|
||||
require("./pages/team")(app);
|
||||
require("./pages/gallery")(app);
|
||||
require("./pages/docs")(app);
|
||||
|
||||
app.controller("SchedulePageController", function ($scope) {
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
module.exports = function (app) {
|
||||
app.directive("gFotorama", function(){
|
||||
return {
|
||||
restrict: "A",
|
||||
link: function(scope, element, attrs){
|
||||
element.addClass('fotorama');
|
||||
var fotorama = $(element.fotorama()).data('fotorama');
|
||||
fotorama.setOptions({
|
||||
width: "100%",
|
||||
maxheight: 500,
|
||||
loop: true,
|
||||
nav: "thumbs"
|
||||
});
|
||||
|
||||
scope.$watch(attrs.gFotorama, function (value){
|
||||
console.log(value);
|
||||
fotorama.load(value);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
app.controller("GalleryPageController", function ($scope, $http) {
|
||||
$http.get("/gallery")
|
||||
.success(function (albums) {
|
||||
$scope.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, $http, $routeParams) {
|
||||
var url = '/gallery/{year}/{course}/{album}'
|
||||
.replace('{year}', $routeParams.year)
|
||||
.replace('{course}', $routeParams.course)
|
||||
.replace('{album}', $routeParams.album);
|
||||
$http.get(url)
|
||||
.success(function (album) {
|
||||
var preview = album.content[0];
|
||||
album.preview_url = preview.content.medium.url;
|
||||
album.fotorama = album.content.map(productToFotorama);
|
||||
|
||||
$scope.album = album;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
function productToFotorama(product) {
|
||||
return {
|
||||
img: product.content["big"].url,
|
||||
thumb: product.content["small"].url,
|
||||
full: product.content["original"].url
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user