Skip to content

Commit

Permalink
#2 devise views converted erb to haml
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdilek committed Jul 14, 2013
1 parent 40fd639 commit 0baf6fb
Show file tree
Hide file tree
Showing 12 changed files with 111 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/cybele/app_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ def generate_devise_model(model_name)

# Internal: Generate devise views
def generate_devise_views
generate "devise:views"
# generate "devise:views"
directory 'app/views/devise', 'app/views/devise'
end

private
Expand Down
9 changes: 9 additions & 0 deletions templates/app/views/devise/confirmations/new.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
%h2 Resend confirmation instructions
= simple_form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f|
= f.error_notification
= f.full_error :confirmation_token
.form-inputs
= f.input :email, :required => true, :autofocus => true
.form-actions
= f.button :submit, "Resend confirmation instructions"
= render "devise/shared/links"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
%p
Welcome #{@email}!
%p You can confirm your account email through the link below:
%p= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
%p
Hello #{@resource.email}!
%p Someone has requested a link to change your password. You can do this through the link below.
%p= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token)
%p If you didn't request this, please ignore this email.
%p Your password won't change until you access the link above and create a new one.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
%p
Hello #{@resource.email}!
%p Your account has been locked due to an excessive number of unsuccessful sign in attempts.
%p Click the link below to unlock your account:
%p= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token)
11 changes: 11 additions & 0 deletions templates/app/views/devise/passwords/edit.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
%h2 Change your password
= simple_form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f|
= f.error_notification
= f.input :reset_password_token, :as => :hidden
= f.full_error :reset_password_token
.form-inputs
= f.input :password, :label => "New password", :required => true, :autofocus => true
= f.input :password_confirmation, :label => "Confirm your new password", :required => true
.form-actions
= f.button :submit, "Change my password"
= render "devise/shared/links"
8 changes: 8 additions & 0 deletions templates/app/views/devise/passwords/new.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
%h2 Forgot your password?
= simple_form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f|
= f.error_notification
.form-inputs
= f.input :email, :required => true, :autofocus => true
.form-actions
= f.button :submit, "Send me reset password instructions"
= render "devise/shared/links"
18 changes: 18 additions & 0 deletions templates/app/views/devise/registrations/edit.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
%h2
Edit #{resource_name.to_s.humanize}
= simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f|
= f.error_notification
.form-inputs
= f.input :email, :required => true, :autofocus => true
- if devise_mapping.confirmable? && resource.pending_reconfirmation?
%p
Currently waiting confirmation for: #{resource.unconfirmed_email}
= f.input :password, :autocomplete => "off", :hint => "leave it blank if you don't want to change it", :required => false
= f.input :password_confirmation, :required => false
= f.input :current_password, :hint => "we need your current password to confirm your changes", :required => true
.form-actions
= f.button :submit, "Update"
%h3 Cancel my account
%p
Unhappy? #{link_to "Cancel my account", registration_path(resource_name), :data => { :confirm => "Are you sure?" }, :method => :delete}
= link_to "Back", :back
11 changes: 11 additions & 0 deletions templates/app/views/devise/registrations/new.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
%h2 Sign up
= simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f|
= f.error_notification
.form-inputs
= f.input :name, :autofocus => true
= f.input :email, :required => true
= f.input :password, :required => true
= f.input :password_confirmation, :required => true
.form-actions
= f.button :submit, "Sign up"
= render "devise/shared/links"
9 changes: 9 additions & 0 deletions templates/app/views/devise/sessions/new.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
%h2 Sign in
= simple_form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f|
.form-inputs
= f.input :email, :required => false, :autofocus => true
= f.input :password, :required => false
= f.input :remember_me, :as => :boolean if devise_mapping.rememberable?
.form-actions
= f.button :submit, "Sign in"
= render "devise/shared/links"
19 changes: 19 additions & 0 deletions templates/app/views/devise/shared/_links.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
- if controller_name != 'sessions'
= link_to "Sign in", new_session_path(resource_name)
%br/
- if devise_mapping.registerable? && controller_name != 'registrations'
= link_to "Sign up", new_registration_path(resource_name)
%br/
- if devise_mapping.recoverable? && controller_name != 'passwords'
= link_to "Forgot your password?", new_password_path(resource_name)
%br/
- if devise_mapping.confirmable? && controller_name != 'confirmations'
= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name)
%br/
- 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/
- 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/
9 changes: 9 additions & 0 deletions templates/app/views/devise/unlocks/new.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
%h2 Resend unlock instructions
= simple_form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f|
= f.error_notification
= f.full_error :unlock_token
.form-inputs
= f.input :email, :required => true, :autofocus => true
.form-actions
= f.button :submit, "Resend unlock instructions"
= render "devise/shared/links"

0 comments on commit 0baf6fb

Please sign in to comment.