spree/spree_related_products

View on GitHub
app/views/spree/admin/relation_types/index.html.erb

Summary

Maintainability
Test Coverage
<% content_for :page_title do %>
  <%= Spree::RelationType.model_name.human(count: :many) %>
<% end %>

<% content_for :page_actions do %>
  <%= button_link_to Spree.t(:new_relation_type), new_object_url, class: 'btn-primary', icon: 'add', id: 'admin_new_relation_type' %>
<% end %>

<% if @relation_types.any? %>
  <table class="table" id="listing_relation_types" data-hook>
    <colgroup>
      <col style="width: 20%" />
      <col style="width: 20%" />
      <col style="width: 40%" />
      <col style="width: 20%" />
    </colgroup>
    <thead>
      <tr data-hook="admin_relation_types_index_headers">
        <th><%= Spree.t(:name) %></th>
        <th><%= Spree.t(:applies_to) %></th>
        <th><%= Spree.t(:description) %></th>
        <th class="actions" data-hook="admin_pages_index_header_actions"></th>
      </tr>
    </thead>
    <tbody>
      <% @relation_types.each do |relation_type| %>
        <tr id="<%= spree_dom_id relation_type %>" data-hook="admin_relation_types_index_row" class="<%= cycle('odd', 'even') %>">
          <td><%= relation_type.name %></td>
          <td><%= relation_type.applies_to %></td>
          <td><%= relation_type.description %></td>
          <td class="actions" data-hook="admin_relation_types_index_row_actions">
            <%= link_to_edit relation_type, no_text: true %>
            <%= link_to_delete relation_type, no_text: true %>
          </td>
        </tr>
      <% end %>
    </tbody>
  </table>
<% else %>
  <div class="alert alert-warning no-objects-found">
    <%= Spree.t(:no_resource_found, resource: Spree::RelationType.model_name.human(count: :many)) %>,
    <%= link_to Spree.t(:add_one), spree.new_admin_relation_type_path %>!
  </div>
<% end %>