Skip to content

Instantly share code, notes, and snippets.

@jaykilleen
Last active July 27, 2016 12:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jaykilleen/42e0b123ef97a36ad18d to your computer and use it in GitHub Desktop.
Save jaykilleen/42e0b123ef97a36ad18d to your computer and use it in GitHub Desktop.
Bootstrapping Devise Edit Registration View on Rails 4.2.0 with Bootstrap 3
<div class="container">
<div class="row">
<div class="col-sm-4 col-sm-offset-4">
<div class="light-well">
<h2 class="page-header text-center">Edit <%= resource_name.to_s.humanize %></h2>
<%= form_for resource, as: resource_name, url: registration_path(resource_name), html: { method: :put },
html: { class: "form-horizontal center"} do |f| %>
<div class="form-group">
<%= f.email_field :email, autofocus: true, class: "form-control" %>
</div>
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
<div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
<% end %>
<div class="form-group">
<%= f.password_field :password, autocomplete: "off", placeholder: "New Password", class: "form-control" %>
<p class="help-block"><i>leave blank if you don't want to change it</i><br />
</div>
<div class="form-group">
<%= f.password_field :password_confirmation, autocomplete: "off", placeholder: "Confirm New Password", class: "form-control" %>
<% if @validatable %>
<p class="help-block"><%= @minimum_password_length %> characters minimum</p>
<% end %>
</div>
<div class="form-group">
<%= f.password_field :current_password, autocomplete: "off", placeholder: "Current Password", class: "form-control" %>
<p class="help-block"><i>we need your current password to confirm your changes</i><br />
</div>
<div class="actions">
<%= f.submit "Update", class: "btn btn-success btn-lg btn-block" %>
</div>
<%= devise_error_messages! %>
<% end %>
</div>
<br>
<br>
<h3 class="page-header text-center">Cancel my account</h3>
<p>Unhappy? <%= button_to "Delete my account", registration_path(resource_name), class: "btn btn-danger btn-lg btn-block", data: { confirm: "Are you sure?" }, method: :delete %></p>
<%= link_to "Back", :back %>
</div>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment