rootstrap/rails_hotwire_base

View on GitHub
app/views/users/passwords/edit.html.erb

Summary

Maintainability
Test Coverage
<div class="max-w-md px-4">
  <div>
    <h2 class="mt-6 text-center text-3xl font-extrabold text-gray-900">
      Change your password
    </h2>
    <p class="mt-2 text-center text-sm text-gray-600">
      <%- if devise_mapping.registerable? %>
        Or
        <%= link_to 'sign in', new_session_path(resource_name), class: %w[link] %>
      <% end %>
    </p>
  </div>

  <%= form_with(model: resource, url: password_path(resource_name), method: :put, data: { turbo: false }, class: %w[mt-8 space-y-6]) do |f| %>
    <%= render 'shared/error_messages', resource: resource %>
    <%= f.hidden_field :reset_password_token %>

    <div>
      <div class="my-5">
        <%= render(FieldComponent.new(:password, form: f, type: :password, placeholder: 'Password', autocomplete: 'new-password', required: true)) %>
      </div>

      <div class="my-5">
        <%= render(FieldComponent.new(:password_confirmation, form: f, type: :password, placeholder: 'Password confirmation', autocomplete: 'new-password', required: true)) %>
      </div>
    </div>

    <%= render(ButtonComponent.new(text: 'Change my password')) %>
  <% end %>
</div>