Appreciation Editor Complete / All Others Incomplete

The text editor for the appreciation page is complete, but all other files are empty, besides User Manager.
This commit is contained in:
2018-08-17 11:24:00 -07:00
parent 26728082dc
commit 2593d0f977
24 changed files with 502 additions and 388 deletions

48
imports/api/Page.js Normal file
View File

@@ -0,0 +1,48 @@
import { Meteor } from 'meteor/meteor';
import { Mongo } from 'meteor/mongo';
import { check } from 'meteor/check';
import SimpleSchema from 'simpl-schema';
let Pages = new Mongo.Collection('Pages');
Pages.attachSchema(new SimpleSchema({
name: {
type: String,
label: "Name",
optional: false,
trim: true,
index: 1,
unique: true
},
html: {
type: String,
label: "HTML",
optional: false,
trim: false
},
updatedAt: {
type: Date,
label: "Updated On",
optional: true
}
}));
if(Meteor.isServer) Meteor.publish('pages', function() {
return Pages.find({});
});
if(Meteor.isServer) {
Meteor.methods({
updatePage: function(name, html) {
check(name, String);
check(html, String);
if(Roles.userIsInRole(this.userId, [Meteor.UserRoles.ROLE_UPDATE])) {
Pages.upsert({name}, {$set: {name, html, updatedAt: new Date()}});
}
else throw new Meteor.Error(403, "Not authorized.");
}
});
}
export default Pages;

View File

@@ -1,9 +1,10 @@
import Users from "./User.js";
import UserRoles from "./Roles.js";
import Pages from "./Page.js";
//Save the collections in the Meteor.collections property for easy access without name conflicts.
Meteor.collections = {Users, UserRoles};
Meteor.collections = {Users, UserRoles, Pages};
//If this is the server then setup the default admin user if none exist.
if(Meteor.isServer) {