Created
March 2, 2012 19:17
-
-
Save shinobu-aoki/1960544 to your computer and use it in GitHub Desktop.
Play2.0でBootstrap2.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="clearfix error" id="username_field"> | |
<label for="username">Username:</label> | |
<div class="input"> | |
<input type="text" name="username" id="username" value=""> | |
<span class="help-inline">This field is required!, Another error</span> | |
<span class="help-block">Required, Another constraint</span> | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="control-group error" id="username_field"> | |
<label class="control-label" for="username">Username</label> | |
<div class="controls"> | |
<input type="text" id="username" name="username" value=""> | |
<p class="help-inline">This field is required!, Another error</p> | |
<p class="help-block">Required, Another constraint</p> | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@(elements: views.html.helper.FieldElements) | |
@import play.api.i18n._ | |
@import views.html.helper._ | |
<div class="control-group @elements.args.get('_class) @if(elements.hasErrors) {error}" id="@elements.args.get('_id).getOrElse(elements.id + "_field")"> | |
<label class="control-label" for="@elements.id">@elements.label(elements.lang)</label> | |
<div class="controls"> | |
@elements.input | |
@if(elements.errors.length > 0) {<span class="help-inline">@elements.errors(elements.lang).mkString(", ")</span>} | |
@if(elements.infos.length > 0) {<p class="help-block">@elements.infos(elements.lang).mkString(", ")</p>} | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package views | |
import views.html.bootstrapField | |
import views.html.helper.FieldConstructor | |
object BootstrapHelper { | |
implicit val bootstrapConstructor = FieldConstructor(bootstrapField.f) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@(elements: views.html.helper.FieldElements) | |
@import play.api.i18n._ | |
@import views.html.helper._ | |
<div class="control-group @elements.args.get('_class) @if(elements.hasErrors) {error}" style="border-style: dashed;" id="@elements.args.get('_id).getOrElse(elements.id + "_field")"> | |
<label class="control-label" for="@elements.id">@elements.label(elements.lang)</label> | |
<div class="controls"> | |
@elements.input | |
@if(elements.errors.length > 0) {<span class="help-inline">@elements.errors(elements.lang).mkString(", ")</span>} | |
@if(elements.infos.length > 0) {<p class="help-block">@elements.infos(elements.lang).mkString(", ")</p>} | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dl class="error" id="username_field"> | |
<dt><label for="username"><label>Username:</label></dt> | |
<dd><input type="text" name="username" id="username" value=""></dd> | |
<dd class="error">This field is required!</dd> | |
<dd class="error">Another error</dd> | |
<dd class="info">Required</dd> | |
<dd class="info">Another constraint</dd> | |
</dl> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
blog用のコードを置いてます。
http://d.hatena.ne.jp/shinobu_aoki/20120302/1330716992