mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 01:51:40 -05:00
removing Categories global
This commit is contained in:
parent
41f349d18c
commit
02fb7fa34d
20 changed files with 139 additions and 131 deletions
|
@ -1,6 +1,7 @@
|
|||
import marked from 'marked';
|
||||
import Posts from "meteor/nova:posts";
|
||||
import Comments from "meteor/nova:comments";
|
||||
import Categories from "meteor/nova:categories";
|
||||
|
||||
// TODO: switch over to Tom's migration package.
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import moment from 'moment';
|
|||
import { ModalTrigger } from "meteor/nova:core";
|
||||
import { Link } from 'react-router';
|
||||
import Posts from "meteor/nova:posts";
|
||||
import Categories from "meteor/nova:categories";
|
||||
|
||||
class CustomPostsItem extends Telescope.components.PostsItem {
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import NovaForm from "meteor/nova:forms";
|
|||
import { DocumentContainer } from "meteor/utilities:react-list-container";
|
||||
//import { Messages } from "meteor/nova:core";
|
||||
//import Actions from "../actions.js";
|
||||
import Categories from "meteor/nova:categories";
|
||||
|
||||
class CategoriesEditForm extends Component{
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import React from 'react';
|
||||
import { ListContainer } from "meteor/utilities:react-list-container";
|
||||
import Categories from "meteor/nova:categories";
|
||||
|
||||
const PostsListHeader = () => {
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import Posts from "meteor/nova:posts";
|
||||
import Categories from "./collection.js";
|
||||
|
||||
// generate slug on insert
|
||||
Categories.before.insert(function (userId, doc) {
|
||||
|
|
3
packages/nova-categories/lib/client.js
Normal file
3
packages/nova-categories/lib/client.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
import Categories from './modules.js';
|
||||
|
||||
export default Categories;
|
|
@ -1,100 +1,3 @@
|
|||
import Users from 'meteor/nova:users';
|
||||
const Categories = new Mongo.Collection("categories");
|
||||
|
||||
Categories = new Mongo.Collection("categories");
|
||||
|
||||
// category schema
|
||||
Categories.schema = new SimpleSchema({
|
||||
name: {
|
||||
type: String,
|
||||
insertableIf: Users.is.admin,
|
||||
editableIf: Users.is.admin,
|
||||
publish: true
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
optional: true,
|
||||
insertableIf: Users.is.admin,
|
||||
editableIf: Users.is.admin,
|
||||
publish: true,
|
||||
autoform: {
|
||||
rows: 3
|
||||
}
|
||||
},
|
||||
order: {
|
||||
type: Number,
|
||||
optional: true,
|
||||
insertableIf: Users.is.admin,
|
||||
editableIf: Users.is.admin,
|
||||
publish: true
|
||||
},
|
||||
slug: {
|
||||
type: String,
|
||||
optional: true,
|
||||
insertableIf: Users.is.admin,
|
||||
editableIf: Users.is.admin,
|
||||
publish: true
|
||||
},
|
||||
image: {
|
||||
type: String,
|
||||
optional: true,
|
||||
insertableIf: Users.is.admin,
|
||||
editableIf: Users.is.admin,
|
||||
publish: true
|
||||
},
|
||||
parentId: {
|
||||
type: String,
|
||||
optional: true,
|
||||
insertableIf: Users.is.admin,
|
||||
editableIf: Users.is.admin,
|
||||
publish: true,
|
||||
autoform: {
|
||||
options: function () {
|
||||
var categories = Categories.find().map(function (category) {
|
||||
return {
|
||||
value: category._id,
|
||||
label: category.name
|
||||
};
|
||||
});
|
||||
return categories;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Meteor.startup(function(){
|
||||
// Categories.internationalize();
|
||||
// });
|
||||
|
||||
Categories.attachSchema(Categories.schema);
|
||||
|
||||
|
||||
Telescope.settings.collection.addField([
|
||||
{
|
||||
fieldName: 'categoriesBehavior',
|
||||
fieldSchema: {
|
||||
type: String,
|
||||
optional: true,
|
||||
autoform: {
|
||||
group: 'categories',
|
||||
instructions: 'Let users filter by one or multiple categories at a time.',
|
||||
options: function () {
|
||||
return [
|
||||
{value: "single", label: __("categories_behavior_one_at_a_time")},
|
||||
{value: "multiple", label: __("categories_behavior_multiple")}
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
fieldName: 'hideEmptyCategories',
|
||||
fieldSchema: {
|
||||
type: Boolean,
|
||||
optional: true,
|
||||
autoform: {
|
||||
group: 'categories',
|
||||
instructions: 'Hide empty categories in navigation'
|
||||
}
|
||||
}
|
||||
}
|
||||
]);
|
||||
export default Categories;
|
|
@ -1,6 +1,7 @@
|
|||
import PublicationUtils from 'meteor/utilities:smart-publications';
|
||||
import Posts from "meteor/nova:posts";
|
||||
import Users from 'meteor/nova:users';
|
||||
import Categories from "./collection.js";
|
||||
|
||||
Posts.addField(
|
||||
{
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import Posts from "meteor/nova:posts";
|
||||
import Categories from "./collection.js";
|
||||
|
||||
/**
|
||||
* @summary Get all of a category's parents
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import Posts from "meteor/nova:posts";
|
||||
import Users from 'meteor/nova:users';
|
||||
import Categories from "./collection.js";
|
||||
|
||||
Meteor.methods({
|
||||
"categories.deleteById": function (categoryId) {
|
||||
|
|
11
packages/nova-categories/lib/modules.js
Normal file
11
packages/nova-categories/lib/modules.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
import Categories from './collection.js';
|
||||
|
||||
import './schema.js';
|
||||
import './helpers.js';
|
||||
import './callbacks.js';
|
||||
import './parameters.js';
|
||||
import './custom_fields.js';
|
||||
import './subscriptions.js';
|
||||
import './methods.js';
|
||||
|
||||
export default Categories;
|
|
@ -1,3 +1,5 @@
|
|||
import Categories from "./collection.js";
|
||||
|
||||
// Category Parameter
|
||||
// Add a "categories" property to terms which can be used to filter *all* existing Posts views.
|
||||
function addCategoryParameter (parameters, terms) {
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
// Telescope.adminRoutes.route('/categories', {
|
||||
// name: "adminCategories",
|
||||
// action: function(params, queryParams) {
|
||||
// BlazeLayout.render("layout", {main: "admin_wrapper", admin: "categories_admin"});
|
||||
// }
|
||||
// });
|
99
packages/nova-categories/lib/schema.js
Normal file
99
packages/nova-categories/lib/schema.js
Normal file
|
@ -0,0 +1,99 @@
|
|||
import Categories from "./collection.js";
|
||||
import Users from 'meteor/nova:users';
|
||||
|
||||
// category schema
|
||||
Categories.schema = new SimpleSchema({
|
||||
name: {
|
||||
type: String,
|
||||
insertableIf: Users.is.admin,
|
||||
editableIf: Users.is.admin,
|
||||
publish: true
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
optional: true,
|
||||
insertableIf: Users.is.admin,
|
||||
editableIf: Users.is.admin,
|
||||
publish: true,
|
||||
autoform: {
|
||||
rows: 3
|
||||
}
|
||||
},
|
||||
order: {
|
||||
type: Number,
|
||||
optional: true,
|
||||
insertableIf: Users.is.admin,
|
||||
editableIf: Users.is.admin,
|
||||
publish: true
|
||||
},
|
||||
slug: {
|
||||
type: String,
|
||||
optional: true,
|
||||
insertableIf: Users.is.admin,
|
||||
editableIf: Users.is.admin,
|
||||
publish: true
|
||||
},
|
||||
image: {
|
||||
type: String,
|
||||
optional: true,
|
||||
insertableIf: Users.is.admin,
|
||||
editableIf: Users.is.admin,
|
||||
publish: true
|
||||
},
|
||||
parentId: {
|
||||
type: String,
|
||||
optional: true,
|
||||
insertableIf: Users.is.admin,
|
||||
editableIf: Users.is.admin,
|
||||
publish: true,
|
||||
autoform: {
|
||||
options: function () {
|
||||
var categories = Categories.find().map(function (category) {
|
||||
return {
|
||||
value: category._id,
|
||||
label: category.name
|
||||
};
|
||||
});
|
||||
return categories;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Meteor.startup(function(){
|
||||
// Categories.internationalize();
|
||||
// });
|
||||
|
||||
Categories.attachSchema(Categories.schema);
|
||||
|
||||
|
||||
Telescope.settings.collection.addField([
|
||||
{
|
||||
fieldName: 'categoriesBehavior',
|
||||
fieldSchema: {
|
||||
type: String,
|
||||
optional: true,
|
||||
autoform: {
|
||||
group: 'categories',
|
||||
instructions: 'Let users filter by one or multiple categories at a time.',
|
||||
options: function () {
|
||||
return [
|
||||
{value: "single", label: __("categories_behavior_one_at_a_time")},
|
||||
{value: "multiple", label: __("categories_behavior_multiple")}
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
fieldName: 'hideEmptyCategories',
|
||||
fieldSchema: {
|
||||
type: Boolean,
|
||||
optional: true,
|
||||
autoform: {
|
||||
group: 'categories',
|
||||
instructions: 'Hide empty categories in navigation'
|
||||
}
|
||||
}
|
||||
}
|
||||
]);
|
6
packages/nova-categories/lib/server.js
Normal file
6
packages/nova-categories/lib/server.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
import Categories from './modules.js';
|
||||
|
||||
import './server/publications.js';
|
||||
import './server/load_categories.js';
|
||||
|
||||
export default Categories;
|
|
@ -1,3 +1,5 @@
|
|||
import Categories from "../collection.js";
|
||||
|
||||
// Load categories from settings, if there are any
|
||||
|
||||
if (Meteor.settings && Meteor.settings.categories) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import Posts from "meteor/nova:posts";
|
||||
import Users from 'meteor/nova:users';
|
||||
import Categories from "../collection.js";
|
||||
|
||||
Meteor.publish('categories', function() {
|
||||
if(Users.can.viewById(this.userId)){
|
||||
|
|
|
@ -15,30 +15,7 @@ Package.onUse(function (api) {
|
|||
'nova:users@0.26.3-nova'
|
||||
]);
|
||||
|
||||
api.addFiles([
|
||||
'lib/collection.js',
|
||||
'lib/helpers.js',
|
||||
'lib/callbacks.js',
|
||||
'lib/parameters.js',
|
||||
'lib/custom_fields.js',
|
||||
'lib/subscriptions.js',
|
||||
'lib/methods.js',
|
||||
'lib/routes.jsx',
|
||||
// 'package-tap.i18n'
|
||||
], ['client', 'server']);
|
||||
api.mainModule("lib/server.js", "server");
|
||||
api.mainModule("lib/client.js", "client");
|
||||
|
||||
api.addFiles([
|
||||
'lib/server/publications.js',
|
||||
'lib/server/load_categories.js'
|
||||
], ['server']);
|
||||
|
||||
// var languages = ["ar", "bg", "cs", "da", "de", "el", "en", "es", "et", "fr", "hu", "id", "it", "ja", "kk", "ko", "nl", "pl", "pt-BR", "ro", "ru", "sl", "sv", "th", "tr", "vi", "zh-CN"];
|
||||
// var languagesPaths = languages.map(function (language) {
|
||||
// return "i18n/"+language+".i18n.json";
|
||||
// });
|
||||
// api.addFiles(languagesPaths, ["client", "server"]);
|
||||
|
||||
api.export([
|
||||
'Categories'
|
||||
]);
|
||||
});
|
||||
});
|
|
@ -2,6 +2,7 @@ import moment from 'moment';
|
|||
import Posts from "meteor/nova:posts";
|
||||
import Comments from "meteor/nova:comments";
|
||||
import Users from 'meteor/nova:users';
|
||||
import Categories from "meteor/nova:categories";
|
||||
|
||||
// import Email from 'meteor/nova:email';
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ Package.onUse(function (api) {
|
|||
'nova:posts@0.26.3-nova',
|
||||
'nova:comments@0.26.3-nova',
|
||||
'nova:users@0.26.3-nova',
|
||||
'nova:categories@0.26.3-nova',
|
||||
'nova:email@0.26.3-nova'
|
||||
]);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue