Skip to content

Instantly share code, notes, and snippets.

@dmke
Created March 31, 2014 15:23
Show Gist options
  • Save dmke/9894825 to your computer and use it in GitHub Desktop.
Save dmke/9894825 to your computer and use it in GitHub Desktop.
Devise registration form, prepared for Bootstrap 3 (w/o Simple Form)
-# app/views/devise/registrations/edit.html.haml
%h1.page-header
Edit
= resource_name.to_s.humanize
= form_for resource, as: resource_name, url: registration_path(resource_name), html: { method: :put, class: 'form-horizontal' } do |f|
= devise_error_messages!
.form-group
= f.label :email, class: 'col-sm-3 control-label'
.col-sm-9
= f.email_field :email, autofocus: true, class: 'form-control'
- if devise_mapping.confirmable? && resource.pending_reconfirmation?
Currently waiting confirmation for:
= resource.unconfirmed_email
.form-group
= f.label :password, class: 'col-sm-3 control-label'
.col-sm-9
= f.password_field :password, autocomplete: "off", class: 'form-control'
%span.help-block leave blank if you don't want to change it
.form-group
= f.label :password_confirmation, class: 'col-sm-3 control-label'
.col-sm-9
= f.password_field :password_confirmation, autocomplete: "off", class: 'form-control'
.form-group
= f.label :current_password, class: 'col-sm-3 control-label'
.col-sm-9
= f.password_field :current_password, autocomplete: "off", class: 'form-control'
%span.help-block we need your current password to confirm your changes
.form-group
.col-sm-offset-3.col-sm-9
= f.submit "Update", class: 'btn btn-primary', data: { wait: 'Updating…' }
%h3 Cancel my account
.row
.col-sm-3.text-right
%strong Unhappy?
.col-sm-9
= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete, class: 'btn btn-danger'
%p= link_to "Back", :back
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment