Skip to content

Commit 069b725

Browse files
committed
Fix-issue-6573-Include examples of implicit request in documentation
1 parent 1b34f82 commit 069b725

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

docs/manual/working/javaGuide/main/templates/JavaTemplates.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,13 @@ By convention a reusable block defined with a name starting with **implicit** wi
182182
```
183183
@implicitFieldConstructor = @{ MyFieldConstructor() }
184184
```
185+
### Defining an implicit Requests in Templates
186+
187+
Your HTML template should have an implicit `Request` parameter to your template, if it doesn't have one already:
188+
189+
```
190+
@(...)(implicit request: Request[_])
191+
```
185192

186193
## Declaring reusable values
187194

docs/manual/working/scalaGuide/main/templates/ScalaTemplates.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,14 @@ You can define scoped values using the `defining` helper:
130130
131131
@[defining](code/scalaguide/templates/snippets.scala.html)
132132
133+
### Defining an implicit Requests in Templates
134+
135+
Your HTML template should have an implicit `Request` parameter to your template, if it doesn't have one already:
136+
137+
```
138+
@(...)(implicit request: Request[_])
139+
```
140+
133141
## Import statements
134142
135143
You can import whatever you want at the beginning of your template (or sub-template):
@@ -168,4 +176,4 @@ For example to output raw HTML:
168176

169177
The template engine can be used as a [string interpolator](http://docs.scala-lang.org/overviews/core/string-interpolation.html). You basically trade the “@” for a “$”:
170178

171-
@[string-interpolation](code/ScalaTemplates.scala)
179+
@[string-interpolation](code/ScalaTemplates.scala)

0 commit comments

Comments
 (0)