mizzao / meteor-sharejs

Meteor smart package for transparently adding ShareJS editors to an app
MIT License
225 stars 53 forks source link

Setting docid through the Spacebars/Blaze helper #47

Closed aamdani closed 9 years ago

aamdani commented 9 years ago

I'm unclear as to how I can pass in, for example, the document id if it's stored in a collection via data context or programmatically.

For example:

<div>
    {{> sharejsText docid="{{this.active_document._id}}" id="editor" }}
</div>

How can I have a variable holding the document ID and send it into the sharejsText helper? I tried enclosing it in triple braces to ensure it wouldn't be converted to a string literal, but that didn't assist since it was already inside of a helper.

Reviewing the codebase (I haven't learned yet to parse CoffeeScript effectively) it seems that there's a ReactiveVar that's created that's holding the document id. Should I try updating that instead?

Apologies if this is a handlebars/spacebars question rather than a sharejs question.

aamdani commented 9 years ago

Sorry, this was purely incorrect usage on my part.

For anyone else who gets confused or has problems, first ensure the data context you're working with prior to calling the Spacebars include is correct. Then, you don't need quotes or braces - the include will be context-aware.