Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed-issue-6573-Include examples of implicit request in documentation #155

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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.

None yet

4 participants