Skip to content

Instantly share code, notes, and snippets.

@vybs
Created January 17, 2012 02:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vybs/1624114 to your computer and use it in GitHub Desktop.
Save vybs/1624114 to your computer and use it in GitHub Desktop.
Reuse partials in dust with override contexts
<form class="standard-form" id="{name}_id" name="{name}" method="{method}" action="{action}">
<fieldset>
<p class="task-content">Worked from</p>
<ul>
{! showStartDate !}
<li class="start-date" style="display:none">
{#startDateMonth choose="Choose"}
{>singleSelect/}
{/startDateMonth}
{>inputText:startDateYear/}
</li>
{! showEndDate !}
<li class="end-date" id="date-past">
{#endDateMonth choose="Choose"}
{>singleSelect/}
{/endDateMonth}
// reuse the same partial with a different context in the JSON
{>inputText:endDateYear/}
</li>
</ul>
</form>
Partial for input text :inputText.dust
-----------------------------
<input type="text" id="{.id}" value="{.value|s}" name="{.name}" {.extras} {+formExtras/}/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment