mirror of
https://github.com/vale981/Vulcan
synced 2025-03-10 12:36:39 -04:00

* Revert "add note link to issue in collection2 on mutation insert, remove debug console logs on mutation edit" This reverts commit7a15103de7
. * Revert "node simpl-schema + collection2-core: fix vote by specifying the right type of the array (dont use blackbox in the end!)" This reverts commite894c3224c
. * Revert "add graphql date type (fix problem with node simple schema), fix an update bug on date picker, add edit check on custom post item, add `blackbox: true` for arrays field (validation problem with simple-schema)" This reverts commit9d84fbec98
. * Revert "use node `simpl-schema` by aldeed to replace `meteor/aldeed:simple-schema` ; use the meteor collection2 core package as recommended" This reverts commit016935f4fa
. * revert before node-simple-schema, fix obj.hasOwnProperty undefined error thrown by simple-schema & collection2 * CustomPostsItem: check on renderActions; withDocument/List: pollInterval 20seconds by default; DateTime form component enhancement + GraphQLDate type
49 lines
1.3 KiB
JavaScript
49 lines
1.3 KiB
JavaScript
import Posts from "meteor/nova:posts";
|
|
|
|
Posts.addField(
|
|
{
|
|
fieldName: 'categories',
|
|
fieldSchema: {
|
|
type: [String],
|
|
control: "checkboxgroup",
|
|
optional: true,
|
|
insertableBy: ['members'],
|
|
editableBy: ['members'],
|
|
viewableBy: ['guests'],
|
|
form: {
|
|
noselect: true,
|
|
type: "bootstrap-category",
|
|
order: 50,
|
|
options: function (formProps) {
|
|
|
|
// catch the ApolloClient from the form props
|
|
const {client} = formProps;
|
|
|
|
// get the current data of the store
|
|
const apolloData = client.store.getState().apollo.data;
|
|
|
|
// filter these data based on their typename: we are interested in the categories data
|
|
const categories = _.filter(apolloData, (object, key) => {
|
|
return object.__typename === 'Category'
|
|
});
|
|
|
|
// give the form component (here: checkboxgroup) exploitable data
|
|
const categoriesOptions = categories.map(function (category) {
|
|
return {
|
|
value: category._id,
|
|
label: category.name
|
|
};
|
|
});
|
|
|
|
return categoriesOptions;
|
|
}
|
|
},
|
|
// publish: true,
|
|
// join: {
|
|
// joinAs: "categoriesArray",
|
|
// collection: () => Categories
|
|
// },
|
|
resolveAs: 'categories: [Category]'
|
|
}
|
|
}
|
|
);
|