Final Update From Caleb

Incorporated all Caleb's changes
This commit is contained in:
2018-08-23 16:58:50 -07:00
parent 2593d0f977
commit 14bd554d35
206 changed files with 2661 additions and 84 deletions

View File

@@ -0,0 +1,53 @@
import { Meteor } from 'meteor/meteor';
import { Mongo } from 'meteor/mongo';
import { check } from 'meteor/check';
import SimpleSchema from 'simpl-schema';
let ContactUsMessages = new Mongo.Collection('ContactUsMessages');
ContactUsMessages.attachSchema(new SimpleSchema({
name: {
type: String,
label: "Name",
optional: false,
trim: false,
},
email: {
type: String,
label: "Email",
optional: false,
trim: false
},
message: {
type: String,
label: "Message",
optional: false,
trim: false
},
createdAt: {
type: Date,
label: "Created On",
optional: true
}
}));
if(Meteor.isServer) Meteor.publish('contactUsMessages', function() {
return ContactUsMessages.find({});
});
if(Meteor.isServer) {
Meteor.methods({
submitContactForm: function(name, email, message) {
check(name, String);
check(email, String);
check(message, String);
if(Roles.userIsInRole(this.userId, [Meteor.UserRoles.ROLE_UPDATE])) {
ContactUsMessages.insert({name, email, message, createdAt: new Date()});
}
else throw new Meteor.Error(403, "Not authorized.");
}
});
}
export default ContactUsMessages;

View File

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