Tôi mới vào khung chơi và muốn viết nhà xây dựng trường khởi động twitter của riêng mình, bao gồm việc sử dụng bootstrap icon-classes. Để làm cho động lực này tôi cần phải vượt qua lớp biểu tượng thông qua tham số thêm. Điều đó thậm chí có thể? Tôi đã thử các sau đây và một số biến thể khác:Chơi 2.0.1 trình tạo trường tùy chỉnh ... Tham số bổ sung?
index.scala.html
@(loginForm: Form[Login])
@import helper._
@implicitFieldConstructor = @{ FieldConstructor(twitterBootstrapInput.render) }
@main("Akquise") {
<div class="container row">
<div class="span4 offset5">
@form(routes.Application.login(), args = 'class -> "well"){
<h3>Anmeldung</h3>
<fieldset>
@inputText(loginForm("username"), '_label -> "Nutzername", '_iconcls -> "icon-user")
@inputPassword(loginForm("password"), '_label -> "Passwort", '_iconcls -> "icon-key")
</fieldset>
<button type="submit" class="btn btn-primary">Login</button>
}
</div>
</div>
}
twitterBootstrapInput.scala.html
@(elements: helper.FieldElements)
@**************************************************
* Generate input according twitter bootsrap rules *
**************************************************@
<label for="@elements.id">@elements.label</label>
<div class="input-prepend">
<span class="add-on" style="margin-right:-5px;">
<i class="@elements.iconcls icon-size"></i>
</span>
@elements.input
</div>
Với những thông số trình biên dịch ném lỗi này:
value iconcls is not a member of views.html.helper.FieldElements
Làm cách nào để chuyển các đối số khác nếu điều đó không hoạt động?
Điều đó đã xảy ra. Cảm ơn bạn! – Demnogonis