MiraitSystems/enju_trunk

View on GitHub
app/views/opac/checkouts/index.html.erb

Summary

Maintainability
Test Coverage
<script>
$(function() {
    $('.opac_lists_row').click(function(e) {
      if(!$(e.target).is('a')){
        window.location = $(e.target).closest('tr').data('href');
      };
  });
});
</script>

<div id="opac_content_header">
  <div id="opac_content">
    <div class="opac_title"><h1><%= t('page.listing', :model => t('activerecord.models.checkout')) %></h1></div>
    <div class="opac_head_button_area">
      <div class="opac_head_button">
        <%= link_to t('opac.finish'), opac_path %>
      </div>
    </div>
  </div>
</div>

<div id="opac_content">
  <p id="notice"><%= notice %></p>
  <% unless @checkouts.size == 0 %>
    <div id="opac_button_200">
      <%= link_to t('activerecord.attributes.checkout.output_checkoutlist'), user_checkouts_path(@user, :format => 'pdf') %>
    </div>
  <% end %>

  <table class="index" id="opac_lists">
    <tr>
      <th class="checkout_title"><%= t('page.title') %></th>
      <th class="checkout_due_date"><%= t('activerecord.attributes.checkout.due_date') %></th>
      <th class="checkout_renewal_count"><%= t('activerecord.attributes.checkout.renewal_count') %></th>
    </tr>
    <% @checkouts.each_with_index do |checkout, i| %>
      <% if checkout.due_date > Date.today %>
        <tr class="opac_line<%= cycle("0", "1") %> opac_lists_row" data-href="<%= user_checkout_path(checkout.user, checkout, :opac => true) %>">
      <% else %>
        <tr class="opac_line_checkout_overdue_date %> opac_lists_row" data-href="<%= user_checkout_path(checkout.user, checkout, :opac => true) %>">
      <% end %>
        <td>
          <%= render 'opac/manifestations/title', :manifestation => checkout.item.manifestation %>
          <div class="opac_list_sub">
            <%= t('activerecord.attributes.item.call_number') %>: 
            <%= link_to call_numberformat(checkout.item), item_path(checkout.item) %> /
            &nbsp;&nbsp;
            <%= t('activerecord.attributes.item.item_identifier') %>: 
            <%= checkout.item.item_identifier %>
          </div>
        </td>
        <td>
          <%= l(checkout.due_date, :format => :only_date) %>
          <% if checkout.due_date < Date.today %>
            <br /><p style="color: red;"><%= t('page.overdue')%></p>
          <% end %>
        </td>
        <td><%= checkout.checkout_renewal_count -%> / <%= checkout.item.checkout_status(checkout.user).checkout_renewal_limit-%></td>
      </tr>
    <% end %>
  </table>
  <%= paginate(@checkouts) %>

  <% if @checkouts.size == 0 %>
    <h4><%= t('checkout.no_checkout') %></h4>
  <% end %>
</div>