1

我使用的是与我的应用程序中的多个表单,您可以在其中输入输入的twitter Bootstrap 3.3.4。我可以忽略代码中的“twitter bootstrap is deprecated”警告吗?

样品:

@import models.Question 
@import models.Answer 
@import helper._ 
@import helper.twitterBootstrap._ 

@(questionForm: Form[Question], questionList: List[Question]) 

@main("Ask Question"){ 

    @helper.form(action = routes.Application.sendQuestion()){ 
     <fieldset> 
      @helper.inputText(questionForm("questionID")) 
      @helper.inputText(questionForm("questionText")) 
      @helper.inputText(questionForm("voteScore")) 
      @helper.inputText(questionForm("userID")) 
      @helper.inputText(questionForm("page")) 
     </fieldset> 
     <input type="submit" class="btn btn-default"> 
    } 
} 

现在,如果我编译,有几个警告终端:

[warn]     @helper.inputText(questionForm("userID")) 
[warn]         ^
[warn] (...)\frageAntwort.scala.html:22: 
value twitterBootstrapField in package twitterBootstrap is deprecated: 
The twitter bootstrap field constructor will be removed from Play in 2.4 
since the way Bootstrap must be used changes too frequently and too 
drastically between versions for this to make sense to be in the core of Play 

我搜索了警告和只发现这old SO post about itissue on github

SO帖子提到写他自己的模板助手,但作为我自己的工作,我看到没有必要写一个。那么我是否仍然可以使用我的产品并忽略这些警告,或者稍后在我的生产系统或其他任何地方发现问题?另外,如果警告没有后果,是否有办法隐藏它们?

回答

4

Play 2.3 migration guide有一个部分旨在解释这个问题。它说:

的内置Twitter的引导场构造已被弃用, 并会在游戏的未来版本中删除。

这有几个原因,一个是,我们发现, 引导也发生了变化急剧版本之间过于频繁, 使得由播放快速提供任何内置的支持变得陈旧 并与当前不兼容Bootstrap版本。

另一个原因是当前Bootstrap对CSS 类的要求无法单独使用Play的字段构造函数实现,还需要一个 自定义输入模板。

我们前进的观点是,如果这是一个特点,就是有价值的 社会,第三方模块可以创建它提供了一个 组独立的引导形式辅助模板,具体到给定 引导版本,允许比目前可提供的更好的用户体验 。

即使现在有效,将来也会出现问题。如果我是你,我会为编写定制解决方案而奔波。只有这样,你才能确保在你的项目中进行了框架升级之后,一切仍然可以正常工作。

+0

我必须手动更新游戏框架,是否正确?将不会自动更新到新版本? – hamena314

+0

是的。我的意思是手动升级。但在维护您的产品时可能会出现这种情况。 –

+0

好吧,然后将考虑编写自己的模板助手来确保。谢谢! – hamena314

相关问题