psu-libraries/psulib_blacklight

View on GitHub
app/views/browse/_call_numbers.html.erb

Summary

Maintainability
Test Coverage
<h2 class="h4"><%= shelf_list.list.first.call_number %> to <%= shelf_list.list.last.call_number %></h2>

<%= render Browse::Controls.new(
      navigator: Browse::CallNumberNavigation.new(list: shelf_list)
    ) %>

<table class="table table-striped my-3">
  <thead>
    <tr>
      <th scope="col">Call Number</th>
      <th scope="col">Title</th>
      <th scope="col">Location</th>
      <th scope="col">Publication Info</th>
    </tr>
  </thead>
  <tbody>
    <% shelf_list.list.map do |shelf_item| %>
      <% if shelf_item.nearby? && !shelf_item.match? %>
        <tr class="table-primary">
          <td colspan="4"><%= shelf_item.label %></td>
        </tr>
      <% else %>
        <% shelf_item.documents.map do |doc| %>
          <tr class="<%= shelf_item.nearby? ? 'table-primary' : '' %>">
            <td>
              <%= render Browse::CallNumberDisplay.new(
                    call_number: shelf_item.call_number,
                    list: shelf_item.more_call_numbers,
                    id: doc[:id]
                  ) %>
            </td>
            <td class="text-align-start" dir="auto"><%= doc[:title_display_ssm]&.join(' / ') %></td>
            <td><%= doc.location_display %></td>
            <td><%= doc[:publication_display_ssm]&.join(' / ') %></td>
          </tr>
        <% end %>
      <% end %>
    <% end %>
  </tbody>
</table>

<%= render Browse::Controls.new(
      navigator: Browse::CallNumberNavigation.new(list: shelf_list)
    ) %>