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.
- checksums.yaml +4 -4
- data/app/controllers/manifestations_controller.rb +1 -1
- data/app/models/manifestation.rb +20 -7
- data/app/models/series_statement.rb +2 -1
- data/app/views/manifestations/_index_form_parent.html.erb +1 -1
- data/app/views/manifestations/_show_detail_librarian.html.erb +2 -2
- data/app/views/manifestations/_show_detail_user.html.erb +2 -2
- data/app/views/manifestations/_show_holding.html.erb +1 -1
- data/app/views/resource_import_results/index.html.erb +1 -1
- data/app/views/resource_import_results/index.txt.erb +0 -1
- data/db/migrate/20151125004028_add_profile_id_to_agent.rb +6 -0
- data/lib/enju_biblio/biblio_helper.rb +2 -0
- data/lib/enju_biblio/openurl.rb +0 -0
- data/lib/enju_biblio/version.rb +1 -1
- data/spec/cassette_library/ImportRequest/import/should_import_bibliographic_record.yml +744 -0
- 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
- 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
- data/spec/cassette_library/ImportRequestsController/POST_create/When_logged_in_as_Administrator/with_valid_params/redirects_to_the_created_import_request.yml +679 -0
- 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
- data/spec/cassette_library/ImportRequestsController/POST_create/When_logged_in_as_Librarian/with_valid_params/redirects_to_the_created_import_request.yml +679 -0
- data/spec/cassette_library/ResourceImportFile/should_import_in_background.yml +512 -0
- data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/ISBN_import/with_record_not_found/should_record_an_error_message.yml +163 -0
- data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/when_it_has_only_isbn/should_be_imported.yml +793 -0
- data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/when_it_is_written_in_shift_jis/should_be_imported.yml +512 -0
- data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/when_it_is_written_in_utf-8/should_be_imported.yml +512 -0
- 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
- data/spec/controllers/manifestations_controller_spec.rb +1 -1
- data/spec/dummy/config/initializers/assets.rb +12 -0
- data/spec/fixtures/series_statements.yml +2 -2
- data/spec/models/manifestation_spec.rb +2 -1
- metadata +68 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ace895d7e5b14e0e728ce1d9d4a8f29c36371bed
|
4
|
+
data.tar.gz: ea20239fe978ec5dde3fea94a2d3ca3f3fda5a26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 = [:
|
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)
|
data/app/models/manifestation.rb
CHANGED
@@ -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
|
-
|
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: {
|
239
|
-
validates :volume_number, numericality: {
|
240
|
-
validates :serial_number, numericality: {
|
241
|
-
validates :edition, numericality: {
|
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.
|
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?
|
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,
|
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.
|
116
|
-
<%= render 'manifestations/show_holding', manifestation: manifestation, items: manifestation.items
|
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 %>
|
@@ -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(
|
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) -%>)
|
@@ -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
|
data/lib/enju_biblio/openurl.rb
CHANGED
File without changes
|
data/lib/enju_biblio/version.rb
CHANGED