-
Notifications
You must be signed in to change notification settings - Fork 480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with passing inline params and losing outer context #129
Comments
I have observed the same issue. Here is an example of JSON, Dust, and output: //JSON
{
"id": 2345
"actions": {
primaryAction: "connect",
secondaryActions: [
"view",
"message",
"share"
]
}
} {! Dust template 1 !}
<div id="actions">
{#actions}
<div class="drop-button">
{?primaryAction}
{>switchTemplate level="pri" actionType="{primaryAction}"/}
{/primaryAction}
{?secondaryActions}
<ul class="secondary-actions menu">
{#secondaryActions}
<li>
{>switchTemplate level="sec" actionType="{.}"/}
</li>
{/secondaryActions}
</ul>
{/secondaryActions}
</div>
{/actions}
</div> {! switchTemplate.tl !}
{@select key="{actionType}"}
{@eq value="view"}
<a class="{level}" href="view/{id}">{actionType}</a>
{/eq}
{@eq value="connect"}
<a class="{level}" href="connect/{id}">{actionType}</a>
{/eq}
{@eq value="message"}
<a class="{level}" href="message/{id}">{actionType}</a>
{/eq}
{@eq value="share"}
<a class="{level}" href="share/{id}">{actionType}</a>
{/eq}
{/select} <!-- Dust output -->
<div id="actions">
<div class="drop-button">
<a class="pri" href="connect/2345">Connect</a>
<ul class="secondary-actions menu">
<li>
<a class="sec" href="view/"></a>
</li>
<li>
<a class="sec" href="message/"></a>
</li>
<li>
<a class="sec" href="share/"></a>
</li>
</ul>
</div>
</div> I have greatly simplified the actual use case for demonstration (so much that a switch is not even necessary in my example). What is important to note in the output is that {actionType} and {id} are not available, but only for the secondary actions (when looping through the array). |
Now tracked in the dust-helpers repo. my bad I added the ticket here |
this has nothing to do with select helper. The issue is with the partials taking params ( remove those params and the {id} is printed inside the template , even with select) Interesting case, not sure how we did not catch this with @jimmyhchan change
|
Initially reported as a select helper issue, but turns out not. Read below
The text was updated successfully, but these errors were encountered: