mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 10:01:40 -05:00
working on nag and tags package
This commit is contained in:
parent
94e055de32
commit
b04d727335
7 changed files with 19 additions and 11 deletions
|
@ -27,7 +27,7 @@ Template.nav.helpers({
|
|||
return getSetting('requirePostsApproval');
|
||||
},
|
||||
hasCategories: function(){
|
||||
return Categories.find().count();
|
||||
return typeof Categories !== 'undefined' && Categories.find().count();
|
||||
},
|
||||
categories: function(){
|
||||
return Categories.find({}, {sort: {name: 1}});
|
||||
|
|
|
@ -1,3 +1,12 @@
|
|||
preloadSubscriptions = typeof preloadSubscriptions === 'undefined' ? [] : preloadSubscriptions;
|
||||
preloadSubscriptions.push('categories');
|
||||
|
||||
adminNav = typeof adminNav === 'undefined' ? [] : adminNav;
|
||||
adminNav.push({
|
||||
route: 'categories',
|
||||
label: 'Categories'
|
||||
});
|
||||
|
||||
Meteor.startup(function () {
|
||||
|
||||
Router.onBeforeAction(Router._filters.isAdmin, {only: ['categories']});
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
preloadSubscriptions = typeof preloadSubscriptions === 'undefined' ? [] : preloadSubscriptions;
|
||||
preloadSubscriptions.push('categories');
|
||||
|
||||
adminNav = typeof adminNav === 'undefined' ? [] : adminNav;
|
||||
adminNav.push({
|
||||
route: 'categories',
|
||||
label: 'Categories'
|
||||
});
|
|
@ -1,5 +1,6 @@
|
|||
Categories = new Meteor.Collection('categories');
|
||||
|
||||
Meteor.startup(function () {
|
||||
Categories.allow({
|
||||
insert: isAdminById
|
||||
, update: isAdminById
|
||||
|
@ -8,9 +9,11 @@ Categories.allow({
|
|||
|
||||
Meteor.methods({
|
||||
category: function(category){
|
||||
console.log(category)
|
||||
if (!Meteor.user() || !isAdmin(Meteor.user()))
|
||||
throw new Meteor.Error(i18n.t('You need to login and be an admin to add a new category.'));
|
||||
var categoryId=Categories.insert(category);
|
||||
return category.name;
|
||||
}
|
||||
});
|
||||
});
|
|
@ -8,13 +8,17 @@ Package.on_use(function (api) {
|
|||
'templating'
|
||||
], 'client');
|
||||
|
||||
api.add_files(['lib/tags.js'], ['client', 'server']);
|
||||
|
||||
api.add_files([
|
||||
'lib/client/tags.js',
|
||||
'lib/client/routes.js',
|
||||
'lib/client/views/categories.html',
|
||||
'lib/client/views/categories.js',
|
||||
'lib/client/views/category_item.html',
|
||||
'lib/client/views/category_item.js',
|
||||
], ['client']);
|
||||
|
||||
api.add_files(['lib/server/publications.js'], ['server']);
|
||||
|
||||
api.export('adminNav');
|
||||
api.export(['preloadSubscriptions', 'adminNav', 'Categories']);
|
||||
});
|
Loading…
Add table
Reference in a new issue