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:
48
imports/api/Page.js
Normal file
48
imports/api/Page.js
Normal 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;
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user