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.
- data/app/helpers/ndl_books_helper.rb +1 -1
- data/app/models/ndl_book.rb +1 -1
- data/app/views/ndl_books/index.html.erb +6 -5
- data/config/locales/en.yml +3 -0
- data/config/locales/ja.yml +1 -0
- data/lib/enju_ndl/version.rb +1 -1
- data/spec/cassette_library/enju_ndl/import.yml +916 -4023
- data/spec/cassette_library/enju_ndl/search.yml +1407 -994
- data/spec/controllers/ndl_books_controller_spec.rb +18 -1
- data/spec/dummy/app/models/user.rb +2 -0
- data/spec/dummy/db/migrate/20121116033446_add_doi_to_manifestation.rb +6 -0
- data/spec/dummy/db/schema.rb +3 -1
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/fixtures/user_has_roles.yml +41 -0
- data/spec/fixtures/users.yml +79 -0
- data/spec/models/ndl_book_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/support/controller_macros.rb +25 -0
- data/spec/support/devise.rb +1 -0
- metadata +33 -8
- data/spec/cassette_library/enju_ndl/find_by_isbn.yml +0 -136
data/app/models/ndl_book.rb
CHANGED
@@ -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"
|
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
|
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
|
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
|
-
<%=
|
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 %>
|
data/config/locales/en.yml
CHANGED
data/config/locales/ja.yml
CHANGED
data/lib/enju_ndl/version.rb
CHANGED