Allow passing variables defined by assign
to include_template
.
#141
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change allows using the
assign
helper fromhandlebars_misc_helpers
to pass variables into templates rendered withinclude_template
. Theassign
helper modifies theRenderContext
and previouslyinclude_template
would use theContext
when rendering the template. The change attempts to use theRenderContext
with a fallback to use theContext
if noRenderContext
exists.Note that this change does not address
handlebars_misc_helpers
#65. Theassign
helper clones theContext
and overwrites theRenderContext
on every call meaning that only variables defined by the most recentassign
call will be available.Resolves #134.
@SuperCuber, thanks for your time so far. I've put this PR together assuming no changes are made in
handlebars_misc_helpers
. I didn't add any tests because external test template files would be needed and wasn't sure how you would want those organized. Let me know if you want me to revisit this. I'm also not sure how long you want to wait on feedback on davidB/handlebars_misc_helpers#65.