MiraitSystems/enju_trunk

View on GitHub
app/views/manifestations/_show_holding.html.erb

Summary

Maintainability
Test Coverage
<% if manifestation.items.exists? %>
<% items = manifestation.items = SystemConfiguration.get('manifestation.manage_item_rank') ? manifestation.items.sort_rank : manifestation.items %>
<% items = items.select{|i| i.has_view_role?(current_user.try(:role).try(:id)) && !hide_item?(params[:all_manifestation], i)} %>
<% unless items.blank? %>
<div id="holding">
<table class="holding">
  <tr>
    <%- if multi_libraries? %><th><%= t('activerecord.models.library') %></th><%- end -%>
    <th><%= t('activerecord.models.shelf') %></th>
    <th><%= t('activerecord.attributes.item.call_number') %></th>
    <%- unless @location_symbol_size.blank? -%>
      <th><%= t('activerecord.attributes.item.location_symbol') %></th>
    <%- end -%>
    <th><%= t('activerecord.attributes.item.item_identifier') %></th>
    <%- if SystemConfiguration.get('item.use_different_identifier') %><th><%= t('activerecord.attributes.item.identifier') %></th><%- end -%>
    <% unless manifestation.article? %>
      <th><%= t('activerecord.models.circulation_status') %></th>
    <% end %>
    <% if SystemConfiguration.get('manifestation.manage_item_rank') %>
      <% if user_signed_in? and current_user.has_role?('Librarian') %>
        <th><%= t('activerecord.attributes.item.rank') %></th>
      <% end %>
    <% end %>
  </tr>
    <% items.each do |item| %>
      <tr>
        <%- if multi_libraries? %>
          <td>
            <%= link_to item.shelf.library.display_name.localize, item.shelf.library if item.shelf.library %>
          </td>
        <%- end -%>
        <td>
          <%= link_to item.shelf.display_name.localize, item.shelf if item.shelf %>
          <%= render 'items/shelf_picture', :item => item if item.shelf %>
        </td>
        <td>
          <span class="red_string"><%= call_numberformat(item) %></span>
        </td>
        <%- unless @location_symbol_size.blank? -%>
          <td>
            <% if item.location_symbol.present? %>
              <span class="red_string"><%= item.location_symbol.keyname %></span>
            <% end %>
          </td>
        <%- end -%>
        <td>
          <% if item.item_identifier? %>
            <%= link_to item.item_identifier, item %>
          <% else %>
            (<%= link_to t('item.no_number'), item %>)
          <% end %>
        </td>
        <%- if SystemConfiguration.get('item.use_different_identifier') %>
          <td>
            <%= link_to item.identifier, item if item.identifier %>
          </td>
        <%- end -%>
        <% unless manifestation.article? %>
          <td>
            <% if item.circulation_status.name != 'Available On Shelf' %>
              <span class="not_rent_item">
                <%- if item.circulation_restriction.v != 0 %><%= item.circulation_restriction.keyname %><%- end -%>
                <%= item.circulation_status.display_name.localize if item.circulation_status %>
                <% if item.use_restriction.try(:name) == 'Not For Loan' %>
                  (<%= t('activerecord.attributes.checkout.not_available') %>)
                <% end %>
              </span>
            <% else %>
              <% if item.circulation_status %>
                <% if item.use_restriction.try(:name) != 'Not For Loan' %>
                  <%= item.circulation_status.display_name.localize %>
                <% else %>
                  <span class="not_rent_item"><%= t('activerecord.attributes.checkout.not_for_loan') %></span>
                <% end %>
              <% end %>
            <% end %>
            <% if item.rent? %>
              <% if user_signed_in? and (current_user.has_role?('Librarian') || current_user.id == item.checkout.user_id) %>
                (
                <%= t('activerecord.attributes.checkout.due_date') %>:
                <%= link_to l(item.checkout.due_date, :format => :only_date), item.checkout %>
                <% if Time.zone.parse(item.checkout.due_date.to_s) < Time.now %>
                  <span class="not_rent_item">
                    <%= t('activerecord.attributes.checkout.past_due') -%>
                    <%= t('checkout.days_overdue', :days => item.checkout.day_of_overdue) %>
                  </span>
                <% end %>
                )
              <% end %>
            <% end %>
          </td>
        <% end %>
        <% if SystemConfiguration.get('manifestation.manage_item_rank') %>
          <% if user_signed_in? and current_user.has_role?('Librarian') %>
            <td>
              <%= i18n_rank(item.rank) %>
            </td>
          <% end %>
        <% end %>
      </tr>
    <% end %>
</table>
</div>
<% end %>
<% end %>