Skip to content

Commit

Permalink
Styled devise views for signin and password reset
Browse files Browse the repository at this point in the history
  • Loading branch information
brzaik committed Jun 3, 2012
1 parent 608ea43 commit f68b360
Show file tree
Hide file tree
Showing 6 changed files with 122 additions and 52 deletions.
13 changes: 9 additions & 4 deletions app/assets/stylesheets/application/layout/forms.scss.erb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ fieldset {
}

}

.field, .clearfix {
> label {
padding-top: 6px;
float: left;
width: 130px;
text-align: right;
}
}
}


Expand All @@ -43,12 +52,8 @@ textarea {

// Float labels left
label {
padding-top: 6px;
font-size: $basefont;
line-height: $baseline;
float: left;
width: 130px;
text-align: right;
color: $grayDark;
}

Expand Down
51 changes: 37 additions & 14 deletions app/views/devise/passwords/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,16 +1,39 @@
<h2>Change your password</h2>
<section class="C no">
<header>
<h1>Change Password</h1>
</header>
<div class="C-cont">
<article>

<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %>
<%= devise_error_messages! %>
<%= f.hidden_field :reset_password_token %>

<fieldset>
<div class="clearfix">
<%= f.label :password, "New password" %>
<div class="input">
<%= f.password_field :password %>
</div>
</div>

<div class="clearfix">
<%= f.label :password_confirmation, "Repeat password" %>
<div class="input">
<%= f.password_field :password_confirmation %>
</div>
</div>
</fieldset>

<div class="submit_bar actions">
<%= f.submit "Change Password" %>
&nbsp;&nbsp;&nbsp;
<%= render :partial => "devise/shared/links" %>
</div>

<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %>
<%= devise_error_messages! %>
<%= f.hidden_field :reset_password_token %>
<% end %>

<p><%= f.label :password, "New password" %><br />
<%= f.password_field :password %></p>

<p><%= f.label :password_confirmation, "Confirm new password" %><br />
<%= f.password_field :password_confirmation %></p>

<p><%= f.submit "Change my password" %></p>
<% end %>
<%= render :partial => "devise/shared/links" %>
</article>
<div class="clear"></div>
</div>
</section>
42 changes: 31 additions & 11 deletions app/views/devise/passwords/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,12 +1,32 @@
<h2>Forgot your password?</h2>
<section class="C no">
<header>
<%= back_button :back %>
<h1>Forgot your password?</h1>
</header>
<div class="C-cont">
<article>

<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %>
<%= devise_error_messages! %>

<fieldset>
<div class="clearfix">
<%= f.label :email %>
<div class="input">
<%= f.email_field :email %>
</div>
</div>
</fieldset>

<div class="submit_bar actions">
<%= f.submit "Send Reset Instructions" %>
&nbsp;&nbsp;&nbsp;
<%= render :partial => "devise/shared/links" %>
</div>

<% end %>

<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %>
<%= devise_error_messages! %>

<p><%= f.label :email %><br />
<%= f.email_field :email %></p>

<p><%= f.submit "Send me reset password instructions" %></p>
<% end %>
<%= render :partial => "devise/shared/links" %>
</article>
<div class="clear"></div>
</div>
</section>
27 changes: 27 additions & 0 deletions app/views/devise/sessions/_form.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
<fieldset>
<div class="clearfix">
<%= f.label :email %>
<div class="input">
<%= f.email_field :email %>
</div>
</div>
<div class="clearfix">
<%= f.label :password %>
<div class="input">
<%= f.password_field :password %>
</div>
</div>
<% if devise_mapping.rememberable? -%>
<div class="input">
<%= f.check_box :remember_me %> <%= f.label :remember_me %>
</div>
<% end -%>
</fieldset>

<div class="submit_bar actions">
<%= f.submit "Sign in" %>
&nbsp;&nbsp;&nbsp;
<%= render :partial => "devise/shared/links" %>
</div>
<% end %>
29 changes: 12 additions & 17 deletions app/views/devise/sessions/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
<h2>Sign in</h2>

<%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
<p><%= f.label :email %><br />
<%= f.email_field :email %></p>

<p><%= f.label :password %><br />
<%= f.password_field :password %></p>

<% if devise_mapping.rememberable? -%>
<p><%= f.check_box :remember_me %> <%= f.label :remember_me %></p>
<% end -%>

<p><%= f.submit "Sign in" %></p>
<% end %>
<%= render :partial => "devise/shared/links" %>
<section class="C no">
<header>
<%= back_button :back %>
<h1>Sign In</h1>
</header>
<div class="C-cont">
<article>
<%= render 'form' %>
</article>
<div class="clear"></div>
</div>
</section>
12 changes: 6 additions & 6 deletions app/views/devise/shared/_links.erb
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<%- if controller_name != 'sessions' %>
<%= link_to "Sign in", new_session_path(resource_name) %><br />
<%= link_to "Sign in", new_session_path(resource_name) %>&nbsp;&nbsp;
<% end -%>
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
<%= link_to "Register Account", new_registration_path(resource_name) %><br />
<%= link_to "Register Account", new_registration_path(resource_name) %>&nbsp;&nbsp;
<% end -%>
<%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
<%= link_to "Forgot your password?", new_password_path(resource_name) %>&nbsp;&nbsp;
<% end -%>
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>&nbsp;&nbsp;
<% end -%>
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %>&nbsp;&nbsp;
<% end -%>
<%- if devise_mapping.omniauthable? %>
<%- resource_class.omniauth_providers.each do |provider| %>
<%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %><br />
<%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %>
<% end -%>
<% end -%>

0 comments on commit f68b360

Please sign in to comment.