If you are tired of writing annoying events and helpers every time you want to allow the user to modify a document or session variable on the client! use this package.
See the examples to see the use cases:
{{>InputHelper session="hello" class='form-control'}}
{{>InputHelper attribute="foo" document=this collection="Foobars" class='form-control'}}
{{>InputHelper attribute="foo" document=this type='date-time' collection="Foobars" class='form-control'}}
On input change event the attribute of the document will be modified. In the example the attribute "foo" will be modified on the document this of the collection Foobars.
{{>InputHelper session='a-session-example-name' options=options class='form-control'}}
Options needs to be or needs to return (in case it is a helper) an array of the type :
[
{name : 'choose fo', value : 'fo'},
{name : 'choose bar', value : 'bar'},
....
]
{{>InputHelper session='a-session-example-name' select=options class='form-control'}}
Options needs to be or needs to return (in case it is a helper) an array of the type :
[
{name : 'choose fo', value : 'fo'},
{name : 'choose bar', value : 'bar'},
....
]
important! You need to declare an App.collections object and assign the mongo collections your declare client-side. i.e. App.collections.Foobars = new Mongo.collection('foobars').
attribute | The attribute you want to change on the document. Uses mongodb selector. |
document | the document object you want to modify |
collection | the collection the document belongs to |
class | classes to add to the input field |