MiraitSystems/enju_trunk

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

Summary

Maintainability
Test Coverage
<div id="content_detail" class="ui-corner-all" >
  <h1 class="title">
    <%= t('page.showing', :model => t('activerecord.models.manifestation')) -%>
  </h1>
  <div id="content_list">
    <p id="notice"><%= notice -%></p>
    <%= form_for :manifestation, {:url => manifestations_path, :method => 'get'} do -%>
      <div>
        <%= paginate_ncid_link(@nacsis_cat) -%>
        <%= back_to_manifestation_index %>
        <%= t('page.search_term') -%>:
        <%= search_field_tag 'query', params[:query], {:id => "search_form_top", :class => 'search_form_short', :placeholder => t('page.search_term')} -%>
        <%= hidden_field_tag 'user_id', params[:user_id] if params[:user_id] %>
        <%= hidden_field_tag 'removed', true if @removed %>
        <%= hidden_advanced_search_field_tags -%>
        <%= submit_tag t('page.search') -%>
        <% if params[:query].present? %>
          <input type="button" value="<%= t('page.search_clear') -%>" onclick='<%= "$(" + "'#search_form_top" + "').val('')" %>' >
        <% end %>
        <%- if SystemConfiguration.get('nacsis.use_cat') -%>
          <br />
          <%= radio_button_tag 'index', 'local', params[:index] == "local" ? true : false -%><%= t('page.search_local', :library => "#{LibraryGroup.first.display_name}") -%>
          <%= radio_button_tag 'index', 'nacsis', params[:index] == "nacsis" ? true : false, {:checked => true} -%><%= t('page.search_nacsis') -%>
          <br />
        <%- end -%>
        <% unless SystemConfiguration.get("manifestation.show_all") %>
          <% if user_signed_in? and current_user.has_role?('Librarian') %>
            <% if params[:all_manifestations] %>
              <%= check_box_tag 'all_manifestations', true, true %>
            <% else %>
              <%= check_box_tag 'all_manifestations', true %>
            <% end %>
            <%= t('advanced_search.all_manifestations') %><br />
          <% end %>
        <% end %>
        <%= link_to_advanced_search %> <%= link_to_normal_search %> <%= advanced_search_condition_summary %>
      </div>
    <% end %>
    <h2 class="resource_title">
      <%= @nacsis_cat.request_summary[:subject_heading] -%>
    </h2>
    <p style="margin: -12px 0 0 0; font-size: 90%">
      <%= @nacsis_cat.request_summary[:all] %>
    </p>
    </br>

    <div id="tabs">
      <%# タブの設定 %>
      <ul>
        <li class="selected"><a href="#detail"><em><%= t('page.detail') -%></em></a></li>
      </ul>

      <%# 詳細の項目表示 %>
      <div id="detail">
        <table>
        <%# 表示をしない項目の設定 %>
        <%- omit_display = ['size','publication_place','subjects','creators','publishers']-%>
        <%- @nacsis_cat.detail.each_key do |key| -%>
          <%- next if omit_display.include?(key.to_s) -%>
          <tr>
            <td style="width: 200px"><%= t('activerecord.attributes.nacsis_user_request.'+key.to_s) -%></td>
          <%- case key -%>
          <%- when :publisher, :subject, :ndlcn, :other_number, :xissn -%>
            <td style="width: 490px"><%= @nacsis_cat.detail[key].join(", ") -%></td>
          <%- when :pub_country -%>
            <td><%= @nacsis_cat.detail[key].try(:display_name).try(:localize) -%> </td>
          <%- when :title_language, :text_language, :original_language -%>
            <td><%= @nacsis_cat.detail[key].map{|lang| lang.display_name.localize}.join(", ") -%> </td>
          <%- when :author_heading -%>
            <td><%= @nacsis_cat.detail[key].join(" ") -%></td>
          <%- when :cls_info -%>
            <td>
              <%- @nacsis_cat.detail[key].each do |cls_key, cls_value| -%>
                <%= cls_key.to_s + ": " + cls_value.to_s -%>&nbsp;
              <%- end -%>
            </td>
          <%- when :vol_info, :ptb_info, :utl_info, :bhn_info, :cw_info, :other_titles -%>
            <td>
              <%- @nacsis_cat.detail[key].each do |info| -%>
                <%- info.each do |info_key, info_value| %>
                  <%= t('activerecord.attributes.nacsis_user_request.' + info_key.to_s) -%>
                  <%= ": " + info_value.to_s -%>&nbsp;
                <%- end -%>
                <br />
              <%- end -%>
            </td>
          <%- else -%>
            <td><%= @nacsis_cat.detail[key] -%></td>
          <%- end -%>
          </tr>
        <%- end -%>
        </table>
        </br>

        <table class="holding">
          <tr>
            <th><%= t('activerecord.attributes.manifestation.hold_dbname') -%></th>
            <th><%= t('activerecord.attributes.manifestation.hold_id') -%></th>
            <th><%= t('activerecord.attributes.manifestation.hold_libabl') -%></th>
            <th><%= t('activerecord.attributes.manifestation.hold_cln') -%></th>
            <th><%= t('activerecord.attributes.manifestation.hold_rgtn') -%></th>
          </tr>
          <%- @items.each do |x| item_summary = x.summary -%>
          <tr>
            <td><%= item_summary[:database] -%></td>
            <td><%= item_summary[:hold_id] -%></td>
            <td><%= item_summary[:library_abbrev] -%></td>
            <td><%= item_summary[:cln] -%></td>
            <td>
              <%- if item_summary[:database] == 'BHOLD' -%>
                <%= item_summary[:rgtn] -%>
              <%- end -%>
            </td>
          </tr>
          <%- end -%>
        </table>
      </div>
    </div>
  </div>
</div>

<div id="submenu" class="ui-corner-all">
  <ul>
    <%- if SystemConfiguration.get('nacsis.use_ill') && (can? :create, NacsisUserRequest) %>
      <li>
        <%= link_to t('activerecord.models.nacsis_request_lend'),
          {:controller => "nacsis_user_requests",
           :action => "new",
           :ncid => @nacsis_cat.ncid,
           :manifestation_type => params[:manifestation_type],
           :request_type => "1" } -%>
      </li>
      <li>
        <%= link_to t('activerecord.models.nacsis_request_copy'),
          {:controller => "nacsis_user_requests",
           :action => "new",
           :ncid => @nacsis_cat.ncid,
           :manifestation_type => params[:manifestation_type],
           :request_type => "2" } -%>
      </li>
    <%- end -%>
    <% if @nacsis_cat.manifestation %>
      <li>
        <%= link_to t('page.search_local', :library => "#{LibraryGroup.first.display_name}"), @nacsis_cat.manifestation %>
      </li>
    <% else %>
      <% if SystemConfiguration.get('nacsis.use_cat') && user_signed_in? && current_user.has_role?('Librarian') %>
        <li>
          <%= form_tag create_from_nacsis_manifestations_path, method: 'post' do %>
            <%= hidden_field_tag 'ncid', @nacsis_cat.ncid %>
            <%= hidden_field_tag 'manifestation_type', params[:manifestation_type] %>
            <%= submit_tag t('.local_import') %>
          <% end %>
        </li>
      <% end %>
    <% end %>
  </ul>
</div>