Skip to content

Commit

Permalink
Fix-issue-6573-Include examples of implicit request in documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Shruti9520 committed Oct 2, 2017
1 parent 1b34f82 commit 069b725
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
7 changes: 7 additions & 0 deletions docs/manual/working/javaGuide/main/templates/JavaTemplates.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,13 @@ By convention a reusable block defined with a name starting with **implicit** wi
```
@implicitFieldConstructor = @{ MyFieldConstructor() }
```
### Defining an implicit Requests in Templates

Your HTML template should have an implicit `Request` parameter to your template, if it doesn't have one already:

```
@(...)(implicit request: Request[_])
```

## Declaring reusable values

Expand Down
10 changes: 9 additions & 1 deletion docs/manual/working/scalaGuide/main/templates/ScalaTemplates.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,14 @@ You can define scoped values using the `defining` helper:
@[defining](code/scalaguide/templates/snippets.scala.html)
### Defining an implicit Requests in Templates
Your HTML template should have an implicit `Request` parameter to your template, if it doesn't have one already:
```
@(...)(implicit request: Request[_])
```
## Import statements
You can import whatever you want at the beginning of your template (or sub-template):
Expand Down Expand Up @@ -168,4 +176,4 @@ For example to output raw HTML:

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 “$”:

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

0 comments on commit 069b725

Please sign in to comment.