enju_biblio 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/manifestations_controller.rb +1 -1
  3. data/app/models/manifestation.rb +20 -7
  4. data/app/models/series_statement.rb +2 -1
  5. data/app/views/manifestations/_index_form_parent.html.erb +1 -1
  6. data/app/views/manifestations/_show_detail_librarian.html.erb +2 -2
  7. data/app/views/manifestations/_show_detail_user.html.erb +2 -2
  8. data/app/views/manifestations/_show_holding.html.erb +1 -1
  9. data/app/views/resource_import_results/index.html.erb +1 -1
  10. data/app/views/resource_import_results/index.txt.erb +0 -1
  11. data/db/migrate/20151125004028_add_profile_id_to_agent.rb +6 -0
  12. data/lib/enju_biblio/biblio_helper.rb +2 -0
  13. data/lib/enju_biblio/openurl.rb +0 -0
  14. data/lib/enju_biblio/version.rb +1 -1
  15. data/spec/cassette_library/ImportRequest/import/should_import_bibliographic_record.yml +744 -0
  16. data/spec/cassette_library/ImportRequestsController/POST_create/When_logged_in_as_Administrator/with_isbn_which_is_already_imported/redirects_to_the_created_import_request.yml +679 -0
  17. data/spec/cassette_library/ImportRequestsController/POST_create/When_logged_in_as_Administrator/with_valid_params/assigns_a_newly_created_import_request_as_import_request.yml +679 -0
  18. data/spec/cassette_library/ImportRequestsController/POST_create/When_logged_in_as_Administrator/with_valid_params/redirects_to_the_created_import_request.yml +679 -0
  19. data/spec/cassette_library/ImportRequestsController/POST_create/When_logged_in_as_Librarian/with_valid_params/assigns_a_newly_created_import_request_as_import_request.yml +679 -0
  20. data/spec/cassette_library/ImportRequestsController/POST_create/When_logged_in_as_Librarian/with_valid_params/redirects_to_the_created_import_request.yml +679 -0
  21. data/spec/cassette_library/ResourceImportFile/should_import_in_background.yml +512 -0
  22. data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/ISBN_import/with_record_not_found/should_record_an_error_message.yml +163 -0
  23. data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/when_it_has_only_isbn/should_be_imported.yml +793 -0
  24. data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/when_it_is_written_in_shift_jis/should_be_imported.yml +512 -0
  25. data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/when_it_is_written_in_utf-8/should_be_imported.yml +512 -0
  26. data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/when_it_is_written_in_utf-8/should_send_message_when_import_is_completed.yml +512 -0
  27. data/spec/controllers/manifestations_controller_spec.rb +1 -1
  28. data/spec/dummy/config/initializers/assets.rb +12 -0
  29. data/spec/fixtures/series_statements.yml +2 -2
  30. data/spec/models/manifestation_spec.rb +2 -1
  31. metadata +68 -27
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 420146237b4ee065377d6d04b4d80a5b80da822d
4
- data.tar.gz: 937a5994763dc2ea8563525ec7b2a1050a66bfc7
3
+ metadata.gz: ace895d7e5b14e0e728ce1d9d4a8f29c36371bed
4
+ data.tar.gz: ea20239fe978ec5dde3fea94a2d3ca3f3fda5a26
5
5
  SHA512:
6
- metadata.gz: d68d8ecd5b4b97d2c7cd5ded4b3a4beb8414cbdf3e930d671520f147dea668dc8fc8e1398af5c636fd343cc708825de892700e128849d2ac7f402c7e6f5f05e3
7
- data.tar.gz: b4f0a86ff49946e88f4c7fe4cc33be5dd24d0171809b61a7c6a2b4428589db9c406c2e4e4d7e9bdbe5d386a64cb3f0e9d7ceec1d120dbfbef3268fd9430a1b76
6
+ metadata.gz: 18a33b8a691b5da9847041b968437c7a3ddae772386fbe5131b22b6bc994d812ab126b781220f5c26acd5b5fd649c12ab9e99f7ab24c8eec9149e5549690db60
7
+ data.tar.gz: 8ec3f4441684a5f345c00b1b42ec018512ad44323ef83ea5d8c78d587798fc8cea2f19c61f003e3a082dec53b4c0d7b4d84c8920cd6434ceccf58eb2dde67bd7
@@ -60,7 +60,7 @@ class ManifestationsController < ApplicationController
60
60
  @query = query.dup
61
61
  query = query.gsub(' ', ' ')
62
62
 
63
- includes = [:root_series_statement]
63
+ includes = [:series_statements]
64
64
  includes << :classifications if defined?(EnjuSubject)
65
65
  includes << :bookmarks if defined?(EnjuBookmark)
66
66
  search = Manifestation.search(include: includes)
@@ -27,7 +27,6 @@ class Manifestation < ActiveRecord::Base
27
27
  belongs_to :carrier_type
28
28
  belongs_to :manifestation_content_type, class_name: 'ContentType', foreign_key: 'content_type_id'
29
29
  has_many :series_statements
30
- has_one :root_series_statement, foreign_key: 'root_manifestation_id', class_name: 'SeriesStatement'
31
30
  belongs_to :frequency
32
31
  belongs_to :required_role, class_name: 'Role', foreign_key: 'required_role_id', validate: true
33
32
  has_one :resource_import_result
@@ -69,7 +68,14 @@ class Manifestation < ActiveRecord::Base
69
68
  end
70
69
  string :isbn, multiple: true do
71
70
  identifier_contents(:isbn).map{|i|
72
- [Lisbn.new(i).isbn10, Lisbn.new(i).isbn13]
71
+ isbn10 = isbn13 = isbn10_dash = isbn13_dash = nil
72
+ isbn10 = Lisbn.new(i).isbn10
73
+ isbn13 = Lisbn.new(i).isbn13
74
+ isbn10_dash = Lisbn.new(isbn10).isbn_with_dash if isbn10
75
+ isbn13_dash = Lisbn.new(isbn13).isbn_with_dash if isbn13
76
+ [
77
+ isbn10, isbn13, isbn10_dash, isbn13_dash
78
+ ]
73
79
  }.flatten
74
80
  end
75
81
  string :issn, multiple: true do
@@ -235,10 +241,10 @@ class Manifestation < ActiveRecord::Base
235
241
  validates :manifestation_identifier, uniqueness: true, allow_blank: true
236
242
  validates :pub_date, format: {with: /\A\[{0,1}\d+([\/-]\d{0,2}){0,2}\]{0,1}\z/}, allow_blank: true
237
243
  validates :access_address, url: true, allow_blank: true, length: {maximum: 255}
238
- validates :issue_number, numericality: {greater_than: 0}, allow_blank: true
239
- validates :volume_number, numericality: {greater_than: 0}, allow_blank: true
240
- validates :serial_number, numericality: {greater_than: 0}, allow_blank: true
241
- validates :edition, numericality: {greater_than: 0}, allow_blank: true
244
+ validates :issue_number, numericality: {greater_than_or_equal_to: 0}, allow_blank: true
245
+ validates :volume_number, numericality: {greater_than_or_equal_to: 0}, allow_blank: true
246
+ validates :serial_number, numericality: {greater_than_or_equal_to: 0}, allow_blank: true
247
+ validates :edition, numericality: {greater_than_or_equal_to: 0}, allow_blank: true
242
248
  after_create :clear_cached_numdocs
243
249
  before_save :set_date_of_publication, :set_number
244
250
  after_save :index_series_statement, :extract_text!
@@ -530,6 +536,7 @@ class Manifestation < ActiveRecord::Base
530
536
  manifestation_id
531
537
  original_title
532
538
  creator
539
+ contributor
533
540
  publisher
534
541
  pub_date
535
542
  manifestation_price
@@ -567,6 +574,7 @@ class Manifestation < ActiveRecord::Base
567
574
  item_lines << m.id
568
575
  item_lines << m.original_title
569
576
  item_lines << m.creators.pluck(:full_name).join("//")
577
+ item_lines << m.contributors.pluck(:full_name).join("//")
570
578
  item_lines << m.publishers.pluck(:full_name).join("//")
571
579
  item_lines << m.pub_date
572
580
  item_lines << m.price
@@ -596,6 +604,7 @@ class Manifestation < ActiveRecord::Base
596
604
  line << m.id
597
605
  line << m.original_title
598
606
  line << m.creators.pluck(:full_name).join("//")
607
+ line << m.contributors.pluck(:full_name).join("//")
599
608
  line << m.publishers.pluck(:full_name).join("//")
600
609
  line << m.pub_date
601
610
  line << m.price
@@ -609,11 +618,15 @@ class Manifestation < ActiveRecord::Base
609
618
  end
610
619
  end
611
620
  if options[:format] == :txt
612
- lines.map{|i| i.join("\t")}.join("\r\n")
621
+ lines.map{|i| i.to_csv(col_sep: "\t")}.join
613
622
  else
614
623
  lines
615
624
  end
616
625
  end
626
+
627
+ def root_series_statement
628
+ series_statements.where(root_manifestation_id: id).first
629
+ end
617
630
  end
618
631
 
619
632
  # == Schema Information
@@ -4,6 +4,7 @@ class SeriesStatement < ActiveRecord::Base
4
4
  belongs_to :manifestation, touch: true
5
5
  belongs_to :root_manifestation, foreign_key: :root_manifestation_id, class_name: 'Manifestation', touch: true
6
6
  validates_presence_of :original_title
7
+ validates :root_manifestation_id, uniqueness: true, allow_nil: true
7
8
  before_save :create_root_series_statement
8
9
 
9
10
  acts_as_list
@@ -30,7 +31,7 @@ class SeriesStatement < ActiveRecord::Base
30
31
  end
31
32
 
32
33
  def create_root_series_statement
33
- if series_master? && root_manifestation.nil?
34
+ if series_master?
34
35
  self.root_manifestation = manifestation
35
36
  else
36
37
  self.root_manifestation = nil
@@ -16,7 +16,7 @@
16
16
  <%= search_field_tag 'query', h(@query), {id: 'search_form_top', class: 'search_form', placeholder: t('page.search_term')} -%>
17
17
  <%= hidden_field_tag 'parent_id', @parent.id -%>
18
18
  <%= hidden_field_tag 'reservable', h(@reservable) if @reservable -%>
19
- <% if can? :update, Manifestation %>
19
+ <% if can? :update, @parent %>
20
20
  <%= render 'page/add' %>
21
21
  <% end %>
22
22
  <%= submit_tag t('page.search') -%>
@@ -112,8 +112,8 @@
112
112
  </tr>
113
113
  </table>
114
114
  <% end %>
115
- <%- if manifestation.items.on_shelf.exists? -%>
116
- <%= render 'manifestations/show_holding', manifestation: manifestation, items: manifestation.items.on_shelf -%>
115
+ <%- if manifestation.items.exists? -%>
116
+ <%= render 'manifestations/show_holding', manifestation: manifestation, items: manifestation.items %>
117
117
  <%- end -%>
118
118
  <%- if can? :create, Item -%>
119
119
  <p><%= link_to t('page.new', model: t('activerecord.models.item')), new_item_path(manifestation_id: manifestation.id) -%></p>
@@ -112,8 +112,8 @@
112
112
  <% end %>
113
113
  </table>
114
114
  <% end %>
115
- <%- if manifestation.items.on_shelf.exists? -%>
116
- <%= render 'manifestations/show_holding', manifestation: manifestation -%>
115
+ <%- if manifestation.items.for_checkout.on_shelf.exists? -%>
116
+ <%= render 'manifestations/show_holding', manifestation: manifestation, items: manifestation.items.for_checkout.on_shelf %>
117
117
  <%- end -%>
118
118
  </div>
119
119
  <%= render 'manifestations/tab_list', manifestation: manifestation %>
@@ -10,7 +10,7 @@
10
10
  <th><%= t('activerecord.models.circulation_status') -%></th>
11
11
  <% end %>
12
12
  </tr>
13
- <%- items.each do |item| -%>
13
+ <%- manifestation.items.each do |item| -%>
14
14
  <tr>
15
15
  <td>
16
16
  <%- if item.item_identifier? -%>
@@ -17,7 +17,7 @@
17
17
  <li>
18
18
  <% if @resource_import_file %>
19
19
  <%= link_to((image_tag 'icons/page_white_excel.png', size: '16x16', alt: 'TSV', class: 'icon'), resource_import_results_path(resource_import_file_id: @resource_import_file.id, format: :txt)) -%>
20
- (<%= link_to 'TSV', resource_import_results_path(resource_imporf_file_id: @resource_import_file.id, format: :txt) -%>)
20
+ (<%= link_to 'TSV', resource_import_results_path(resource_import_file_id: @resource_import_file.id, format: :txt) -%>)
21
21
  <% else %>
22
22
  <%= link_to((image_tag 'icons/page_white_excel.png', size: '16x16', alt: 'TSV', class: 'icon'), resource_import_results_path(format: :txt)) -%>
23
23
  (<%= link_to 'TSV', resource_import_results_path(format: :txt) -%>)
@@ -1,4 +1,3 @@
1
- manifestation_id item_id
2
1
  <%- @resource_import_results.each do |resource_import_result| -%>
3
2
  <%= resource_import_result.manifestation_id %> <%= resource_import_result.item_id %> <%= resource_import_result.body %>
4
3
  <%- end -%>
@@ -0,0 +1,6 @@
1
+ class AddProfileIdToAgent < ActiveRecord::Migration
2
+ def change
3
+ add_column :agents, :profile_id, :integer
4
+ add_index :agents, :profile_id
5
+ end
6
+ end
@@ -66,6 +66,8 @@ module EnjuBiblio
66
66
  link_to identifier.body, "http://lccn.loc.gov/#{identifier.body}"
67
67
  when 'ncid'
68
68
  link_to identifier.body, "http://ci.nii.ac.jp/ncid/#{identifier.body}"
69
+ when 'isbn'
70
+ Lisbn.new(identifier.body).isbn_with_dash
69
71
  else
70
72
  identifier.body
71
73
  end
File without changes
@@ -1,3 +1,3 @@
1
1
  module EnjuBiblio
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end