MiraitSystems/enju_trunk

View on GitHub
app/views/opac/manifestations/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.search_resource', :model => t('page.resource')) %></h1>
    </div>
    <div class="opac_head_button_area">
      <div class="opac_head_button"><%= link_to t('opac.catalog_search'), opac_search_path %></div>
      <div class="opac_head_button"><%= link_to t('opac.finish'), opac_path %></div>
    </div>
  </div>
</div>

<div id="opac_content"> 
  <% case %>
  <% when @series_statement %>
    <h2 class="resource_title">
      <%= @series_statement.original_title %>
    </h2>
  <% else%>
    <div>
      <%= t('page.search_term') %>: <%= @query %><br />
    </div>
  <% end %>

  <% if @manifestations && (@manifestations.size > 0) %> 
    <p>
      <%= t('page.number_of_search_results', :count => @count[:query_result]) %>
      <% if @count[:query_result] > SystemConfiguration.get("max_number_of_results") %>
        <br />
        <%= t('page.limit_exceeded', :count => SystemConfiguration.get("max_number_of_results")) %>
      <% end %>
    </p>

    <%= render 'opac/manifestations/sort_menu' %>

    <table class="index" id="opac_lists" style="clear: both;">
      <% @manifestations.each do |manifestation| %>
        <tr class="opac_line<%= cycle("0", "1") %> opac_lists_row" data-href="<%= opac_manifestation_path(manifestation) %>">
          <td>
            <%= render 'opac/manifestations/title', :manifestation => manifestation %>
          </td>
          <td class="sub_column">
            <% unless manifestation.items.empty? %>
              <div class="opac_list_sub"><%= t('opac.manifestations.holding') %></div>
            <% end %>
            <% if user_signed_in? %>
              <% if current_user.reserves.user_show_reserves.inject([]){ |manifestations, reserve| manifestations << reserve.manifestation }.include?(manifestation) %>
                <div class="opac_list_sub"><%= t('opac.manifestations.reserved') %></div>
              <% end %> 
            <% end %>
          </td>
        </tr>
      <% end %>
    </table>
    <%= paginate @manifestations, :theme => 'opac_theme' %>
  <% else %>
    <br />
    <h4><%= render 'opac/manifestations/not_found' %></h4>
  <% end %>
</div>