Questions tagged [scala-template]

71 questions
27
votes
2 answers

Scala: abstract type pattern A is unchecked since it is eliminated by erasure

I am writing the function that can catch exceptions of the certain type only. def myFunc[A <: Exception]() { try { println("Hello world") // or something else } catch { case a: A => // warning: abstract type pattern A is…
19
votes
5 answers

Is it possible to prettify scala templates using play framework 2?

Using Play Framework 2 I've noticed the rendered Scala HTML templates don't like indented @if or @for. So, for example, something like that:
    @for(test <- tests) {
  • @test.name
  • }
Will have extra unneeded spaces. To fix…
Romain Piel
  • 11,017
  • 15
  • 71
  • 106
10
votes
2 answers

How to print @ symbol in HTML with play framework (scala)

I am new to Scala and play 2.1 and I come from a PHP background. I am not able to print the @ symbol in HTML. I am getting the following error: not found: value Hotmail Here is my code: myname Please let me know how I…
user2822316
9
votes
4 answers

How to convert scala list to javascript array?

Is there a simpler way of doing this? $(document).ready(function () { var jsArray = [] @if(scalaList != null) { @for(id <- scalaList) { jsArray.push('@id'); } } ... }
Markku
  • 555
  • 1
  • 8
  • 15
8
votes
3 answers

How to allow default value selection in a @select helper?

In my form, I've defined a drop-down: @select( myForm("category_id"), options(Category.options()), '_label -> "Category", '_default -> "-- Choose a Category --", '_showConstraints -> false ) in my controller code: Form catForm =…
Manoj
  • 151
  • 3
  • 6
7
votes
2 answers

Scala Play framework: Binding form parameters to hidden fields

I am working with Play 2.0.4 and have the following form in my scala template. @fieldGroup(field: Field, className: String = "field") = {
Ragunath Jawahar
  • 19,513
  • 22
  • 110
  • 155
6
votes
1 answer

Print HTML in Scala template

I need to print some raw HTML in Scala template using newest Play Framework 2.1.1 Messages, variables, simple for loops etc. everything is working fine. But what if I need to to do some logic and print out raw HTML into template? @{ val courts =…
svenkapudija
  • 5,128
  • 14
  • 68
  • 96
4
votes
1 answer

Dynamic routes on Play Framework 2.1 templates

Taking the Java computer-database sample as a starting point in Play! 2.1 I'm developing a CRUD admin backend for about 20 models. The problem I'm facing is the repetition at the template level of the same functions over and over. I have tried to…
3
votes
1 answer

Play scala template with Angular got a warning about $index usage

I am using Play 2.3 with Scala 2.11.6 and Angular. I have a page template that contains an Angular application. However, if I use $index in a Scala template like this:
{{message}}
, I will…
angelokh
  • 9,426
  • 9
  • 69
  • 139
3
votes
0 answers

IntelliJ Code Style for Scala Templates

I'm having trouble with IntelliJ's auto-formatting for Scala templates (.scala.html files). I tried to modify the settings for HTML, but they don't seem to have any effect. It seems that when I have a pure HTML file, those settings work just fine. I…
Farzad
  • 1,770
  • 4
  • 26
  • 48
3
votes
1 answer

Play - inlining compiled LESS in scala template

I'm building a scala template which will be used to generate HTML for emails sent from a website. I'd like it to reuse the same LESS stylesheet I'm using on my website. For this, I'll need the compiled CSS to be available so I can inline it in the…
Chris Beach
  • 4,302
  • 2
  • 31
  • 50
3
votes
2 answers

Scala Template apply style to inputText's label [Play 2 HTML5 helper tag]

I am using scala template with input helper. The class attribute which i use applies style for the tag. How do i apply the style specific to the generated
Manoj
  • 151
  • 3
  • 6
2
votes
1 answer

How to iterate JsArray in Scala view page (value map is not a member of play.api.libs.json.JsArray)

I'm using JsArray on Scala view page, And I tried to iterate it using for loop, but throwing error on the Scala view page, Here I attached my code, how can I resolve it. @(jsonArrValue: play.api.libs.json.JsArray) …
Udayakumar
  • 145
  • 1
  • 1
  • 11
2
votes
0 answers

Define template method that dont need specification

I want to declare method in Scala which will have a parameter of type ProbabilisticClassifer from Spark MLlib. Here is its signature from github…
2
votes
1 answer

How do I inline form elements with Java Play and bootstrap?

I am new to the Java Play framework and I'm having a surprisingly difficult time to get my templates the way I want them. For example, I would like the case type and date fields to be on the same line here. Whenever I use inline, the fields…
1
2 3 4 5