active_element

0.0.13
Light Mode Dark Mode

Item Table

The Item Table component provides a horizontal table containing a single item and its attributes. Use with an Active Record model instance, an object that extends ActiveModel::Naming, or a simple hash-like object.

See the full keyword argument specification for information on the various available options.

item = User.new(name: 'John', email: 'john@example.com', overview: 'Writes Ruby code for a living.')

subject do
  active_element.component.table item: item,
                                 fields: [:name, :email, :overview],
                                 edit: true,
                                 destroy: true
end

it { is_expected.to include 'John' }
<a data-confirm-action="true" class="btn btn-danger destroy-button action-button float-end " title="Delete" rel="nofollow" data-method="delete" href="/user/">
  <span class="text-nowrap">
    <i class="fa-solid fa-square-xmark"></i>
    <span class="button-title">Delete</span>
  </span>
</a>
<a data-confirm-action="false" class="btn btn-primary edit-button action-button float-end " title="Edit" href="/user//edit">
  <span class="text-nowrap">
    <i class="fa-solid fa-pen"></i>
    <span class="button-title">Edit</span>
  </span>
</a>
<table class="user table" style="">
  <tbody>
    <tr>
      <th>
        Name
      </th>
      <td class="user-name">
        <span class="name">
          John
        </span>
      </td>
    </tr>
    <tr>
      <th>
        Email
      </th>
      <td class="user-email">
        john@example.com
      </td>
    </tr>
    <tr>
      <th>
        Overview
      </th>
      <td class="user-overview">
        Writes Ruby code for a living.
      </td>
    </tr>
  </tbody>
</table>
Delete Edit
Name John
Email john@example.com
Overview Writes Ruby code for a living.

Documentation generated by rspec-documentation