dustjs icon indicating copy to clipboard operation
dustjs copied to clipboard

@ helper's don't work

Open monsterlane opened this issue 7 years ago • 5 comments

Is this nested structure supposed to work?

feed.dust

{#activities}
	{@select key=category}
		{@eq value="event"}{>"views/snapshot/event"/}{/eq}
	{/select}
{/activities}

event.dust

<div class="row activity {name} {category} reset-lineheight">
	<div class="col-xs-1">
		<span class="svg {icon_class}"></span>
	</div>

	<div class="col-xs-11">
		<header>
			<i class="text-muted text-note">{@gt key=counter value="1" type="number"}{strings.last_time} {/gt}{formatted_datetime}</i>
		</header>
	</div>
</div>

Inside the partial event none of the @ helpers function correctly. If I output {counter} or do a context dump the correct value appears. In case it was a type issue I added a string property with a static value and did an @eq test on it which also failed to produce output. {:else} blocks are also not displayed it's as if the entire condition is stripped somehow.

Is this a bug? If I change the @select in the parent view to @eq checks the @ helpers inside event do function as you'd expect them to. The reason it's an @select is because there are about 10 different views depending on the value of category.

monsterlane avatar Sep 19 '17 12:09 monsterlane

I have similar issue with Node.js 8.8.1 version

    <div>Hello World</div>
    {@eq key="true" value="true"}
        <div>Hello 1</div>
        {:else}
        <div>Hello 2</div>
    {/eq}

{@eq} is not executing at all when I switch to Node.js 6.10.2 ... things just work fine.

hegdeashwin avatar Dec 06 '17 18:12 hegdeashwin

We are facing the same issue as mentioned by @hegdeashwin @monsterlane what is the node version you are using? Also, are you using dust on server-side templating?

snehasis419 avatar Dec 07 '17 06:12 snehasis419

yeah. It's blocking us to migrate to node 8

kumarrishav avatar Dec 07 '17 06:12 kumarrishav

@kumarrishav have fixed the node 8 bug here ... can anyone please help us to merge the PR?

hegdeashwin avatar Dec 07 '17 14:12 hegdeashwin

I'll give it a look :)

On Thu, Dec 7, 2017, 6:30 AM Ashwin Hegde [email protected] wrote:

@kumarrishav https://github.com/kumarrishav have fixed the node 8 bug here https://github.com/linkedin/dustjs-helpers/pull/146 ... can anyone please help us to merge the PR?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/linkedin/dustjs/issues/776#issuecomment-349983332, or mute the thread https://github.com/notifications/unsubscribe-auth/ABVa7BNlcq0SmmPA3slBN3IYkOeCb0CKks5s9_aQgaJpZM4PcVOO .

--

Sent while mobile

sethkinast avatar Dec 07 '17 17:12 sethkinast