delonnewman/dragnet

View on GitHub
app/views/data_grid/_rows.html.erb

Summary

Maintainability
Test Coverage
<% grid.records.each do |record| %>
  <tr>
    <td class="text-nowrap text-muted">
      <small><%= fmt_datetime record.created_at %></small>
    </td>
    <% grid.questions.each do |question| %>
      <td><%= answers_text record, question %></td>
    <% end %>
  </tr>
<% end %>

<% if grid.show_load_more? %>
  <tr id="the-end">
    <td colspan="<%= grid.questions.count + 1 %>">
      <%= htmx :button, { get: survey_data_rows_path(grid.survey, page: grid.pager.next), target: '#the-end', swap: 'outerHTML' }, { class: 'btn btn-sm btn-light' } do %>
        Load more...
      <% end %>
    </td>
  </tr>
<% end %>