Created
April 10, 2014 03:22
-
-
Save beaugaines/10340081 to your computer and use it in GitHub Desktop.
User edit form
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- app/views/devise/registrations/edit.html.erb --> | |
<h2>Edit <%= resource_name.to_s.humanize %></h2> | |
<div class="row"> | |
<div class="col-md-8"> | |
<h3>Change email or password</h3> | |
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :patch }) do |f| %> | |
<%= devise_error_messages! %> | |
<div class="form-group"> | |
<%= f.label :email %> | |
<%= f.email_field :email, class: 'form-control', placeholder: "Enter email" %> | |
</div> | |
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %> | |
<div class="form-group"> | |
<p>Waiting confirmation for:</p> | |
<%= resource.unconfirmed_email %> | |
</div> | |
<% end %> | |
<div class="form-group"> | |
<%= f.label :password %> | |
<%= f.password_field :password, class: 'form-control', placeholder: "Enter password" %> | |
<i>(leave blank if you don't want to change it)</i> | |
</div> | |
<div class="form-group"> | |
<%= f.label :password_confirmation %> | |
<%= f.password_field :password_confirmation, class: 'form-control', placeholder: "Enter password confirmation" %> | |
</div> | |
<div class="form-group"> | |
<%= f.password_field :current_password, class: 'form-control', placeholder: "Enter password" %> | |
<i>(we need your current password to confirm your changes)</i> | |
</div> | |
<% if current_user.avatar? %> | |
<div class="form-group"> | |
<p>Current avatar</p> | |
<%= image_tag( current_user.avatar.profile.url ) %> | |
</div> | |
<% end %> | |
<div class="form-group"> | |
<%= f.label :avatar %> | |
<%= f.file_field :avatar %> | |
<%= f.hidden_field :avatar_cache %> | |
</div> | |
<div class="form-group"> | |
<%= f.label :name %> | |
<%= f.text_field :name, class: 'form-control', placeholder: "Enter name", autofocus: true %> | |
</div> | |
<div class="form-group"> | |
<%= f.submit "Update", class: 'btn btn-success' %> | |
</div> | |
<% end %> | |
<h3>Cancel my account</h3> | |
<div class="form-group"> | |
<p><%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete, class: 'btn btn-danger' %></p> | |
</div> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment