anthonymidili/EasyKeep

View on GitHub
app/views/users/registrations/edit.html.haml

Summary

Maintainability
Test Coverage
- provide(:title, 'User Settings')

.row
  .small-12.medium-6.large-6.small-centered.columns
    %h2.main_page_header Edit #{resource_name.to_s.humanize} Settings
    %br/

    = form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f|
      = render 'shared/error_messages', object: f.object

      = f.label :name
      = f.text_field :name, autofocus: true
      = f.label :email
      = f.text_field :email

      - if devise_mapping.confirmable? && resource.pending_reconfirmation?
        %div
          Currently waiting confirmation for: #{resource.unconfirmed_email}

      %small
        %i (we need your current password to confirm your changes)
      = f.label :current_password
      = f.password_field :current_password
      %small
        %i (leave blank if you don't want to change it)
      = f.label :password, 'New password'
      = f.password_field :password, autocomplete: 'off'
      = f.label :password_confirmation
      = f.password_field :password_confirmation
      %br/

      = f.submit 'Update', class: 'radius button expanded'
      = link_to 'Back', root_path, class: 'small button secondary radius expanded'

    - if current_user.is_owner?
      %hr/

      %h3 Cancel my account
      = link_to 'Cancel my account', registration_path(resource_name), class: 'tiny alert radius button',
      method: :delete, data: { confirm: t(:confirm_delete_ek_account) }