unclesp1d3r/CipherSwarm

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

Summary

Maintainability
Test Coverage
<%= render Railsboot::HeaderComponent.new do |header| %>
  <% header.with_heading do %>
    <%= title "Edit #{current_user.name}" %>
  <% end %>
  <% header.with_breadcrumb.with_items([
       { text: "Dashboard", href: root_path },
       { text: "Edit #{current_user.name}", href: edit_user_registration_path, active: true }
                                       ]) %>
<% end %>

<%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
  <%= render Railsboot::ErrorsComponent.new(resource) %>

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

    <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
      <p>Currently waiting confirmation for: <%= resource.unconfirmed_email %></p>
    <% end %>
  </div>
  <div class="form-group row">
    <fieldset class="form-group">
      <legend class="col-form-label">Change password</legend>
      <%= f.input :current_password,
                  hint: "we need your current password to confirm your changes",
                  required: true,
                  input_html: { autocomplete: "current-password" } %>
      <%= f.input :password,
                  hint: "leave it blank if you don't want to change it",
                  required: false,
                  input_html: { autocomplete: "new-password" } %>
      <%= f.input :password_confirmation,
                  required: false,
                  input_html: { autocomplete: "new-password" } %>
    </fieldset>
  </div>
  <div class="form-actions mt-3">
    <%= f.button :submit, "Update", class: "btn btn-primary" %>
    <%= link_to "Back", :back, class: "btn btn-outline-secondary" %>
  </div>
<% end %>