Commit a64700511ca9207c368aa5af27fb81cb8f3c37bd

Authored by Jared Pace
1 parent 63cd8fea
Exists in master and in 1 other branch production

Make Devise views consistent with the existing ones

app/models/user.rb
1 class User 1 class User
2 include Mongoid::Document 2 include Mongoid::Document
3 3
4 - devise :database_authenticatable, :registerable,  
5 - :recoverable, :rememberable, :trackable, 4 + devise :database_authenticatable,
  5 + :recoverable, :rememberable, :trackable,
6 :validatable, :token_authenticatable 6 :validatable, :token_authenticatable
7 7
8 field :name 8 field :name
app/views/devise/confirmations/new.html.haml
@@ -1,9 +0,0 @@ @@ -1,9 +0,0 @@
1 -%h2 Resend confirmation instructions  
2 -= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f|  
3 - = devise_error_messages!  
4 - %p  
5 - = f.label :email  
6 - %br/  
7 - = f.text_field :email  
8 - %p= f.submit "Resend confirmation instructions"  
9 -= render :partial => "devise/shared/links"  
app/views/devise/mailer/confirmation_instructions.html.haml
@@ -1,4 +0,0 @@ @@ -1,4 +0,0 @@
1 -%p  
2 - Welcome #{@resource.email}!  
3 -%p You can confirm your account through the link below:  
4 -%p= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token)  
app/views/devise/mailer/reset_password_instructions.html.haml
@@ -1,6 +0,0 @@ @@ -1,6 +0,0 @@
1 -%p  
2 - Hello #{@resource.email}!  
3 -%p Someone has requested a link to change your password, and you can do this through the link below.  
4 -%p= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token)  
5 -%p If you didn't request this, please ignore this email.  
6 -%p Your password won't change until you access the link above and create a new one.  
app/views/devise/mailer/reset_password_instructions.text.erb 0 → 100644
@@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
  1 +Hello,
  2 +
  3 +We hear you'd link to change your password. You can do that by visiting the link below.
  4 +
  5 + <%= edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %>
  6 +
  7 +If you didn't request this, please ignore this email. Your password won't change unless you access the link above and create a new one.
  8 +
  9 +<%= render 'mailer/signature' %>
0 \ No newline at end of file 10 \ No newline at end of file
app/views/devise/mailer/unlock_instructions.html.haml
@@ -1,5 +0,0 @@ @@ -1,5 +0,0 @@
1 -%p  
2 - Hello #{@resource.email}!  
3 -%p Your account has been locked due to an excessive amount of unsuccessful sign in attempts.  
4 -%p Click the link below to unlock your account:  
5 -%p= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token)  
app/views/devise/passwords/edit.html.haml
1 -%h2 Change your password 1 +- content_for :title, "Change your password"
  2 +
2 = form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| 3 = form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f|
3 = devise_error_messages! 4 = devise_error_messages!
4 = f.hidden_field :reset_password_token 5 = f.hidden_field :reset_password_token
5 - %p  
6 - = f.label :password  
7 - %br/ 6 + .required
  7 + = f.label :password, 'New password'
8 = f.password_field :password 8 = f.password_field :password
9 - %p  
10 - = f.label :password_confirmation  
11 - %br/ 9 + .required
  10 + = f.label :password_confirmation, 'One more time'
12 = f.password_field :password_confirmation 11 = f.password_field :password_confirmation
13 - %p= f.submit "Change my password"  
14 -= render :partial => "devise/shared/links" 12 + %div= f.submit "Change my password"
15 \ No newline at end of file 13 \ No newline at end of file
app/views/devise/passwords/new.html.haml
1 -%h2 Forgot your password? 1 +- content_for :title, "Forget your password?"
2 = form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| 2 = form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f|
3 = devise_error_messages! 3 = devise_error_messages!
4 - %p 4 + .required
5 = f.label :email 5 = f.label :email
6 - %br/  
7 = f.text_field :email 6 = f.text_field :email
8 - %p= f.submit "Send me reset password instructions"  
9 -= render :partial => "devise/shared/links" 7 +
  8 + %div= f.submit "Send me reset password instructions"
10 \ No newline at end of file 9 \ No newline at end of file
app/views/devise/registrations/edit.html.haml
@@ -1,27 +0,0 @@ @@ -1,27 +0,0 @@
1 -%h2  
2 - Edit #{resource_name.to_s.humanize}  
3 -= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f|  
4 - = devise_error_messages!  
5 - %p  
6 - = f.label :email  
7 - %br/  
8 - = f.text_field :email  
9 - %p  
10 - = f.label :password  
11 - %i (leave blank if you don't want to change it)  
12 - %br/  
13 - = f.password_field :password  
14 - %p  
15 - = f.label :password_confirmation  
16 - %br/  
17 - = f.password_field :password_confirmation  
18 - %p  
19 - = f.label :current_password  
20 - %i (we need your current password to confirm your changes)  
21 - %br/  
22 - = f.password_field :current_password  
23 - %p= f.submit "Update"  
24 -%h3 Cancel my account  
25 -%p  
26 - Unhappy? #{link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete}.  
27 -= link_to "Back", :back  
app/views/devise/registrations/new.html.haml
@@ -1,20 +0,0 @@ @@ -1,20 +0,0 @@
1 -%h2 Sign up  
2 -= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f|  
3 - = devise_error_messages!  
4 - %p  
5 - = f.label :name  
6 - = f.text_field :name  
7 - %p  
8 - = f.label :email  
9 - %br/  
10 - = f.text_field :email  
11 - %p  
12 - = f.label :password  
13 - %br/  
14 - = f.password_field :password  
15 - %p  
16 - = f.label :password_confirmation  
17 - %br/  
18 - = f.password_field :password_confirmation  
19 - %p= f.submit "Sign up"  
20 -= render :partial => "devise/shared/links"  
app/views/devise/sessions/new.html.haml
1 -%h2 Sign in 1 +- content_for :title, 'Sign in'
  2 +
2 = form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| 3 = form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f|
3 - %p 4 + .required
4 = f.label :email 5 = f.label :email
5 - %br/  
6 = f.text_field :email 6 = f.text_field :email
7 - %p 7 + .required
  8 + = link_to 'forget it?', new_password_path(resource_name), :class => 'float-right'
8 = f.label :password 9 = f.label :password
9 - %br/  
10 = f.password_field :password 10 = f.password_field :password
  11 +
11 - if devise_mapping.rememberable? 12 - if devise_mapping.rememberable?
12 - %p 13 + %div.checkbox
13 = f.check_box :remember_me 14 = f.check_box :remember_me
14 = f.label :remember_me 15 = f.label :remember_me
15 - %p= f.submit "Sign in"  
16 -= render :partial => "devise/shared/links" 16 +
  17 + %div= f.submit "Sign in"
17 \ No newline at end of file 18 \ No newline at end of file
app/views/devise/shared/_links.haml
@@ -1,15 +0,0 @@ @@ -1,15 +0,0 @@
1 -- if controller_name != 'sessions'  
2 - = link_to "Sign in", new_session_path(resource_name)  
3 - %br/  
4 -- if devise_mapping.registerable? && controller_name != 'registrations'  
5 - = link_to "Sign up", new_registration_path(resource_name)  
6 - %br/  
7 -- if devise_mapping.recoverable? && controller_name != 'passwords'  
8 - = link_to "Forgot your password?", new_password_path(resource_name)  
9 - %br/  
10 -- if devise_mapping.confirmable? && controller_name != 'confirmations'  
11 - = link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name)  
12 - %br/  
13 -- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks'  
14 - = link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name)  
15 - %br/  
app/views/devise/unlocks/new.html.haml
@@ -1,9 +0,0 @@ @@ -1,9 +0,0 @@
1 -%h2 Resend unlock instructions  
2 -= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f|  
3 - = devise_error_messages!  
4 - %p  
5 - = f.label :email  
6 - %br/  
7 - = f.text_field :email  
8 - %p= f.submit "Resend unlock instructions"  
9 -= render :partial => "devise/shared/links"  
app/views/layouts/application.html.haml
@@ -13,8 +13,9 @@ @@ -13,8 +13,9 @@
13 #header 13 #header
14 %div 14 %div
15 = link_to 'Errbit', root_path, :id => 'site-name' 15 = link_to 'Errbit', root_path, :id => 'site-name'
  16 + = render 'shared/session'
16 17
17 - = render :partial => 'shared/navigation' 18 + = render 'shared/navigation' if current_user
18 19
19 #content-wrapper 20 #content-wrapper
20 #content-title 21 #content-title
@@ -26,6 +27,5 @@ @@ -26,6 +27,5 @@
26 #content 27 #content
27 = render :partial => 'shared/flash_messages' 28 = render :partial => 'shared/flash_messages'
28 = yield 29 = yield
29 - #footer  
30 - Powered by Errbit. 30 + #footer= "Powered by #{link_to 'Errbit', 'http://github.com/jdpace/errbit', :target => '_blank'}: the open source Hoptoad server.".html_safe
31 = yield :scripts 31 = yield :scripts
32 \ No newline at end of file 32 \ No newline at end of file
app/views/shared/_session.html.haml 0 → 100644
@@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
  1 +- if current_user
  2 + %ul#session-links
  3 + %li= link_to 'Sign out', destroy_session_path(:user), :id => 'sign-out'
0 \ No newline at end of file 4 \ No newline at end of file
public/stylesheets/application.css
@@ -58,9 +58,36 @@ a.action { float: right; font-size: 0.9em;} @@ -58,9 +58,36 @@ a.action { float: right; font-size: 0.9em;}
58 text-indent: -5000em; 58 text-indent: -5000em;
59 } 59 }
60 #header #session-links { 60 #header #session-links {
61 - position: absolute; top: 15px; right: 0; 61 + position: absolute; top: 18px; right: 0;
62 font-size: 0.9em; 62 font-size: 0.9em;
63 } 63 }
  64 +#header #session-links li {
  65 + float: right;
  66 + color: #FFF;
  67 + background-color: #000;
  68 + border-radius: 6px;
  69 + -moz-border-radius: 6px;
  70 + -webkit-border-radius: 6px;
  71 + border: 1px solid #484B4F;
  72 + font-size: 14px;
  73 + font-weight: bold;
  74 +}
  75 +#header #session-links li:hover {
  76 + box-shadow: 0 0 3px #69c;
  77 + -moz-box-shadow: 0 0 3px #69c;
  78 + -webkit-box-shadow: 0 0 3px #69c;
  79 +}
  80 +#header #session-links a {
  81 + color: #FFF;
  82 + padding: 0 10px 0 30px;
  83 + line-height: 37px;
  84 +}
  85 +#header #session-links a:hover {
  86 + text-decoration: none;
  87 +}
  88 +#header #session-links #sign-out {
  89 + background: transparent url(images/icons/bullet-red-sm.png) 12px 50% no-repeat;
  90 +}
64 91
65 /* Navigation */ 92 /* Navigation */
66 #nav-bar { 93 #nav-bar {