Skip to content

Conversation

Shruti9520
Copy link

@Shruti9520 Shruti9520 commented Oct 2, 2017

@richdougherty
Copy link
Member

Hi @Shruti9520, thanks for looking at this!

I have a couple of suggestions:

  1. Maybe a good place to mention these implicits is at the end of the Template parameters section of the docs, just before the Template constructor heading.

  2. Instead of saying that an implicit Request is required, I think we could tell users that it's useful for CSRF and form helpers and include links to the documentation.

E.g.

You can define implicit parameters for a template too:

@(user: models.User)(implicit requestHeader: RequestHeader, messagesProvider: MessagesProvider)

Many template helpers expect an implicit value to be in scope. For example, Cross-Site Request Forgery (CSRF) protection [needs a RequestHeader](ScalaCsrf#Defining-an-implicit-Requests-in-Templates) and Form Helpers [need a MessageProvider](ScalaForms#Passing-MessagesProvider-to-Form-Helpers).

@Shruti9520
Copy link
Author

Hi, @richdougherty

Updated my commit.
Thanks for reviewing. :)

@Shruti9520
Copy link
Author

@richdougherty Hi,

I think ScalaCsrf#Defining-an-implicit-Requests-in-Templates is a kind of an external link. Can I use standard Markdown link syntax here?

Thanks!

You can define implicit parameters for a template too:

```
@(user: models.User)(implicit requestHeader: RequestHeader, messagesProvider: MessagesProvider)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this example belongs here. This is the Java documentation and you're referencing Scala API classes from Play.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll remove this. But I am not sure which example is correct for Java documentation.

@(user: models.User)(implicit requestHeader: RequestHeader, messagesProvider: MessagesProvider)
```

Many template helpers expect an implicit value to be in scope. For example, Cross-Site Request Forgery (CSRF) protection [needs a RequestHeader](ScalaCsrf#Defining-an-implicit-Requests-in-Templates) and Form Helpers [need a MessageProvider](ScalaForms#Passing-MessagesProvider-to-Form-Helpers).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also referencing the scala documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants