Questions tagged [twirl]

The Play framework Scala template engine repackaged for stand-alone use.

147 questions
4
votes
0 answers

sbt intellij twirl templates

I am not sure how to get twirl templates to work with Intellij IDEA 14 My build.sbt: libraryDependencies += "com.typesafe.play" % "twirl-api_2.11" % "1.1.1" My text template: @(date: java.util.Date) hello world My call to render: …
user2302244
  • 843
  • 2
  • 11
  • 27
4
votes
2 answers

How to resolve reference to twirl generated template class in Scala-IDE?

Using twirl for generating template class. Everything is working fine with sbt and the webpages are rendering. I am using Scala-IDE for development. And in the Scala-IDE the reference to the template class i.e. "html.test()", test is the template…
Biswanath
  • 9,075
  • 12
  • 44
  • 58
4
votes
1 answer

Check Html fragment nullity with Play Framework 2.3.0

I have a tag in my application with the following structure : @( columns: Integer )(header: Html)(body: Html) @if(header != null) { @header } …
c4k
  • 4,270
  • 4
  • 40
  • 65
3
votes
1 answer

Integrating Play Framework and Twirl Templates with Webpack and React

I am currently migrating a Play Framework application with a view composed entirely of Twirl templates into one with a view composed of a mix of Twirl and React. I have written a PlayRunHook to integrate Webpack with Play's build process, and the…
Vidya
  • 29,932
  • 7
  • 42
  • 70
3
votes
1 answer

Play framework 2.5 scala i18n

I've followed the documentation in https://www.playframework.com/documentation/2.5.x/ScalaI18N and translations inside controllers works fine. However, I need translations in Twirl templates. With implicit messages and/or using…
Henrique Gonçalves
  • 1,572
  • 3
  • 16
  • 27
3
votes
1 answer

Play Framework - how to walk tree of JsonNode in view?

Hi I am trying to display nested JSON data in my view, similar to how it appears in the Advanced REST Client when you get a response from an API. I found this question which basically asks the same thing I am asking; however, I want to display the…
KJ50
  • 765
  • 1
  • 10
  • 27
3
votes
1 answer

Can't concatenate play.twirl.api.Html objects with play 2.3

I am trying to migrate a rather large project from play framework 2.2 to 2.3. In the project we have some helpers that do something like this: import play.api.templates.Html; ... private object HtmlHelper { ... // Given a sequence of Htmls,…
Paul Sachs
  • 905
  • 2
  • 11
  • 22
3
votes
2 answers

Load twirl template dynamically

In my Scala project I use Twirl template engine. Template files structure is duplicated for russian and english languages so for example I have the following two paths: en.Send.txt.MonoEnsure and ru.Send.txt.MonoEnsure In my code I want to be able…
src091
  • 2,807
  • 7
  • 44
  • 74
2
votes
1 answer

javascript variable not defined when inline

Background: I am using PlayFramework to create a webapp (workflow) system which uses the Twirl template engine (scala based) to create my views. Problem: I need to store JavaScript variables inside of my template (which renders HTML), where in a…
CybeX
  • 2,060
  • 3
  • 48
  • 115
2
votes
1 answer

Import part of a file in Twirl [PlayFramework]

I'm using PlayFramework and Twirl to generate some classes using swagger files. I'm trying to split a big file into small pieces and making it more maintainable. But when the file is rendered the tag with the content from the other file is…
2
votes
2 answers

Calling a function as a parameter in a template call in Play

In Play/Scala; I am confused as to why this won't compile: @(tabNames: Seq[String]) @isActive(idx: Int) = { @if(idx < 1) { "active" } else { "" } }
2
votes
0 answers

Play framework Scala Controller method called twice

I'm facing an issue while calling a Play Scala controller method with a large amount of data. I have file upload method which takes 2 uploaded files and processes them. If the file size is big, the controller method is getting called twice. If the…
Rajashree Gr
  • 519
  • 1
  • 9
  • 18
2
votes
1 answer

(Play Framework) Suitable IDE to edit Twirl templates?

I'm editing some fairly long Twirl template html files in Intellij IDEA, but it's basically like a text editor without function/variable prompt or even the correct keyword highlighting. Curious to know if there's a plugin/editor that will make my…
Andy
  • 115
  • 1
  • 6
2
votes
1 answer

PlayFramework 2.5 Templates - Twirl Dependency Injection

since PlayFramework is moving like year from global state using dependency injection and none is probably able there to rewrite guides/tutorials I can not find answer to my question anywhere. Since Play 2.5 you have to stay away from global state…
2
votes
0 answers

scala twirl autocomplete in intelliJ outside play

I'm using scala twirl templating outside the play framework (using akka-http instead) for generating email bodies, but it seems like intelliJ has no idea how to parse the twirl files (they are basically plain text files). I would love to see some…
Ákos Vandra-Meyer
  • 1,890
  • 1
  • 23
  • 40
1
2
3
9 10