I'm trying to solve possibly simple problem, in my 'views' directory, in typical Play framework setup, I would like to group my templates (*.scala.html files) into groups, possibly using another folder for each group, eg. I would like to have customers folder with the following files in it:
createForm.scala.html
editForm.scala.html
list.scala.html
So far so good but when I try to access that view reference from my controller (eg. Ok(views.html.list(..))
-> Ok(views.customers.html.list(...)
), I get an error:
object customers is not a member of package views
Is there any best practice/receipe on how to work with multiple views, how to gather them into groups and then how to use them in other views or controllers.
Thx in advance.
The way the template engine works is that a template defined as:
/views/application/index.scala.html
Will be turned into a class:
views.html.application.index
So basically views.html
is always kept as a prefix. Cf. the Play template documentation.
In your case that means it should be
Ok(views.html.customers.list(...))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With