dust-helpers

Function call and checking results in DustJs

心已入冬 提交于 2019-12-23 12:23:01
问题 I am combining connect-roles with dust template ejs template have something like this syntax <% if (userCan('impersonate')) { %> <button id="impersonate">Impersonate</button> <% } %> and that in jade if userCan('impersonate') button#impersonate Impersonate How to do this in dust? {@eq key=userCan('edit data') value="true" } <td><a href='/assets/edit/{.ID_ASSET}'>Edit</a></td> <td><a href='/assets/delete/{.ID_ASSET}'>Delete</a></td> {:else} {/eq} This code get me an error Wed, 06 Jan 2016 16

How to run or condition in Dust template

只谈情不闲聊 提交于 2019-12-06 06:57:13
问题 I am using "dustjs-helpers": "1.6.0" , with "dustjs-linkedin": "^2.6.0" . In my template I need to check an OR condition like if( cherry === true || berry === true) path/to/template1/ else path/to/template2/ How do I accomplish this with the Dust helpers? 回答1: Because you're testing two different variables, you'll need two different truth tests. You can either put this logic into your template, or into a small helper. I'll show you both ways. Let's assume that your context looks like this: {

How to run or condition in Dust template

狂风中的少年 提交于 2019-12-04 14:03:36
I am using "dustjs-helpers": "1.6.0" , with "dustjs-linkedin": "^2.6.0" . In my template I need to check an OR condition like if( cherry === true || berry === true) path/to/template1/ else path/to/template2/ How do I accomplish this with the Dust helpers? Because you're testing two different variables, you'll need two different truth tests. You can either put this logic into your template, or into a small helper. I'll show you both ways. Let's assume that your context looks like this: { "cherry": false, "berry": true } Template method This method requires dustjs-helpers >= 1.6.2 You'll have to