Last active
August 29, 2015 14:15
-
-
Save pcorey/99507eda6f28f8cc3bc0 to your computer and use it in GitHub Desktop.
Editable Categories in Meteor's Orion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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