enju_biblio 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,5 +1,5 @@
1
1
  class CarrierType < ActiveRecord::Base
2
- attr_accessible :name, :display_name, :note
2
+ attr_accessible :name, :display_name, :note, :position
3
3
  include MasterModel
4
4
  default_scope :order => "carrier_types.position"
5
5
  has_many :manifestations
@@ -527,7 +527,10 @@ class Manifestation < ActiveRecord::Base
527
527
  def set_patron_role_type(patron_lists, options = {:scope => :creator})
528
528
  patron_lists.each do |patron_list|
529
529
  name_and_role = patron_list[:full_name].split('||')
530
- patron = Patron.where(:full_name => name_and_role[0]).first
530
+ if patron_list[:patron_identifier].present?
531
+ patron = Patron.where(:patron_identifier => patron_list[:patron_identifier]).first
532
+ end
533
+ patron = Patron.where(:full_name => name_and_role[0]).first unless patron
531
534
  next unless patron
532
535
  type = name_and_role[1].to_s.strip
533
536
 
data/app/models/patron.rb CHANGED
@@ -228,7 +228,11 @@ class Patron < ActiveRecord::Base
228
228
  patrons = []
229
229
  patron_lists.each do |patron_list|
230
230
  name_and_role = patron_list[:full_name].split('||')
231
- patron = Patron.where(:full_name => name_and_role[0]).first
231
+ if patron_list[:patron_identifier].present?
232
+ patron = Patron.where(:patron_identifier => patron_list[:patron_identifier]).first
233
+ else
234
+ patron = Patron.where(:full_name => name_and_role[0]).first
235
+ end
232
236
  role_type = name_and_role[1].to_s.strip
233
237
  unless patron
234
238
  patron = Patron.new(
@@ -0,0 +1,47 @@
1
+ <div class="span9">
2
+ <h1 class="title">NDLサーチ検索によるインポート</h1>
3
+ <p id="notice"><%= notice %></p>
4
+
5
+ <%= form_for :books, :url => ndl_books_path, :html => {:method => 'get'} do -%>
6
+ <p>
7
+ <%= search_field_tag 'query', h(@query), {:id => 'search_form_top', :class => 'search_form'} -%>
8
+ <%= submit_tag '検索' -%>
9
+ </p>
10
+ <%- end -%>
11
+
12
+ <% if @query.present? %>
13
+ <p><%= @books.total_count %> 件が見つかりました。</p>
14
+
15
+ <table class="table table-striped index">
16
+ <tr>
17
+ <th></th>
18
+ <th>書名</th>
19
+ </tr>
20
+ <% @books.each do |book| %>
21
+ <tr class="line<%= cycle("0", "1") -%>">
22
+ <td>
23
+ <%= link_to_import(book.at('./dc:identifier[@xsi:type="dcndl:JPNO"]').try(:content).to_s) %>
24
+ </td>
25
+ <td>
26
+ <%= link_to book.at('./title').content, book.at('./link').content %>
27
+ <br />
28
+ <%= book.xpath('./dc:creator').collect(&:content).join(' ') %>
29
+ <%= book.xpath('./dc:publisher').collect(&:content).join(' ') %>
30
+ (<%= book.at('./dcterms:issued[@xsi:type="dcterms:W3CDTF"]').try(:content) %>,
31
+ ISBN: <%= book.at('./dc:identifier[@xsi:type="dcndl:ISBN"]').try(:content).to_s %>)
32
+ </td>
33
+ </tr>
34
+ <% end %>
35
+ </table>
36
+
37
+ <br />
38
+
39
+ <%= paginate(@books) %>
40
+ <% else %>
41
+ <%= javascript_tag("$('#search_form_top').focus()") -%>
42
+ <% end %>
43
+
44
+ </div>
45
+
46
+ <div class="span3">
47
+ </div>
@@ -25,7 +25,7 @@
25
25
  <% @series_statements.each do |series_statement| %>
26
26
  <tr class="line<%= cycle("0", "1") -%>">
27
27
  <td>
28
- <%- if can? :update, series_statement -%>
28
+ <%- if @query.present? and can? :update, series_statement -%>
29
29
  <%= move_position(series_statement) -%>
30
30
  <%- end -%>
31
31
  </td>
@@ -1,3 +1,3 @@
1
1
  module EnjuBiblio
2
- VERSION = "0.1.0.pre5"
2
+ VERSION = "0.1.0.pre6"
3
3
  end