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:
33
imports/ui/EditablePage.js
Normal file
33
imports/ui/EditablePage.js
Normal file
@@ -0,0 +1,33 @@
|
||||
import './EditablePage.html';
|
||||
|
||||
let routeData = {
|
||||
Appreciation: {name: "Appreciation"},
|
||||
News: {name: "News"},
|
||||
ImportantDates: {name: "Dates"},
|
||||
CurrentBoard: {name: "Board"}
|
||||
};
|
||||
|
||||
Tracker.autorun(function() {
|
||||
Meteor.subscribe("pages");
|
||||
});
|
||||
|
||||
Template.EditablePage.onCreated(function() {
|
||||
let template = this;
|
||||
|
||||
this.pageName = new ReactiveVar();
|
||||
|
||||
Tracker.autorun(function() {
|
||||
if(routeData[FlowRouter.getRouteName()]) {
|
||||
//Save the page's name (indexes the page HTML in the collection) to the reactive variable so that all the content changes automatically.
|
||||
template.pageName.set(routeData[FlowRouter.getRouteName()].name);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Template.EditablePage.helpers({
|
||||
editableHTML: function() {
|
||||
let doc = Meteor.collections.Pages.findOne({name: Template.instance().pageName.get()});
|
||||
|
||||
return doc === undefined ? "" : doc.html;
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user