Autoform with CollectionFS for meteor -


i'm using aldeed:autoform aldeed:collection2 cfs:autoform cfs:standard-packges cfs:gridfs

daycares = new mongo.collection('daycares');  daycares.attachschema(new simpleschema({   daycarename: {     type: string,     label: "daycare name",     max: 100   },   address: {     type: string,     label: "address",     max: 100   },   position: {     type:[number],     optional: true,     decimal: true   },   yib: {     type: number,     label: "years in business"   },   contactname: {   type: string,   label: "contact name",   max: 100   },   phone: {     type: number,     label: "phone number"   },   licensed: {     type: boolean,     label: "licensed?"   },   description: {     type: string,     label: "description"   },   website: {     type: string,     label: "website",   },   imageid: {     type:string   },     userid: {     type: string,     optional: true,     autovalue: function () {       return this.userid;     }   } }));  images = new fs.collection('images', {   stores: [new fs.store.gridfs('imagesstore')] }); 

then html:

  {{#autoform collection="daycares" id="insertdaycareform" buttoncontent="create"}}     <fieldset>         {{> afquickfield name="daycarename"}}         {{> afquickfield name="address"}}         {{> afquickfield name="yib"}}         {{> afquickfield name="contactname"}}         {{> afquickfield name="phone"}}         {{> afquickfield name="licensed"}}         {{> afquickfield name="description" rows=4}}         {{> afquickfield name="website"}}         {{> afquickfield name="imageid" type="cfs-file" collection="images"}}      </fieldset>     <button type="submit" class="btn btn-success">create</button>     {{/autoform}} 

but when try show single page item, i'm not sure how show image. followed instructions on github tea.

this html:

<template name="singledaycare">   {{daycarename}}   {{address}}   {{yib}}   {{contactname}}   {{phone}}   {{description}}   <img src="{{imageid}}" /> </template> 

any great!

a helper should trick:

template.singledaycare.helpers({   imageurl: function(){     return images.findone({_id: this.imageid}).url();   } }); 

assuming images in images collection.

then in html:

<img src="{{imageurl}}" /> 

Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -