我正在使用 securesocial 插件并将其用作模块。
所以我的结构是这样的:
project
|
|--app
|---|
|---|--views/main.scala.html
|--conf
|--logs
|--module
|---|--securesocial
|---|------|
|---|------|--app
|---|------|---|
|---|------|---|--views/main.scala.html
|---|------|---|--views/login.scala.html
我的简单问题是,如何使用“app/views”文件夹中的“main.scala.html” View 覆盖 module/securesocial/app/views 中的 main.scala.html?!
我的意思是“覆盖”,我可以将登录 View 包含到我的 main.scala.html 的“@content”变量中,通常的工作方式如下:
@main("My title test"){
<p class="note">
Try <em>guillaume@@sample.com</em> with <em>test123</em> as password.
</p>
}
但是使用“@main”,我无法从模块文件夹中访问(因此覆盖)我的“app/views/main.scala.html”。
最佳答案
SecureSocial 使用可自定义的插件呈现 View 。默认实现是 DefaultTemplatesPlugin,您可以将其替换为您自己的插件以更改生成的 html。
创建自定义页面和电子邮件:
- 在 View 下创建一个新目录,以放置 SecureSocial 的自定义模板。
- 创建一个新插件来实现 TemplatesPlugin 特征并呈现这些模板。
- 编辑 play.plugins 文件并将 DefaultPluginsTemplate 替换为您自己的类。
您可以通过查看 TemplatesPlugin 特征或文档页面来了解需要实现哪些方法:http://securesocial.ws/guide/views-customization.html .
关于view - play 2.0 我如何从(securesocial)模块覆盖我的 View ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11465481/