MiraitSystems/enju_trunk

View on GitHub
app/views/page/_checkouts_list.html.erb

Summary

Maintainability
Test Coverage
<h3><%= t('checked_item.previous_checkout') -%></h3>
<%= checkout_checkout_types(@user) if @user %>
<table class="index">
  <tr>
    <%- if SystemConfiguration.get("checked_items.disp_title") -%>
      <th class="checked_item_title"><%= t('page.title') -%></th>
    <%- end -%>
    <th><%= t('activerecord.attributes.checkout.renewal_count') %></th>
    <th><%= t('activerecord.attributes.checkout.due_date') -%></th>
  </tr>

  <%- user.checkouts.not_returned.each_with_index do |checkout, i| -%>
    <tr class="line<%= cycle("0", "1") -%>">
      <%- if SystemConfiguration.get("checked_items.disp_title") -%>
        <td>
          <%= render 'manifestations/show_index', :manifestation => checkout.item.manifestation -%>
          <nobr>
          <%- if checkout.item.call_number %>
            <%= t('activerecord.attributes.item.call_number') -%>: <%= link_to call_numberformat(checkout.item), item_path(checkout.item) -%> /
          <%- end -%> 
          <%- if SystemConfiguration.get('item.use_different_identifier') %>
            <%= t('activerecord.attributes.item.identifier') %>: <%= link_to checkout.item.identifier, checkout.item %> /
          <%- end -%> 
          <%= t('activerecord.attributes.item.item_identifier') -%>: 
          <%- if checkout.item.item_identifier %>
            <%= link_to checkout.item.item_identifier, item_path(checkout.item) -%>
          <%- else -%>
            <%= link_to t('item.no_number'), checkout.item %>
          <%- end -%>
          </nobr>
        </td>
      <%- end -%>
      <td><%= checkout.checkout_renewal_count -%></td>
      <td>
        <%= l(checkout.due_date, :format => :only_date) %><br />
        <% if Time.zone.parse(checkout.due_date.to_s) < Time.now %>
          <strong style="color: red;">
            <%= t('activerecord.attributes.checkout.past_due') %>
            <%- if user_signed_in? && (current_user.has_role?('Librarian') || current_user.id == checkout.user_id) %>
              <%= t('checkout.days_overdue', :days => checkout.day_of_overdue) %>
            <%- end -%>
          </strong>
          <br />
        <% end %>
        <%- if current_user.has_role?('Librarian') %><%= link_to t('activerecord.attributes.item.loss_item'), {:controller => 'loss_items', :action => 'new', :item_id => checkout.item_id, :user_id => checkout.user.id} -%><%- end -%>
      </td>
    </tr>
  <%- end -%>
</table>