EzDevInfo.com

jade4j

a jade implementation written in Java

Inlining Javascript in Jade while maintaining indentation

Is there a way to inline Javascript code in Jade script tag while maintaining indentation?

Removing indentation works but it makes code extremely difficult to read and modify.

Another option is to put Javascript in separate files, but then we need to pass a few parameters from the template to the script. Is it possible to do that in "separate files" approach?


Source: (StackOverflow)

iterate over a json object in jade

I have the following json object:

 var partners =[{ "name":"partnerx", "image": "imagex" }, { "name": "partnery", "image": "imagey" }]

I want to put into a ul object using jade and I tried:

ul#slides.swiper-wrapper
   mixin partners(name, image)
    li.swiper-slide
       img(src=#{image} , alt=#{name})

This is not working.


Source: (StackOverflow)

Advertisements

How to pass a mixin reference into another mixin as a mixin parameter in jade4j

What I want to achieve is as follows in jade4j -

mixin mixin_a()
  p This is mixin A

mixin mixin_b(mixin_reference)
  p This is mixin B
    +mixin_reference()

+mixin_b(mixin_a)

Here I am passing mixin_a as a reference in mixin_b and expecting that as a parameter.

But, when I try to do +mixin_reference() it says - mixin_reference is not defined.

Question: 1. What wrong I am doing in calling the mixin_reference? 2. What should be the best to achieve the same functionality? (reason is this, because I am expecting passed parameter mixin name in mixin_b as dynamic value.


Source: (StackOverflow)

submit post form values from jade to node js

I have such a form on my jade template

  form(action='/scheduler/save/' + project.Id, method='post')
                div.form-group
                    label.control-label.col-md-2 RecurringPattern
                    div.col-md-10
                        div#RecurringPatternControl
                div.form-group
                    label.control-label.col-md-2 StartDate
                    div.col-md-3
                        //input#StartDate.form-control
                        input(id='StartDate', class='form-control', value='#{project.StartDate} ', enctype="application/x-www-form-urlencoded")
                div.form-group
                    div.col-md-offset-2.col-md-10
                        input(type="submit", value="Save").btn.btn-lg.btn-success

and I want StartDate from input value in node js, I gotdiv#RecurringPatternControl from req.body but StartDate I can't get(( How can I fix that?


Source: (StackOverflow)

Passing objects between nodejs and jade

I have the following code in my server.js

  var cddata = [];
  body.rows.forEach(function(doc) {
  cddata.push([{id: doc.id, name: doc.key, text:doc.value.Time, group: 1}]);              
  });
  response.render('timeline', {cddata: JSON.stringify(cddata)});

and I have the following in my Jade view file

script(src='vis/dist/vis.js')        
link(rel="stylesheet", rel='nofollow' href="vis/dist/vis.css", type="text/css")

script.
    //alert(cddata);    
    var options = {};
    var data = new vis.DataSet(cddata);
    var container = document.getElementById('visualization');
    new vis.Timeline(container, data, options);

However, nothing related to the chart is rendered. I presume the object is not correctly passed to the jade file. Please help!

Also, is there a way to verify the incoming object in Jade? Alerts dont seem to work. thanks


Source: (StackOverflow)

How to use Jade or Handlebars template engine with Grails 3

I need some template engine working on both sides - frontend and backend. I did not succeed in installing any of

  1. https://grails.org/plugin/grails-jade
  2. https://grails.org/plugin/handlebars

Also I have find neither of them on bitray. I see that many plugins for Grails 3 are outdated. Is there a way to compile it with grails 3?


Source: (StackOverflow)

How to i18n in jade4j?

How to output internationalized text in Jade4j please?


Source: (StackOverflow)

play! 2.1.3 scala app/views/*.jade do not get included as part of play dist [closed]

My issue is that when I, run 'play dist', unzip the dist and look through the jars in lib, I can see that my app/views/*.jade files are not getting included. How do I tell play to include these jade files as part of my views??

Thanks!


Source: (StackOverflow)