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

Allow for specifying imports at beginning of templates #1

Closed
benmccann opened this issue Nov 12, 2013 · 4 comments · Fixed by #12
Closed

Allow for specifying imports at beginning of templates #1

benmccann opened this issue Nov 12, 2013 · 4 comments · Fixed by #12

Comments

@benmccann
Copy link
Contributor

Right now you have to specify imports after the template declaration:

@(user: com.example.User)
@import com.example.User
Hello @user.getName()

This seems odd because it's not how Java/Scala classes work and also because it results in much more typing than the alternative:

@import com.example.User
@(user: User)
Hello @user.getName()

I took a stab at implementing this here: playframework/playframework#1661

@benmccann
Copy link
Contributor Author

@pvlugter several people were asking for this awhile back (@siasia @diwa and others). this was something that had always frustrated me as well, so I took a stab at implementing it. the pull request languished for awhile because the core devs understandably didn't want to be editing the templates while trying to split them out into a separate project. it looks like twirl is alive and well now so this might be a good time to revisit. unfortunately, i'm absolutely slammed at work right now and am not going to have much of a chance to make any updates to the pull request. i think it should be relatively close. do you think you'd be able to run with it from here?

@pvlugter
Copy link
Contributor

@benmccann sure, no problem.

@benmccann
Copy link
Contributor Author

that's awesome. thanks so much!

@benmccann
Copy link
Contributor Author

that's awesome. thank you!!

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

Successfully merging a pull request may close this issue.

2 participants