Playframework Twirl @form 'class

128 Views Asked by At

I am trying to learn how tu use Play and ebean by using the java examples given by the Play documentation.

In the play-java-ebean-example I'd like to add a new button in the views\editForm.scala.html so I just wanted to copy this part :

@form(routes.HomeController.delete(id), 'class -> "top-right") {
   @CSRF.formField
   <button class="btn btn-danger" type="submit">Delete this computer</button>
}

into this :

@form(routes.HomeController.nextPage(id), 'class -> "bottom-right") {
   @CSRF.formField
   <button class="btn btn-select" type="submit">Select this computer</button>
}

But I don't know how to use the 'class with something else than top-right (I tried bottom, bottom-right, bottom-left, top-left, etc.). It will just display my button just below the content of the page.

Why is only top-right working ? How can I make something else work there ?

1

There are 1 best solutions below

1
cbley On

That's just a CSS class which is defined here: https://github.com/playframework/play-samples/blob/5ba1f14865b62b0b32f57968d05fa83387d97fff/play-java-ebean-example/public/stylesheets/main.css

.top-right {
  position: absolute;
  right: 20px;
  top: 70px;
}

If you want to use other layouts (classes) you have to add them first. Or use some CSS framework, like bulma.