Created
September 13, 2011 06:34
-
-
Save dgb/1213261 to your computer and use it in GitHub Desktop.
Twitter Bootstrap styles for Devise
This file contains hidden or 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
$ -> | |
$('.close').live 'click', (e) -> | |
e.preventDefault() | |
$(this).parent().hide() | |
$('.devise form div i').each -> | |
$this = $(this) | |
text = $this.text() | |
sibling = $this.prev('label') | |
a = $("<a>").text("*").attr('title', text) | |
a.prependTo(sibling) | |
devise_errors = $('.devise #error_explanation') | |
if devise_errors.length | |
close_link = $('<a>').addClass('close').attr('href', '#').text('\u00d7') | |
devise_errors.prepend(close_link) |
This file contains hidden or 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
form { | |
/* This is all copy/pasted. I can't get element-based rulesets to work */ | |
input[type=email] { | |
display: inline-block; | |
width: 210px; | |
margin: 0; | |
padding: 4px; | |
font-size: 13px; | |
line-height: @baseline; | |
height: @baseline; | |
color: @gray; | |
border: 1px solid #ccc; | |
.border-radius(3px); | |
} | |
// Focus states | |
input[type=email] { | |
@transition: border linear .2s, box-shadow linear .2s; | |
.transition(@transition); | |
.box-shadow(inset 0 1px 3px rgba(0,0,0,.1)); | |
} | |
input[type=email]:focus { | |
outline: none; | |
border-color: rgba(82,168,236,.8); | |
@shadow: inset 0 1px 3px rgba(0,0,0,.1), 0 0 8px rgba(82,168,236,.6); | |
.box-shadow(@shadow); | |
} | |
} | |
.devise { | |
margin-top:20px; | |
.columns(7); | |
.offset(4); | |
.well; | |
h2 { | |
margin-left: 150px; | |
margin-bottom: 15px; | |
font-size: 20px; | |
font-weight:normal; | |
color: @grayDark; | |
} | |
form { | |
div { | |
margin-bottom: @baseline; | |
a { | |
margin:0; | |
&:after { content:'\0000a0'; } | |
&:before { content:none; } | |
} | |
} | |
br, i { | |
display:none; | |
} | |
input { | |
margin-left: 20px; | |
} | |
/* Oh, dear... */ | |
label[for=user_remember_me] { | |
padding:0; | |
position:relative; | |
left:130px; | |
} | |
input[type=submit] { | |
margin-left:150px; | |
.btn; | |
.primary; | |
} | |
} | |
a, h3, p{ | |
margin-left:150px; | |
} | |
p { | |
a { | |
margin:0; | |
&:before { content:none; } | |
} | |
} | |
a:before, p:before { | |
content:'\002022\0000a0'; | |
} | |
#error_explanation { | |
.alert-message.error; | |
.block-message; | |
margin-left:150px; | |
text-shadow:none; | |
h2 { | |
font-size:13px; | |
line-height:18px; | |
font-weight:bold; | |
margin:0 0 6px 0; | |
} | |
h2, li { | |
color:white; | |
} | |
a { | |
.alert-message.close | |
} | |
} | |
} |
This file contains hidden or 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
<% content_for :content do %> | |
<div class="devise"> | |
<%= yield %> | |
</div> | |
<% end %> | |
<%= render :template => 'layouts/application' %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I ended up rewriting this for Bootstrap 2.0 and released it as a gem: https://github.com/bigbento/less-rails-bootstrap-devise