Skip to content

Instantly share code, notes, and snippets.

@pcorey
Last active August 29, 2015 14:15
Show Gist options
  • Save pcorey/99507eda6f28f8cc3bc0 to your computer and use it in GitHub Desktop.
Save pcorey/99507eda6f28f8cc3bc0 to your computer and use it in GitHub Desktop.
Editable Categories in Meteor's Orion
orion.dictionary.addDefinition('categories', 'basic', {
type: [String],
label: 'Categories'
});
orion.addEntity('articles', {
title: {
type: String,
label: 'Title'
},
category: {
type: String,
allowedValues: function() {
return orion.dictionary.collection.findOne()['categories'];
},
autoform: {
options: function() {
return orion.dictionary.collection.findOne()['categories'].map(function(value) {
return {
value: value,
label: value
};
});
}
},
optional: false,
label: 'Category'
},
content: orion.attribute('froala', {
label: 'Content',
optional: false
})
}, {
icon: 'bookmark',
sidebarName: 'Articles',
pluralName: 'Articles',
singularName: 'Article',
tableColumns: [
{
data: 'title',
title: 'Title'
},
orion.attributeColumn('froala', 'content', 'Preview')
]
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment