-
Notifications
You must be signed in to change notification settings - Fork 57
Description
In my app I have pages that use BigPipe and pages that don't.
I don't want to duplicate basic template tag in both format. e.g. analytics.scala.stream / analytics.scala.html or footer.scala.stream / footer.scala.html
In a classic html template I use the standard syntaxe :
in index.scala.html : @footer()
in build.sbt : TwirlKeys.templateImports ++= Seq("tags._")
If I do the same in detail.scala.stream I get the following error :
not found: value footer
I can use something like that
@{
HtmlStream.fromHtml(views.html.tags.footer())
}
but it's a bit ugly and I have the feeling we can do better.
Next level to the question : I have a template with header/menu/footer. I want to use it for stream and html pages.
@(bigPipe : BigPipe
, enterprise: Pagelet
, investors : Pagelet
, comments : Pagelet
, documents : Pagelet
)(implicit request: RequestHeader, lang:Lang)
@scripts = {
<script src="/assets/com/ybrikman/ping/big-pipe.js"></script>
}
@main("meta.application.index.title"
, "meta.application.index.description"
, "meta.application.index.keyword"
, scripts) {
<h1>@{m("meta.project.detail.title")}</h1>
@bigPipe.render { pagelets =>
<table class="wrapper">
<tr>
<td>@pagelets(enterprise.id)</td>
<td>@pagelets(investors.id)</td>
</tr>
<tr>
<td>@pagelets(comments.id)</td>
<td>@pagelets(documents.id)</td>
</tr>
</table>
}
}
The above doesn't work for the same reason : not found: value main
If I try to use the following I get : expected start of definition
@HtmlStream.fromHtml(views.html.main("meta.application.index.title"
, "meta.application.index.description"
, "meta.application.index.keyword"
, scripts) {
<h1>@{m("meta.project.detail.title")}</h1>
@bigPipe.render { pagelets =>
<table class="wrapper"> <!-- expected start of definition here -->
<tr>
<td>@pagelets(enterprise.id)</td>
<td>@pagelets(investors.id)</td>
</tr>
<tr>
<td>@pagelets(comments.id)</td>
<td>@pagelets(documents.id)</td>
</tr>
</table>
}
})