porkchopclub/porkchop

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

Summary

Maintainability
Test Coverage
.page-header
  .page-header-inner
    %h1.page-header-title Edit #{resource_name.to_s.humanize}

= simple_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put, class: 'porkchop-form' }) do |f|
  - if f.error_notification
    .player-edit-errors.form-errors
      = f.error_notification

  .player-edit-name-fields.form-field-group
    %h2.form-field-group-title Names
    = f.input :nickname
    = f.input :name, label: "Real name", hint: "Please use your real life name, first and last. It is important as we use this for definitively identifying users on screens where it may not be obvious."

  .player-edit-email-fields.form-field-group
    = f.input :email, required: true, autofocus: true
    - if devise_mapping.confirmable? && resource.pending_reconfirmation?
      %p Currently waiting confirmation for: #{resource.unconfirmed_email}

  .player-edit-profile-picture-fields.form-field-group
    %h2.form-field-group-title Profile Picture
    - if f.object.profile_picture?
      %div
        .player-edit-profile-picture
          = image_tag(f.object.profile_picture_url)

    = f.file_field :profile_picture
    - if f.object.legacy_avatar_url.present?
      %p= link_to "Your old avatar can be found here.", f.object.legacy_avatar_url

  .player-edit-password-fields.form-field-group
    %h2.form-field-group-title Password Update
    %p Leave these fields blank if you do not want to change your password.
    = f.input :password, autocomplete: "off", required: false
    = f.input :password_confirmation, required: false

  .player-edit-current-password-field.form-field-group
    %h2.form-field-group-title We need your current password to make changes to your account.
    = f.input :current_password, required: true

  .player-edit-actions.form-actions
    = f.button :submit, "Save changes"