So I'm having trouble with a Dust.js template.
Suppose I have these example object models:
var lifeStory = [{
"LifeEvent": "Birth",
"year": "1963"
},
{
"LifeEvent": "marriage",
"year": "1963",
"month": "Jul",
"day": "15"
},
{
"LifeEvent": "death"
}
];
// or
var lifeStory = [{
"LifeEvent": "Birth"
},
{
"LifeEvent": "Baptizm"
},
{
"LifeEvent": "marriage"
},
{
"LifeEvent": "death"
}
];
and I have this dustjs template:
{#lifeStory}
<div class="myRow">
<div class="DateColumn">
{year} - {month} - {day}
</div>
<div class="lifeEventColumn">
{LifeEvent}
</div>
</div>
{/lifeStory}
I want to hide the DateColumn if I don't have any year, month and day properties if my array. If only one item in the array has has date information I want to show the DateColumn for all rows.
I'm new to dust but am thinking this may require writing a custom dust helper. Any help would be great.
THANK YOU!!!!