maximalink/devise-i18n-bootstrap

View on GitHub
app/views/devise/registrations/edit.html.erb

Summary

Maintainability
Test Coverage
<h2><%= t('.title', resource: resource_class.model_name.human , default: "Edit #{resource_name.to_s.humanize}") %></h2>

<%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
  <%= f.error_notification class: 'alert alert-danger' %>

  <div class="form-inputs">
    <%= f.input :email, autofocus: true, required: true %>

    <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
      <p><%= t('.currently_waiting_confirmation_for', default: 'Currently waiting confirmation for') %>: <%= resource.unconfirmed_email %></p>
    <% end %>

    <%= f.input :password, autocomplete: 'off', required: false, hint: t('.leave_blank_if_you_don_t_want_to_change_it', default: "leave blank if you don't want to change it") %>
    <%= f.input :password_confirmation, autocomplete: 'off', required: false %>
    <%= f.input :current_password, autocomplete: 'off', required: true, hint: t('.we_need_your_current_password_to_confirm_your_changes', default: 'we need your current password to confirm your changes') %>
  </div>

  <div class="form-actions">
    <%= f.button :submit, t('.update', default: 'Update'), class: 'btn btn-primary' %>
  </div>
<% end %>

<h3><%= t('.cancel_my_account', default: 'Cancel my account') %></h3>

<p>
  <%= t('.unhappy', default: 'Unhappy') %>?
  <%= link_to t('.cancel_my_account', default: 'Cancel my account'),
              registration_path(resource_name),
              data: { confirm: t('.are_you_sure', default: 'Are you sure?') },
              method: :delete %>.
</p>

<%= link_to t('.back', default: 'Back'), back %>