I'm sure I'm missing the obvious but is there a way to create a collection of Html objects to pass to a Play template like @(title: String)(content: Seq(Html))
? I am trying to dynamically generate a group of tab pages where each Html object is the body of the tab.
Where my confusion lies is with how to create the Seq(Html) in the template.
Something like @main("Home") Seq({...},{...})
doesn't work and using @(title: String)(contentTab1: Html)(contentTab2: Html)
and @main("Home") {...}, {...}
defeats the purpose.
Something like:
Tab content(tab.scala.html
):
@(content: Html, tab: models.Tab, isActive: String)
<section class="mdl-layout__tab-panel @isActive" id="fixed-tab-@tab.id">
<div class="page-content">@content</div>
</section>
Main template (main.scala.html
):
@main(title: String, tabs: List[models.Tab])(contentSeq: Seq[Html])
Page template:
@(tabs: List[models.Tab])
@main("title", tabs) {
<!-- tab1 content -->
} {
<!-- tab2 content -->
}
*ignore bad design of matching Seq[Html]
and List[models.Tab]
sizes