Writing play2 form helper in scaml

39 views
Skip to first unread message

Charles Gunawan

unread,
Sep 25, 2013, 12:36:34 AM9/25/13
to sca...@googlegroups.com
Hi,

How do we write this play2 template in scaml?

@helper.form(call) {
  <fieldset>
    @helper.inputText(...)
  </fieldset>
}

The problem is that play2 template engine converts the html inside the block into play.api.templates.Html. So that code will be converted into

helper.form(call, { new Html(new StringBuilding("<fieldset>" + helper.inputText(...) + "</fieldset>")) })

- -

unread,
Sep 25, 2013, 3:28:25 PM9/25/13
to sca...@googlegroups.com
haha, not for me!!! I haven't worked out since we did mud hero :(


--
You received this message because you are subscribed to the Google Groups "Scalate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scalate+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Charles Gunawan

unread,
Sep 30, 2013, 7:00:26 AM9/30/13
to sca...@googlegroups.com
To answer my own question, I need to wrap the => Unit block inside a function that converts it into play.api.templates.Html value

import play.api.templates.Html
import org.fusesource.scalate.RenderContext.{ capture => scalateCapture }

def capture(body: => Unit): Html = new Html(new StringBuilder(scalateCapture(body))) 
Reply all
Reply to author
Forward
0 new messages