File Attribute For Orion
The file attribute is perfect to save files or images in entities or the dictionary.
It's integrated with orionjs:filesystem
The file attribute is a object. It has the following attributes:
-
url
String. The url of the uploaded file. -
fileId
String. The id of theorionjs:filesystem
file.
Getting Started
meteor add orionjs:file-attribute
Examples
Adding to the dictionary
1orion.dictionary.addDefinition('logo', 'images', 2 orion.attribute('file', { 3 label: 'Site Logo', 4 optional: true 5 }) 6);
Using in templates
1{{ htl }}template name="example"{{ htr }} 2 {{ ddl }} dict 'logo.url' {{ ddr }} 3{{ htl }}/template{{ htr }}
Adding to entities
1orion.addEntity('posts', { 2 title: { 3 type: String, 4 label: "Title", 5 }, 6 image: orion.attribute('file', { 7 label: 'Image', 8 optional: true 9 }), 10}, { 11 sidebarName: 'Posts', 12 pluralName: 'Posts', 13 singularName: 'Post', 14 /** 15 * You have to put here what do you want to show in 16 * the entity index page. 17 * It uses aldeed:tabular. Check the documentation 18 * https://github.com/aldeed/meteor-tabular/ 19 */ 20 tableColumns: [ 21 { data:'title', title: 'Title' }, 22 orion.attributeColumn('file', 'image', 'Image'), 23 ] 24});