enju_ndl 0.1.0.pre5 → 0.1.0.pre6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  module NdlBooksHelper
3
- def link_to_import(nbn)
3
+ def link_to_import_from_ndl(nbn)
4
4
  if nbn.blank?
5
5
  t('enju_ndl.not_available')
6
6
  else
@@ -64,7 +64,7 @@ class NdlBook
64
64
  def self.import_from_sru_response(jpno)
65
65
  manifestation = Manifestation.where(:nbn => jpno).first
66
66
  return if manifestation
67
- url = "http://iss.ndl.go.jp/api/sru?operation=searchRetrieve&recordSchema=dcndl&&maximumRecords=1&&query=%28jpno=#{jpno}%29"
67
+ url = "http://iss.ndl.go.jp/api/sru?operation=searchRetrieve&recordSchema=dcndl&&maximumRecords=1&&query=%28jpno=#{jpno}%29&onlyBib=true"
68
68
  xml = open(url).read
69
69
  response = Nokogiri::XML(xml).at('//xmlns:recordData')
70
70
  return unless response.try(:content)
@@ -1,27 +1,28 @@
1
1
  <div id="content_detail" class="ui-corner-all">
2
- <h1 class="title">NDLサーチ検索によるインポート</h1>
2
+ <h1 class="title"><%= t('enju_ndl.import_from_ndl_search') %></h1>
3
3
  <div id="content_list">
4
4
  <p id="notice"><%= notice %></p>
5
5
 
6
6
  <%= form_for :books, :url => ndl_books_path, :html => {:method => 'get'} do -%>
7
7
  <p>
8
+ <%= label_tag :search_form_top, t('page.search_term') -%>:
8
9
  <%= search_field_tag 'query', h(@query), {:id => 'search_form_top', :class => 'search_form'} -%>
9
- <%= submit_tag '検索' -%>
10
+ <%= submit_tag t('page.search') -%>
10
11
  </p>
11
12
  <%- end -%>
12
13
 
13
14
  <% if @query.present? %>
14
- <p><%= @books.total_count %> 件が見つかりました。</p>
15
+ <p><%= t('enju_ndl.number_of_search_results', :count => @books.total_count %></p>
15
16
 
16
17
  <table class="table table-striped index">
17
18
  <tr>
18
19
  <th></th>
19
- <th>書名</th>
20
+ <th><%= t('activerecord.attributes.manifestation.original_title') %></th>
20
21
  </tr>
21
22
  <% @books.each do |book| %>
22
23
  <tr class="line<%= cycle("0", "1") -%>">
23
24
  <td>
24
- <%= link_to_import(book.jpno) %>
25
+ <%= link_to_import_from_ndl(book.jpno) %>
25
26
  </td>
26
27
  <td>
27
28
  <%= link_to "#{book.title} #{book.volume}".strip , book.permalink %>
@@ -5,3 +5,6 @@ en:
5
5
  not_available: Not available
6
6
  add: Add
7
7
  already_exists: Already exists
8
+ number_of_search_results:
9
+ one: "1 record found."
10
+ other: "%{count} records found."
@@ -5,3 +5,4 @@ ja:
5
5
  not_available: 利用不可
6
6
  add: 追加
7
7
  already_exists: 登録済み
8
+ number_of_search_results: "%{count} 件の資料が見つかりました。"
@@ -1,3 +1,3 @@
1
1
  module EnjuNdl
2
- VERSION = "0.1.0.pre5"
2
+ VERSION = "0.1.0.pre6"
3
3
  end