Vulcan/packages/telescope-pages/lib/pages.js

57 lines
983 B
JavaScript
Raw Normal View History

2015-05-11 12:15:10 +09:00
Pages = new Mongo.Collection('pages');
2015-05-11 12:15:10 +09:00
Pages.schema = new SimpleSchema({
title: {
type: String
},
slug: {
type: String,
optional: true
},
content: {
type: String,
autoform: {
rows: 10
}
},
order: {
type: Number,
optional: true
}
});
2015-05-11 12:15:10 +09:00
Pages.schema.internationalize();
2015-05-11 12:15:10 +09:00
Pages.attachSchema(Pages.schema);
2015-05-11 12:15:10 +09:00
Pages.before.insert(function (userId, doc) {
// if no slug has been provided, generate one
if (!doc.slug)
doc.slug = Telescope.utils.slugify(doc.title);
});
2015-05-17 15:38:02 +09:00
Telescope.modules.add("primaryNav", {
template: "pagesMenu",
order: 5
});
2015-05-17 15:38:02 +09:00
Telescope.modules.add("mobileNav", {
template: 'pagesMenu',
order: 5
});
Meteor.startup(function () {
2015-05-11 12:15:10 +09:00
Pages.allow({
2015-04-27 17:14:07 +09:00
insert: Users.is.adminById,
update: Users.is.adminById,
remove: Users.is.adminById
});
Meteor.methods({
insertPage: function(pageTitle, pageContent){
return Feeds.insert({title: pageTitle, content: pageContent});
}
});
});