gregschmit/rails-rest-framework

View on GitHub
app/views/rest_framework/routes_and_forms/_routes.html.erb

Summary

Maintainability
Test Coverage
<div class="table-responsive">
  <table class="table table-sm rrf-routes">
    <thead>
      <tr>
        <th scope="col">Path</th>
        <th scope="col">Verb</th>
        <th scope="col">Controller#Action</th>
      </tr>
    </thead>
    <%# Render first group of routes directly. %>
    <tbody>
      <% @route_groups.values[0].each do |route| %>
        <%= render partial: "rest_framework/routes_and_forms/routes/route", locals: {route: route} %>
      <% end %>
    </tbody>
    <%# Render any other groups under dropdowns. %>
    <% @route_groups.drop(1).each_with_index do |(name, route_group), index| %>
      <tr data-bs-toggle="collapse" data-bs-target="#route-group-<%= index %>" class="rrf-route-group-header">
        <td colspan="3" class="text-center user-select-none" style="cursor: pointer"><%= name %></td>
      </tr>
      <tbody id="route-group-<%= index %>" class="collapse">
        <% route_group.each do |route| %>
          <%= render partial: "rest_framework/routes_and_forms/routes/route", locals: {route: route} %>
        <% end %>
      </tbody>
    <% end %>
  </table>
</div>