2015-04-22 07:50:11 +09:00
|
|
|
Pages = {};
|
|
|
|
|
2015-04-27 09:55:29 +09:00
|
|
|
Telescope.schemas.pages = new SimpleSchema({
|
2015-04-22 07:50:11 +09:00
|
|
|
title: {
|
|
|
|
type: String
|
|
|
|
},
|
|
|
|
slug: {
|
|
|
|
type: String,
|
|
|
|
optional: true
|
|
|
|
},
|
|
|
|
content: {
|
|
|
|
type: String,
|
|
|
|
autoform: {
|
|
|
|
rows: 10
|
|
|
|
}
|
|
|
|
},
|
|
|
|
order: {
|
|
|
|
type: Number,
|
|
|
|
optional: true
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
Pages.collection = new Meteor.Collection('pages');
|
2015-04-27 09:55:29 +09:00
|
|
|
|
|
|
|
i18n.internationalizeSchema(Telescope.schemas.pages);
|
|
|
|
|
|
|
|
Pages.collection.attachSchema(Telescope.schemas.pages);
|
2015-04-22 07:50:11 +09:00
|
|
|
|
|
|
|
Pages.collection.before.insert(function (userId, doc) {
|
|
|
|
// if no slug has been provided, generate one
|
|
|
|
if (!doc.slug)
|
|
|
|
doc.slug = Telescope.utils.slugify(doc.title);
|
|
|
|
});
|
|
|
|
|
2015-04-24 10:28:11 +09:00
|
|
|
Telescope.modules.register("primaryNav", {
|
2015-04-22 07:50:11 +09:00
|
|
|
template: "pagesMenu",
|
|
|
|
order: 5
|
|
|
|
});
|
|
|
|
|
2015-04-24 10:28:11 +09:00
|
|
|
Telescope.modules.register("mobileNav", {
|
2015-04-22 07:50:11 +09:00
|
|
|
template: 'pagesMenu',
|
|
|
|
order: 5
|
|
|
|
});
|
|
|
|
|
|
|
|
Meteor.startup(function () {
|
|
|
|
Pages.collection.allow({
|
|
|
|
insert: Users.isAdminById,
|
|
|
|
update: Users.isAdminById,
|
|
|
|
remove: Users.isAdminById
|
|
|
|
});
|
|
|
|
|
|
|
|
Meteor.methods({
|
|
|
|
insertPage: function(pageTitle, pageContent){
|
|
|
|
return Feeds.insert({title: pageTitle, content: pageContent});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|