Updated to nearly fully functional. Pre-release 1. Still needs some UI changes in the slideshow and admin pages (move the save button & fix the save detection for the internship list). Customer had one more page change request which I need to re-define and handle.

This commit is contained in:
Wynne Crisman
2018-12-12 11:04:00 -08:00
parent c0e971774e
commit 3fc374eda3
108 changed files with 3472 additions and 628 deletions

View File

@@ -1,2 +1,109 @@
import './PhotoGallery.html';
import './PhotoGallery.html';
let PREFIX = "PhotoGallery_";
Tracker.autorun(function() {
Meteor.subscribe("pages");
Meteor.subscribe("slideshow");
});
Template.PhotoGallery.onCreated(function() {
let template = this;
this.slideshows = Meteor.collections.Slideshow.find({}, {sort: {name: 1}});
});
Template.PhotoGallery.events({
'click .galleryLink': function(event, template) {
let slideshowId = $(event.target).data("slideshow-id");
let slideshow = slideshowId ? Meteor.collections.Slideshow.findOne(slideshowId) : undefined;
Session.set(PREFIX + 'selectedSlideshow', slideshow);
}
});
Template.PhotoGallery.helpers({
editableHTML: function() {
let doc = Meteor.collections.Pages.findOne({name: "Slideshow"});
return doc === undefined ? "" : doc.html;
},
slideshows: function() {
return Template.instance().slideshows;
},
slideshow: function() {
return Session.get(PREFIX + "selectedSlideshow");
}
});
Template.Slideshow.onRendered(function() {
let template = this;
this.slideTimer = Meteor.setInterval(function() {
let current = template.$('.slide.showSlide');
if(current) {
let next = current.next();
if(next.length === 0) {
next = template.$('.slide:first');
}
current.removeClass('showSlide');
next.addClass('showSlide');
}
else {
let first = template.$('.slide:first');
if(first) first.addClass('showSlide');
}
}, 6000);
});
Template.Slideshow.onDestroyed(function() {
if(this.slideTimer) Meteor.clearTimeout(this.slideTimer);
});
Template.Slideshow.helpers({
slides: function() {
return Session.get(PREFIX + "selectedSlideshow").images;
}
});
Template.Slideshow.events({
"click .next": function(event, template) {
let current = template.$('.slide.showSlide');
if(current) {
let next = current.next();
if(next.length === 0) {
next = template.$('.slide:first');
}
current.removeClass('showSlide');
next.addClass('showSlide');
}
else {
let first = template.$('.slide:first');
if(first) first.addClass('showSlide');
}
},
"click .previous": function(event, template) {
let current = template.$('.slide.showSlide');
if(current) {
let previous = current.prev();
if(previous.length === 0) {
previous = template.$('.slide:last');
}
current.removeClass('showSlide');
previous.addClass('showSlide');
}
else {
let last = template.$('.slide:last');
if(last) last.addClass('showSlide');
}
}
});