442 questions
0
votes
0
answers
17
views
Strange behavior and rendering on model.set() command
At the beginning, I've added a property to the model:
this.model = new Model()
this.model.set("level","test")
In another routine, I've to refresh this "level" property ...
1
vote
1
answer
58
views
How to get into another collections with foreign keys
I have these collections (books,book_genres,genres,books)
my book Schema is like that
var bookModel = function () {
var bookSchema = mongoose.Schema({
_id: mongoose.Schema.Types.ObjectId,
...
1
vote
0
answers
59
views
Access properties of an object via Dust.js after running JSON Parse filter
Is there any way to access properties of an object that was transformed into JSON through the jp (JSON parse) filter of Dust.js?
{
"response": {
"services": [
...
0
votes
0
answers
97
views
Error Fetching data node js from postgreSQL database show on web html
An TypeError occurred while I was Fetching data from the postgreSQL database Where do I have errors and I need help!
const { ENGINE_METHOD_ALL } = require('constants');
var express = require('express')...
0
votes
3
answers
65
views
How do I refactor this query to not have so many variables?
I have a form capturing information from a registration, it is a dust layout with html form, part of a react app:
app.post('/add', function(req, res) {
// PG Connect
const { Pool, Client } = ...
0
votes
1
answer
87
views
Pass in the logical negation of a boolean to a partial template in dust
I Have a partial template that takes a boolean, and I want that boolean to be a negation of a reference I have. So if my reference is true I want the value passed in to be false. Any way I can do this ...
0
votes
3
answers
156
views
Stop VSCode from "greening out" my Dust / HTML code after "#" symbol
I have some Dust templates that I'm looking at in VS Code. On 1 computer, if there is a "#" symbol, the code after it turns green as if it were commented out.
For instance:
<div id="...
1
vote
0
answers
132
views
Gulp task overriding previous task's output
I have a gulpfile that defines two tasks: 'english' and 'italian'.
They actually return several subtasks, one for the website pages, one task for each team member HTML snippet and one for client side ...
1
vote
0
answers
68
views
Is it possible to use dynamic keys in dust js?
my .properties file (test.properties):
something.10.header=helloWorld
something.12.header=holaWorld
my.dust file: (here 'id' is the dynamic value ; it can be either 10 or 12 based on which the ...
1
vote
1
answer
145
views
Dust.js and helmet - not rendering HTML
I have a Dust.js template and want to use it as async mode (so stream), to load my stuff.
It works very well, but when I add use(helmet()) it does not show as html anymore, just as plain text
I tried ...
1
vote
0
answers
96
views
How to pass html to sub-template in dust.js
In my dust file I have the following line...
{>"form-row-text-input" nLabel="My name is {name}" nValue=name /}
I am passing a sub-template name which is a string (first name and last name). I ...
0
votes
1
answer
175
views
Loop on Dust js to iterate through array
I want to iterate through array file_url and file_name , this way works:
<div class="u-cf">
<a href="{Api.file_url[0]}">{Api.file_name[0]}</...
0
votes
1
answer
163
views
Dustjs - Check condition regarding ALL items in an array with dustjs template
So I'm having trouble with a Dust.js template.
Suppose I have these example object models:
var lifeStory = [{
"LifeEvent": "Birth",
"year": "1963"
},
{
"LifeEvent": "...
1
vote
1
answer
107
views
KrakenJs with Dust Template looping through object Error
I should Have got the else part but I am getting the error: Expected end tag for cart.items but it was not found. At line : 21, column : 35. I don't know where is the problem everything is fine may ...
1
vote
1
answer
263
views
Dust.js Two way data binding
I have a dropdown which is pretty simple.
<div>
<select id="optionDropDown">
<option value="volvo">{@pre type="content" key="dropdown.option1"/}</option>
&...
0
votes
1
answer
252
views
Dust iterate over array
I am using Kraken.js, dust, mongoose. I have the following object that I get from MongoDB with mongoose.
artist = {
"_id" : ObjectId("xxxxxxxx"),
"first_name" : "myName",
"last_name" : "...
0
votes
1
answer
104
views
Accessing outer AND inner indexes inside nested arrays at the same time
I've got nested arrays such as:
"outer" : [
{
"inner": [
{},
{}
]
},
{
"inner": [
{},
...
0
votes
1
answer
178
views
Dust template unable to render page and display flash message on adding ,update,delete new items
VError: Problem rendering dust template
"C:\Projects\06_Bookstore\TekBooks\public\templates\manage\books\index.dust":
Path must be a string.
Received Chunk {
the problem appears as shown ...
1
vote
1
answer
262
views
Regex comparison in Dust
Is there a way to use regex expression comparison using dust template.
eg:
@select key="{notes}"}
{@eq value="s+"}
sample: {notes}
{/eq}
{@default}
{...
0
votes
1
answer
52
views
How do I make accounts system with Dust?
I really hate php, so I've looked up for node.js render engines and found Dust, and it is really what I am looking for with postgres. However, I haven't found something similar to $_SESSION of php. Is ...
0
votes
0
answers
59
views
how to call popup function from jsp to dust.js
i have done with popup function but do not know how to call it in dust template from jsp .
<a id="disclaimer" onClick="openPopup()">Disclaimer</a>
<script>
function openPopup() {...
0
votes
1
answer
204
views
Render nested array of Hashmaps with the usage of "@select" in .dust file
I have JSON object containing the array of Hashmaps as:
{ "someparentkey": {
"arraykey": [
{
"uniquekey": "key1",
...
0
votes
1
answer
251
views
If/else within loop with Dust.js
I am attempting to assign different values within a loop depending on a value within the loop.
For the following input:
{
"products":[
{
"id":1,
"name":"Ruby on Rails Tote",
"...
0
votes
1
answer
195
views
Dust.js Template Not Honoring Conditional Exists
I am running into an interesting issue where my Dust.js template is not honoring an exists conditional.
My data looks like this:
{"guaranteedHistory": [
{
"depositDate": "2017-08-31T00:00:...
4
votes
3
answers
17k
views
Regex remove json property
I'd like to remove a stringfied json's property based on its key wherever it is, whatever its value type is. But removing it only if its value is a string and its on the root level of the object would ...
0
votes
1
answer
243
views
Render dust tag as plain html
I am making a documentation page in dust.js.
Part of the documentation is to show the partial code without it being rendered.
I have tried to make a helper for this
{dust}
{@partial}...{/...
1
vote
1
answer
684
views
How do I write an 'AND' condition in dust?
In my dust file, I have something like this :
<div class="{?cond1}hidden{/cond1}" role="alert">
{@localize key="warning" eng="Warning: Not allowed" /}
</div>
I would like to make the ...
0
votes
2
answers
464
views
how to append row index value to ID of td
This is my code:
<tbody>
{#participants}
<tr>
<td id="id">{.fullName}</td>
</tr>
{/participants}
I am writing this code in .dust file. I want to append row index ...
0
votes
0
answers
111
views
how to open dustjs template with extension '.dust'
I have some files with extension '.dust' which is clearly DustJs templates. Somehow I managed to call them in my HTML code but it throws error. So can somebody tell me the step by step procedure to ...
0
votes
1
answer
39
views
dustjs, duplication check while looping
While templating, what is the way to check if an array has same value?
I would like to skip if the array has duplicate value.
[
{name: 1},
{name: 3},
{name: 3},
{name: 4}
]
Sould out 1,3,4 ...
0
votes
1
answer
231
views
dust template iterate a list of map
just wondering how to iterate a list of map reading from config file, for example, saving as a list of map List<Map<String, String>>
<list>
<map>
<entry key="...
1
vote
1
answer
312
views
array of json objects in dustjs template format?
I want to render the json data coming from postgress on webconsole through dustjs.
but my data is like(without object key)
[
{
"a": "123a",
"b": "fdhd",
},
{
"a": "123a",
"b": ...
0
votes
1
answer
203
views
Bootstrap Collapse is not working with dust
I am very new to express js and bootstrap.
I am using Dust view engine. Everything was working fine except the collapse functionality.It is not working.
My layout.dust file include jquery and ...
0
votes
1
answer
34
views
are dust helper dependencies bundled within compiled templates?
I'm wondering how helper dependencies are managed in compiled dust templates, specifically relating to being used on the client -- is the helper method bundled with the compiled dust template? What ...
0
votes
1
answer
113
views
Backbone-forms with custom Dust template
I'm having issues understanding how to display customized backbone-forms with Dust.js template.
The relevant part of my code are here.
// Index.jx
<head>
[...]
<script type="text/...
1
vote
1
answer
225
views
Dust.js - partial extend base
I use NodeJS as engine to dust.
I have problem with partials. I think that it is possible, what I want.
Here is my index.dust :
<!DOCTYPE html>
<html lang="pl">
<head>
<meta ...
2
votes
1
answer
593
views
Cannot render Leaflet tilelayer
I'm trying to use Leaflet to generate an interactive map. However I'm having some trouble rendering the tilelayer. I'm using dustjs to render the HTML, which is only giving me a blank map, like so:
...
1
vote
2
answers
274
views
how to solve anonymous array?
this is my php sql code
//fetch table rows from mysql db
$sql = "select * from tbl_sample";
$result = mysqli_query($connection, $sql) or die("Error in Selecting " . mysqli_error($connection));
/...
0
votes
1
answer
80
views
Dustjs OR helper
How to write below statement using dust helper?
{@eq key="device" value="windows || Linux"}
Your system is Windows or Linux based.
{:else}
Your system is MAC based.
{/eq}
0
votes
1
answer
48
views
Can I use the same dust.js module with different partials?
I'm trying to use dust.js templating powers to render some html. I've made a model that renders a button and takes as partials the href and the text.
{>"modules/Button/Button.tl"/}
{<...
0
votes
1
answer
94
views
Add a partial inside a partial in Dust
I need to pass values to a dust template in the following manner:
<div class="o-outer">
{>"atoms/button" text="{+filteredClass/}"/}
</div>
{<filteredClass}
{@customFilter ...
1
vote
1
answer
356
views
Dust.js do not add separator after empty values in loop
I have an array of values, for instance:
{
"languages": [
"",
"CSS",
"HTML",
"",
"JavaScript",
"Dust",
"",
""
]
}
Expected output:
CSS, HTML, JavaScript, Dust
...
0
votes
1
answer
89
views
Dust onLoad context always undefined
I am working with dust.js on a server side application. I have some code that looks like this:
dust.onLoad = function(tmpl, ctx, cb) {
console.log(ctx);
};
...
dust.context(null, { layout: this....
0
votes
1
answer
1k
views
How to display message using connect-flash and express-messages on .dust file on Node
I'm using Nodejs and Expressjs and Kraken, I need to display message when added a product on index but I tried many time for to config but messages still not appear as I expect. Here is my config.js:
...
0
votes
2
answers
58
views
Why is stack.head prefix required to access local context in Dust.js?
I have a strange issue with Dust.js contexts. Previously, I would pass the view model along as a plain old JavaScript object, e.g. res.render('page', { something: [1,2,3] } etc. When doing that, I ...
0
votes
1
answer
173
views
Dust js partials / child templaes output undefined
I'm using nwjs and dust.js. Parent templates work as expected, but if I try to load a child (partial) template the output is undefined. Am I missing something to get child/partial templates working? ...
1
vote
2
answers
365
views
Use dust.js in common with vue.js
How can I use vue.js with the dust template engine? Both are using {{}} as placeholders, are there any options to say dust: Hey, this part is especially for vue?
I got no idea since I haven't had ...
0
votes
1
answer
197
views
How can I stop DustJS converting entities back to normal characters?
To replicate my problem, go here, and please paste this code into corresponding sections:
Dust Template:
{title|s}
Data:
{
"title": "<script>alert('yo');</script>"
}
...
0
votes
1
answer
247
views
dustjs html escape output from dusthelper
I want to html escape the content from @pre. Output from {@pre key="property-key" type="content"/} is this contains " and ' in sentence. I want this to be escaped as this contains & #34; and & ...
0
votes
1
answer
104
views
Dust templating, check if iteration is divisible by a number
Trying to check to see if an iteration is divisible by a number, and wrap it in a <div> if it is, but I can't seem to get it to work. Is there even a way to do this with Dust?
{#sitemap.items}
...