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

Support global variables #413

Closed
PromanSEW opened this issue Apr 15, 2021 · 3 comments
Closed

Support global variables #413

PromanSEW opened this issue Apr 15, 2021 · 3 comments

Comments

@PromanSEW
Copy link

Please add support for global template variables without ugly hacks as

@import java.lang.Boolean; val isAdmin = Templates.isAdmin(request)
@PromanSEW
Copy link
Author

Duplicate of #89

@mkurz mkurz closed this as completed Apr 30, 2024
@PromanSEW
Copy link
Author

Any news about this feature? Using template parameters is not a nice solution, if you don't want to use hacks. Just allow @val tmp = SomeClass.meth(), so it works with @import well, where is the problem? Twirl template should be functiontal-oriented (like Scala) HTML without imperative variables? Please explain

@mkurz
Copy link
Member

mkurz commented May 8, 2024

I think the reason this is not supported is because no one took time to implement it.
I put

on the Play 3.1 roadmap, if time allows I can look into that, it shouldn't be really hard I guess, the parser needs to be adjusted.
@PromanSEW if you have time to look into that I would review a pull request.

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

No branches or pull requests

2 participants