enju_biblio 0.3.11 → 0.3.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/agent_import_results_controller.rb +1 -1
- data/app/controllers/agents_controller.rb +0 -6
- data/app/controllers/items_controller.rb +15 -10
- data/app/controllers/manifestations_controller.rb +68 -76
- data/app/controllers/resource_import_results_controller.rb +2 -2
- data/app/controllers/series_statements_controller.rb +0 -6
- data/app/helpers/manifestations_helper.rb +8 -8
- data/app/models/agent.rb +10 -1
- data/app/models/form_of_work.rb +1 -1
- data/app/models/frequency.rb +1 -1
- data/app/models/identifier.rb +1 -1
- data/app/models/import_request.rb +2 -3
- data/app/models/item.rb +6 -6
- data/app/models/item_custom_value.rb +1 -1
- data/app/models/manifestation.rb +10 -18
- data/app/models/manifestation_custom_value.rb +1 -1
- data/app/models/resource_import_file.rb +8 -4
- data/app/views/agent_import_results/{index.txt.ruby → index.text.ruby} +0 -0
- data/app/views/agent_relationship_types/index.html.erb +3 -3
- data/app/views/agents/index.rss.builder +2 -2
- data/app/views/items/_item.json.jbuilder +17 -0
- data/app/views/items/index.json.jbuilder +5 -0
- data/app/views/items/index.text.ruby +13 -0
- data/app/views/items/show.html.erb +125 -125
- data/app/views/items/show.json.jbuilder +1 -0
- data/app/views/layouts/agents.html.erb +2 -2
- data/app/views/layouts/manifestations.html.erb +2 -2
- data/app/views/manifestations/_carrier_type_facet.html.erb +1 -1
- data/app/views/manifestations/_classification_facet.html.erb +2 -2
- data/app/views/manifestations/_export_list.html.erb +4 -4
- data/app/views/manifestations/_form.html.erb +3 -3
- data/app/views/manifestations/_language_facet.html.erb +1 -1
- data/app/views/manifestations/_library_facet.html.erb +1 -1
- data/app/views/manifestations/_pub_year_facet.html.erb +1 -1
- data/app/views/manifestations/_reservable_facet.html.erb +2 -2
- data/app/views/manifestations/_show_detail_librarian.html.erb +12 -8
- data/app/views/manifestations/_show_detail_user.html.erb +12 -8
- data/app/views/manifestations/_title.html.erb +1 -1
- data/app/views/manifestations/index.html.erb +7 -7
- data/app/views/manifestations/index.rdf.builder +2 -2
- data/app/views/manifestations/index.rss.builder +2 -2
- data/app/views/manifestations/index.text.ruby +13 -0
- data/app/views/manifestations/{show.txt.ruby → show.text.ruby} +0 -0
- data/app/views/resource_import_results/{index.txt.ruby → index.text.ruby} +0 -0
- data/lib/enju_biblio/version.rb +1 -1
- data/lib/enju_biblio.rb +0 -2
- data/spec/controllers/items_controller_spec.rb +41 -0
- data/spec/controllers/manifestations_controller_spec.rb +2 -21
- data/spec/fixtures/items.yml +1 -0
- data/spec/fixtures/manifestations.yml +1 -0
- data/spec/models/manifestation_spec.rb +11 -66
- data/spec/models/resource_import_file_spec.rb +18 -0
- data/spec/system/items_spec.rb +6 -0
- data/spec/views/agent_import_results/{index.txt.ruby_spec.rb → index.text.ruby_spec.rb} +1 -1
- data/spec/views/items/index.json.jbuilder_spec.rb +15 -0
- data/spec/views/items/show.json.jbuilder_spec.rb +15 -0
- data/spec/views/manifestations/index.html.erb_spec.rb +1 -1
- data/spec/views/manifestations/index.rdf.builder_spec.rb +0 -1
- data/spec/views/manifestations/{index.txt.ruby_spec.rb → index.text.ruby_spec.rb} +1 -1
- data/spec/views/manifestations/{show.txt.ruby_spec.rb → show.text.ruby_spec.rb} +1 -1
- data/spec/views/resource_import_results/{index.txt.ruby_spec.rb → index.text.ruby_spec.rb} +1 -1
- metadata +37 -34
- data/app/views/items/index.txt.erb +0 -4
- data/app/views/manifestations/explain.sru +0 -9
- data/app/views/manifestations/index.sru.builder +0 -101
- data/app/views/manifestations/index.txt.ruby +0 -7
- data/lib/enju_biblio/porta_cql.rb +0 -282
- data/lib/enju_biblio/sru.rb +0 -85
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '088d27a989a71a9301fd1946a90d8c790720b2ecffa02bc2eef9d3a9c05a31bb'
|
4
|
+
data.tar.gz: b946f1cd533e99b47cb6a799a3d0f167b597d6291ee864372354037dfc3ad050
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5815c72d545147d3048239c9c52749a1239ff73e06aa2fbc8e37014d8272b8d87b9dcd7c260b321512fd7bbc47d1383548abddff5bbfb5431c7f78aa7335cad4
|
7
|
+
data.tar.gz: b4da9e3a16f2a498cd8b70478422fb37dd511a69cb3bb94252d53c3c7df9e2876006c45a843915d594424350eac2f0f41ae567107d04aa60f812f59656d658d2
|
@@ -227,10 +227,4 @@ class AgentsController < ApplicationController
|
|
227
227
|
@languages = Language.all
|
228
228
|
@agent_type = AgentType.where(name: 'person').first
|
229
229
|
end
|
230
|
-
|
231
|
-
def filtered_params
|
232
|
-
params.permit([:view, :format, :page, :language, :sort_by, :per_page])
|
233
|
-
end
|
234
|
-
|
235
|
-
helper_method :filtered_params
|
236
230
|
end
|
@@ -18,7 +18,7 @@ class ItemsController < ApplicationController
|
|
18
18
|
@count = {}
|
19
19
|
if user_signed_in?
|
20
20
|
if current_user.has_role?('Librarian')
|
21
|
-
if params[:format] == '
|
21
|
+
if params[:format] == 'text'
|
22
22
|
per_page = 65534
|
23
23
|
elsif params[:mode] == 'barcode'
|
24
24
|
per_page = 40
|
@@ -51,6 +51,17 @@ class ItemsController < ApplicationController
|
|
51
51
|
|
52
52
|
unless @inventory_file
|
53
53
|
search = Sunspot.new_search(Item)
|
54
|
+
selected_attributes = [
|
55
|
+
:id, :item_identifier, :call_number, :manifestation_id, :acquired_at,
|
56
|
+
:binding_item_identifier, :binding_call_number, :binded_at,
|
57
|
+
:include_supplements, :url, :note,
|
58
|
+
:circulation_status_id, :shelf_id,
|
59
|
+
:created_at, :updated_at
|
60
|
+
]
|
61
|
+
selected_attributes += [
|
62
|
+
:memo, :required_role_id, :budget_type_id, :bookstore_id, :price
|
63
|
+
] if current_user.try(:has_role?, 'Librarian')
|
64
|
+
search.data_accessor_for(Item).select = selected_attributes
|
54
65
|
set_role_query(current_user, search)
|
55
66
|
|
56
67
|
@query = query.dup
|
@@ -122,8 +133,8 @@ class ItemsController < ApplicationController
|
|
122
133
|
|
123
134
|
respond_to do |format|
|
124
135
|
format.html # index.html.erb
|
125
|
-
format.json
|
126
|
-
format.
|
136
|
+
format.json
|
137
|
+
format.text
|
127
138
|
format.atom
|
128
139
|
end
|
129
140
|
end
|
@@ -137,7 +148,7 @@ class ItemsController < ApplicationController
|
|
137
148
|
|
138
149
|
respond_to do |format|
|
139
150
|
format.html # show.html.erb
|
140
|
-
format.json
|
151
|
+
format.json
|
141
152
|
end
|
142
153
|
end
|
143
154
|
|
@@ -301,10 +312,4 @@ class ItemsController < ApplicationController
|
|
301
312
|
end
|
302
313
|
end
|
303
314
|
end
|
304
|
-
|
305
|
-
def filtered_params
|
306
|
-
params.permit([:view, :format, :page, :library, :carrier_type, :reservable, :pub_date_from, :pub_date_until, :language, :sort_by, :per_page])
|
307
|
-
end
|
308
|
-
|
309
|
-
helper_method :filtered_params
|
310
315
|
end
|
@@ -29,29 +29,18 @@ class ManifestationsController < ApplicationController
|
|
29
29
|
sort, @count = {}, {}
|
30
30
|
query = ""
|
31
31
|
|
32
|
-
if
|
32
|
+
if request.format.text?
|
33
33
|
per_page = 65534
|
34
34
|
end
|
35
35
|
|
36
|
-
if params[:
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
else
|
42
|
-
render template: 'manifestations/explain', layout: false
|
43
|
-
return
|
44
|
-
end
|
36
|
+
if params[:api] == 'openurl'
|
37
|
+
openurl = Openurl.new(params)
|
38
|
+
@manifestations = openurl.search
|
39
|
+
query = openurl.query_text
|
40
|
+
sort = set_search_result_order(params[:sort_by], params[:order])
|
45
41
|
else
|
46
|
-
|
47
|
-
|
48
|
-
@manifestations = openurl.search
|
49
|
-
query = openurl.query_text
|
50
|
-
sort = set_search_result_order(params[:sort_by], params[:order])
|
51
|
-
else
|
52
|
-
query = make_query(params[:query], params)
|
53
|
-
sort = set_search_result_order(params[:sort_by], params[:order])
|
54
|
-
end
|
42
|
+
query = make_query(params[:query], params)
|
43
|
+
sort = set_search_result_order(params[:sort_by], params[:order])
|
55
44
|
end
|
56
45
|
|
57
46
|
# 絞り込みを行わない状態のクエリ
|
@@ -191,37 +180,37 @@ class ManifestationsController < ApplicationController
|
|
191
180
|
else
|
192
181
|
per_page = Manifestation.default_per_page
|
193
182
|
end
|
194
|
-
|
195
|
-
|
183
|
+
|
184
|
+
pub_dates = parse_pub_date(params)
|
185
|
+
pub_date_range = {}
|
186
|
+
|
187
|
+
if pub_dates[:from] == '*'
|
188
|
+
pub_date_range[:from] = 0
|
196
189
|
else
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
if pub_dates[:until] == '*'
|
205
|
-
pub_date_range[:until] = 10000
|
206
|
-
else
|
207
|
-
pub_date_range[:until] = Time.zone.parse(pub_dates[:until]).year
|
208
|
-
end
|
209
|
-
if params[:pub_year_range_interval]
|
210
|
-
pub_year_range_interval = params[:pub_year_range_interval].to_i
|
211
|
-
else
|
212
|
-
pub_year_range_interval = @library_group.pub_year_facet_range_interval || 10
|
213
|
-
end
|
190
|
+
pub_date_range[:from] = Time.zone.parse(pub_dates[:from]).year
|
191
|
+
end
|
192
|
+
if pub_dates[:until] == '*'
|
193
|
+
pub_date_range[:until] = 10000
|
194
|
+
else
|
195
|
+
pub_date_range[:until] = Time.zone.parse(pub_dates[:until]).year
|
196
|
+
end
|
214
197
|
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
198
|
+
if params[:pub_year_range_interval]
|
199
|
+
pub_year_range_interval = params[:pub_year_range_interval].to_i
|
200
|
+
else
|
201
|
+
pub_year_range_interval = @library_group.pub_year_facet_range_interval || 10
|
202
|
+
end
|
203
|
+
|
204
|
+
search.build do
|
205
|
+
facet :reservable if defined?(EnjuCirculation)
|
206
|
+
facet :carrier_type
|
207
|
+
facet :library
|
208
|
+
facet :language
|
209
|
+
facet :pub_year, range: pub_date_range[:from]..pub_date_range[:until], range_interval: pub_year_range_interval
|
210
|
+
facet :subject_ids if defined?(EnjuSubject)
|
211
|
+
paginate page: page.to_i, per_page: per_page
|
224
212
|
end
|
213
|
+
|
225
214
|
search_result = search.execute
|
226
215
|
if @count[:query_result] > @max_number_of_results
|
227
216
|
max_count = @max_number_of_results
|
@@ -261,9 +250,8 @@ class ManifestationsController < ApplicationController
|
|
261
250
|
format.html
|
262
251
|
format.html.phone
|
263
252
|
format.xml { render xml: @manifestations }
|
264
|
-
format.sru { render layout: false }
|
265
253
|
format.rss { render layout: false }
|
266
|
-
format.
|
254
|
+
format.text { render layout: false }
|
267
255
|
format.rdf { render layout: false }
|
268
256
|
format.atom
|
269
257
|
format.mods
|
@@ -333,8 +321,8 @@ class ManifestationsController < ApplicationController
|
|
333
321
|
format.rdf
|
334
322
|
format.mods
|
335
323
|
format.json
|
336
|
-
format.
|
337
|
-
format.js
|
324
|
+
format.text
|
325
|
+
format.js { render template: 'manifestations/show.js' }
|
338
326
|
format.download {
|
339
327
|
if @manifestation.attachment.path
|
340
328
|
if ENV['ENJU_STORAGE'] == 's3'
|
@@ -394,11 +382,8 @@ class ManifestationsController < ApplicationController
|
|
394
382
|
# POST /manifestations
|
395
383
|
# POST /manifestations.json
|
396
384
|
def create
|
397
|
-
|
398
|
-
|
399
|
-
k == 'creators_attributes'
|
400
|
-
})
|
401
|
-
parent = Manifestation.where(id: @manifestation.parent_id).first
|
385
|
+
@manifestation = Manifestation.new(manifestation_params)
|
386
|
+
parent = Manifestation.find_by(id: @manifestation.parent_id)
|
402
387
|
unless @manifestation.original_title?
|
403
388
|
@manifestation.original_title = @manifestation.attachment_file_name
|
404
389
|
end
|
@@ -406,14 +391,16 @@ class ManifestationsController < ApplicationController
|
|
406
391
|
respond_to do |format|
|
407
392
|
if @manifestation.save
|
408
393
|
Manifestation.transaction do
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
394
|
+
set_creators
|
395
|
+
|
396
|
+
if parent
|
397
|
+
parent.derived_manifestations << @manifestation
|
398
|
+
parent.index
|
399
|
+
@manifestation.index
|
400
|
+
end
|
401
|
+
|
402
|
+
Sunspot.commit
|
415
403
|
end
|
416
|
-
Sunspot.commit
|
417
404
|
|
418
405
|
format.html { redirect_to @manifestation, notice: t('controller.successfully_created', model: t('activerecord.models.manifestation')) }
|
419
406
|
format.json { render json: @manifestation, status: :created, location: @manifestation }
|
@@ -428,17 +415,11 @@ class ManifestationsController < ApplicationController
|
|
428
415
|
# PUT /manifestations/1
|
429
416
|
# PUT /manifestations/1.json
|
430
417
|
def update
|
431
|
-
|
432
|
-
@manifestation.assign_attributes(manifestation_params.delete_if{|k, v|
|
433
|
-
k == 'creators_attributes'
|
434
|
-
})
|
418
|
+
@manifestation.assign_attributes(manifestation_params)
|
435
419
|
|
436
420
|
respond_to do |format|
|
437
|
-
if @manifestation.
|
438
|
-
|
439
|
-
@manifestation.creators = Agent.new_agents(creators_params)
|
440
|
-
@manifestation.save!
|
441
|
-
end
|
421
|
+
if @manifestation.save
|
422
|
+
set_creators
|
442
423
|
|
443
424
|
format.html { redirect_to @manifestation, notice: t('controller.successfully_updated', model: t('activerecord.models.manifestation')) }
|
444
425
|
format.json { head :no_content }
|
@@ -856,9 +837,20 @@ class ManifestationsController < ApplicationController
|
|
856
837
|
query
|
857
838
|
end
|
858
839
|
|
859
|
-
def
|
860
|
-
|
861
|
-
|
840
|
+
def set_creators
|
841
|
+
creators_params = manifestation_params[:creators_attributes]
|
842
|
+
contributors_params = manifestation_params[:contributors_attributes]
|
843
|
+
publishers_params = manifestation_params[:publishers_attributes]
|
844
|
+
|
845
|
+
Manifestation.transaction do
|
846
|
+
@manifestation.creates.destroy_all
|
847
|
+
@manifestation.realizes.destroy_all
|
848
|
+
@manifestation.produces.destroy_all
|
849
|
+
@manifestation.reload
|
862
850
|
|
863
|
-
|
851
|
+
@manifestation.creators = Agent.new_agents(creators_params)
|
852
|
+
@manifestation.contributors = Agent.new_agents(contributors_params)
|
853
|
+
@manifestation.publishers = Agent.new_agents(publishers_params)
|
854
|
+
end
|
855
|
+
end
|
864
856
|
end
|
@@ -7,7 +7,7 @@ class ResourceImportResultsController < ApplicationController
|
|
7
7
|
def index
|
8
8
|
@resource_import_file = ResourceImportFile.find_by(id: params[:resource_import_file_id])
|
9
9
|
if @resource_import_file
|
10
|
-
if params[:format].to_s.downcase == '
|
10
|
+
if params[:format].to_s.downcase == 'text'
|
11
11
|
@resource_import_results = @resource_import_file.resource_import_results
|
12
12
|
else
|
13
13
|
@resource_import_results = @resource_import_file.resource_import_results.page(params[:page])
|
@@ -19,7 +19,7 @@ class ResourceImportResultsController < ApplicationController
|
|
19
19
|
respond_to do |format|
|
20
20
|
format.html # index.html.erb
|
21
21
|
format.json { render json: @resource_import_results }
|
22
|
-
format.
|
22
|
+
format.text
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -71,10 +71,10 @@ module ManifestationsHelper
|
|
71
71
|
current = true if languages.include?(language.name)
|
72
72
|
if current
|
73
73
|
content_tag :strong do
|
74
|
-
link_to("#{language.display_name.localize} (" + facet.count.to_s + ")", url_for(
|
74
|
+
link_to("#{language.display_name.localize} (" + facet.count.to_s + ")", url_for(request.params.merge(page: nil, language: language.name, view: nil, only_path: true)))
|
75
75
|
end
|
76
76
|
else
|
77
|
-
link_to("#{language.display_name.localize} (" + facet.count.to_s + ")", url_for(
|
77
|
+
link_to("#{language.display_name.localize} (" + facet.count.to_s + ")", url_for(request.params.merge(page: nil, language: language.name, view: nil, only_path: true)))
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
@@ -86,10 +86,10 @@ module ManifestationsHelper
|
|
86
86
|
content_tag :li do
|
87
87
|
if current
|
88
88
|
content_tag :strong do
|
89
|
-
link_to("#{library.display_name.localize} (" + facet.count.to_s + ")", url_for(
|
89
|
+
link_to("#{library.display_name.localize} (" + facet.count.to_s + ")", url_for(request.params.merge(page: nil, library: (current_libraries << library.name).uniq.join(' '), view: nil, only_path: true)))
|
90
90
|
end
|
91
91
|
else
|
92
|
-
link_to("#{library.display_name.localize} (" + facet.count.to_s + ")", url_for(
|
92
|
+
link_to("#{library.display_name.localize} (" + facet.count.to_s + ")", url_for(request.params.merge(page: nil, library: (current_libraries << library.name).uniq.join(' '), view: nil, only_path: true)))
|
93
93
|
end
|
94
94
|
end
|
95
95
|
end
|
@@ -102,10 +102,10 @@ module ManifestationsHelper
|
|
102
102
|
current = true if params[:carrier_type] == carrier_type.name
|
103
103
|
if current
|
104
104
|
content_tag :strong do
|
105
|
-
link_to("#{carrier_type.display_name.localize} (" + facet.count.to_s + ")", url_for(
|
105
|
+
link_to("#{carrier_type.display_name.localize} (" + facet.count.to_s + ")", url_for(request.params.merge(carrier_type: carrier_type.name, page: nil, view: nil, only_path: true)))
|
106
106
|
end
|
107
107
|
else
|
108
|
-
link_to("#{carrier_type.display_name.localize} (" + facet.count.to_s + ")", url_for(
|
108
|
+
link_to("#{carrier_type.display_name.localize} (" + facet.count.to_s + ")", url_for(request.params.merge(carrier_type: carrier_type.name, page: nil, view: nil, only_path: true)))
|
109
109
|
end
|
110
110
|
end
|
111
111
|
end
|
@@ -115,10 +115,10 @@ module ManifestationsHelper
|
|
115
115
|
current = true if facet.value.first.to_i == pub_date_from.to_i and facet.value.last.to_i - 1 == pub_date_until.to_i
|
116
116
|
if current
|
117
117
|
content_tag :strong do
|
118
|
-
link_to("#{facet.value.first.to_i} - #{facet.value.last.to_i - 1} (" + facet.count.to_s + ")", url_for(
|
118
|
+
link_to("#{facet.value.first.to_i} - #{facet.value.last.to_i - 1} (" + facet.count.to_s + ")", url_for(request.params.merge(pub_date_from: facet.value.first.to_i, pub_date_until: facet.value.last.to_i - 1, page: nil, view: nil, only_path: true)))
|
119
119
|
end
|
120
120
|
else
|
121
|
-
link_to("#{facet.value.first.to_i} - #{facet.value.last.to_i - 1} (" + facet.count.to_s + ")", url_for(
|
121
|
+
link_to("#{facet.value.first.to_i} - #{facet.value.last.to_i - 1} (" + facet.count.to_s + ")", url_for(request.params.merge(pub_date_from: facet.value.first.to_i, pub_date_until: facet.value.last.to_i - 1, page: nil, view: nil, only_path: true)))
|
122
122
|
end
|
123
123
|
end
|
124
124
|
|
data/app/models/agent.rb
CHANGED
@@ -256,17 +256,26 @@ class Agent < ApplicationRecord
|
|
256
256
|
Agent.transaction do
|
257
257
|
agents_params.each do |k, v|
|
258
258
|
next if v['_destroy'] == '1'
|
259
|
+
|
260
|
+
agent = nil
|
261
|
+
|
259
262
|
if v['agent_id'].present?
|
260
263
|
agent = Agent.find(v['agent_id'])
|
261
264
|
elsif v['id'].present?
|
262
265
|
agent = Agent.find(v['id'])
|
263
|
-
|
266
|
+
end
|
267
|
+
|
268
|
+
if !agent or agent.full_name != v['full_name']
|
269
|
+
v.delete('id')
|
270
|
+
v.delete('agent_id')
|
264
271
|
v.delete('_destroy')
|
265
272
|
agent = Agent.create(v)
|
266
273
|
end
|
274
|
+
|
267
275
|
agents << agent
|
268
276
|
end
|
269
277
|
end
|
278
|
+
|
270
279
|
agents
|
271
280
|
end
|
272
281
|
end
|
data/app/models/form_of_work.rb
CHANGED
data/app/models/frequency.rb
CHANGED
data/app/models/identifier.rb
CHANGED
@@ -8,7 +8,7 @@ class Identifier < ApplicationRecord
|
|
8
8
|
before_validation :normalize
|
9
9
|
before_save :convert_isbn
|
10
10
|
scope :id_type, -> type {
|
11
|
-
where(identifier_type: IdentifierType.
|
11
|
+
where(identifier_type: IdentifierType.find_by(name: type))
|
12
12
|
}
|
13
13
|
|
14
14
|
acts_as_list scope: :manifestation_id
|
@@ -27,9 +27,8 @@ class ImportRequest < ApplicationRecord
|
|
27
27
|
|
28
28
|
def check_imported
|
29
29
|
if isbn.present?
|
30
|
-
identifier_type = IdentifierType.
|
31
|
-
|
32
|
-
if Identifier.where(body: isbn, identifier_type_id: identifier_type.id).first.try(:manifestation)
|
30
|
+
identifier_type = IdentifierType.find_by_or_create!(name: 'isbn')
|
31
|
+
if Identifier.find_by(body: isbn, identifier_type_id: identifier_type.id)&.manifestation
|
33
32
|
errors.add(:isbn, I18n.t('import_request.isbn_taken'))
|
34
33
|
end
|
35
34
|
end
|
data/app/models/item.rb
CHANGED
@@ -66,23 +66,23 @@ class Item < ApplicationRecord
|
|
66
66
|
paginates_per 10
|
67
67
|
|
68
68
|
def title
|
69
|
-
manifestation
|
69
|
+
manifestation&.original_title
|
70
70
|
end
|
71
71
|
|
72
72
|
def creator
|
73
|
-
manifestation
|
73
|
+
manifestation&.creator
|
74
74
|
end
|
75
75
|
|
76
76
|
def contributor
|
77
|
-
manifestation
|
77
|
+
manifestation&.contributor
|
78
78
|
end
|
79
79
|
|
80
80
|
def publisher
|
81
|
-
manifestation
|
81
|
+
manifestation&.publisher
|
82
82
|
end
|
83
83
|
|
84
84
|
def owned(agent)
|
85
|
-
owns.
|
85
|
+
owns.find_by(agent_id: agent.id)
|
86
86
|
end
|
87
87
|
|
88
88
|
def manifestation_url
|
@@ -123,7 +123,7 @@ class Item < ApplicationRecord
|
|
123
123
|
budget_type: budget_type&.name,
|
124
124
|
item_required_role: required_role.name,
|
125
125
|
item_price: price,
|
126
|
-
|
126
|
+
item_memo: memo
|
127
127
|
})
|
128
128
|
|
129
129
|
ItemCustomProperty.order(:position).each do |custom_property|
|
data/app/models/manifestation.rb
CHANGED
@@ -5,12 +5,12 @@ class Manifestation < ApplicationRecord
|
|
5
5
|
enju_nii_cinii_books if defined?(EnjuNii)
|
6
6
|
enju_bookmark_manifestation_model if defined?(EnjuBookmark)
|
7
7
|
|
8
|
-
has_many :creates, dependent: :destroy, foreign_key: 'work_id'
|
9
|
-
has_many :creators, through: :creates, source: :agent
|
10
|
-
has_many :realizes, dependent: :destroy, foreign_key: 'expression_id'
|
11
|
-
has_many :contributors, through: :realizes, source: :agent
|
12
|
-
has_many :produces, dependent: :destroy, foreign_key: 'manifestation_id'
|
13
|
-
has_many :publishers, through: :produces, source: :agent
|
8
|
+
has_many :creates, -> { order('creates.position') }, dependent: :destroy, foreign_key: 'work_id'
|
9
|
+
has_many :creators, through: :creates, source: :agent
|
10
|
+
has_many :realizes, -> { order('realizes.position') }, dependent: :destroy, foreign_key: 'expression_id'
|
11
|
+
has_many :contributors, through: :realizes, source: :agent
|
12
|
+
has_many :produces, -> { order('produces.position') }, dependent: :destroy, foreign_key: 'manifestation_id'
|
13
|
+
has_many :publishers, through: :produces, source: :agent
|
14
14
|
has_many :items, dependent: :destroy
|
15
15
|
has_many :children, foreign_key: 'parent_id', class_name: 'ManifestationRelationship', dependent: :destroy
|
16
16
|
has_many :parents, foreign_key: 'child_id', class_name: 'ManifestationRelationship', dependent: :destroy
|
@@ -37,7 +37,7 @@ class Manifestation < ApplicationRecord
|
|
37
37
|
text :title, default_boost: 2 do
|
38
38
|
titles
|
39
39
|
end
|
40
|
-
[ :fulltext, :note, :creator, :contributor, :publisher, :description, :statement_of_responsibility ].each do |field|
|
40
|
+
[ :fulltext, :note, :creator, :contributor, :publisher, :abstract, :description, :statement_of_responsibility ].each do |field|
|
41
41
|
text field do
|
42
42
|
if series_master?
|
43
43
|
derived_manifestations.map{|c| c.send(field) }.flatten.compact
|
@@ -518,16 +518,7 @@ class Manifestation < ApplicationRecord
|
|
518
518
|
end
|
519
519
|
|
520
520
|
def identifier_contents(name)
|
521
|
-
|
522
|
-
identifiers.id_type(name).order(:position).pluck(:body)
|
523
|
-
else
|
524
|
-
identifier_type = IdentifierType.find_by(name: name)
|
525
|
-
if identifier_type
|
526
|
-
identifiers.where(identifier_type_id: identifier_type.id).order(:position).pluck(:body)
|
527
|
-
else
|
528
|
-
[]
|
529
|
-
end
|
530
|
-
end
|
521
|
+
identifiers.id_type(name).order(:position).pluck(:body)
|
531
522
|
end
|
532
523
|
|
533
524
|
# CSVのヘッダ
|
@@ -596,6 +587,7 @@ class Manifestation < ApplicationRecord
|
|
596
587
|
price: price,
|
597
588
|
access_address: access_address,
|
598
589
|
manifestation_required_role: required_role.name,
|
590
|
+
abstract: abstract,
|
599
591
|
description: description,
|
600
592
|
note: note
|
601
593
|
}
|
@@ -624,7 +616,7 @@ class Manifestation < ApplicationRecord
|
|
624
616
|
|
625
617
|
if ['Administrator', 'Librarian'].include?(role)
|
626
618
|
record.merge!({
|
627
|
-
|
619
|
+
manifestation_memo: memo
|
628
620
|
})
|
629
621
|
ManifestationCustomProperty.order(:position).each do |custom_property|
|
630
622
|
custom_value = manifestation_custom_values.find_by(manifestation_custom_property: custom_property)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class ManifestationCustomValue < ApplicationRecord
|
2
2
|
belongs_to :manifestation_custom_property
|
3
|
-
belongs_to :manifestation,
|
3
|
+
belongs_to :manifestation, optional: true
|
4
4
|
validates :manifestation_custom_property, uniqueness: {scope: :manifestation_id}
|
5
5
|
end
|
6
6
|
|
@@ -458,12 +458,12 @@ class ResourceImportFile < ApplicationRecord
|
|
458
458
|
edition edition_string serial_number isbn issn manifestation_price
|
459
459
|
width height depth number_of_pages jpno lccn budget_type bookstore
|
460
460
|
language fulltext_content required_role doi content_type frequency
|
461
|
-
extent start_page end_page dimensions
|
461
|
+
extent start_page end_page dimensions abstract manifestation_memo
|
462
462
|
ncid
|
463
463
|
ndl_bib_id
|
464
464
|
statement_of_responsibility acquired_at call_number circulation_status
|
465
465
|
binding_item_identifier binding_call_number binded_at item_price
|
466
|
-
use_restriction include_supplements item_note item_url
|
466
|
+
use_restriction include_supplements item_note item_url item_memo
|
467
467
|
dummy
|
468
468
|
)
|
469
469
|
header_columns += ManifestationCustomProperty.order(:position).pluck(:name).map{|c| "manifestation:#{c}"}
|
@@ -541,7 +541,8 @@ class ResourceImportFile < ApplicationRecord
|
|
541
541
|
binding_call_number: row['binding_call_number'],
|
542
542
|
binded_at: binded_at,
|
543
543
|
url: row['item_url'],
|
544
|
-
note: row['item_note'].try(:gsub, /\\n/, "\n")
|
544
|
+
note: row['item_note'].try(:gsub, /\\n/, "\n"),
|
545
|
+
memo: row['item_memo'].try(:gsub, /\\n/, "\n")
|
545
546
|
)
|
546
547
|
manifestation.items << item
|
547
548
|
if defined?(EnjuCirculation)
|
@@ -600,6 +601,7 @@ class ResourceImportFile < ApplicationRecord
|
|
600
601
|
|
601
602
|
item.price = row['item_price'] if row['item_price'].present?
|
602
603
|
item.note = row['item_note'].try(:gsub, /\\n/, "\n") if row['item_note'].present?
|
604
|
+
item.memo = row['item_memo'].try(:gsub, /\\n/, "\n") if row['item_memo'].present?
|
603
605
|
item.url = row['item_url'] if row['item_url'].present?
|
604
606
|
|
605
607
|
if row['include_supplements']
|
@@ -716,9 +718,11 @@ class ResourceImportFile < ApplicationRecord
|
|
716
718
|
depth: row['depth'],
|
717
719
|
height: row['height'],
|
718
720
|
price: row['manifestation_price'],
|
721
|
+
abstract: row['abstract'].try(:gsub, /\\n/, "\n"),
|
719
722
|
description: row['description'].try(:gsub, /\\n/, "\n"),
|
720
723
|
#:description_transcription => row['description_transcription'],
|
721
724
|
note: row['note'].try(:gsub, /\\n/, "\n"),
|
725
|
+
memo: row['manifestation_memo'].try(:gsub, /\\n/, "\n"),
|
722
726
|
statement_of_responsibility: row['statement_of_responsibility'],
|
723
727
|
access_address: row['access_address'],
|
724
728
|
manifestation_identifier: row['manifestation_identifier'],
|
@@ -783,7 +787,7 @@ class ResourceImportFile < ApplicationRecord
|
|
783
787
|
unless identifiers.empty?
|
784
788
|
identifiers.each do |v|
|
785
789
|
v.manifestation = manifestation
|
786
|
-
v.save
|
790
|
+
v.save
|
787
791
|
end
|
788
792
|
end
|
789
793
|
else
|
File without changes
|
@@ -18,7 +18,7 @@
|
|
18
18
|
<%- @agent_relationship_types.each do |agent_relationship_type| -%>
|
19
19
|
<tr class="line<%= cycle("0", "1") -%>">
|
20
20
|
<td>
|
21
|
-
<%- if policy(
|
21
|
+
<%- if policy(agent_relationship_type).update? -%>
|
22
22
|
<%= move_position(agent_relationship_type) -%>
|
23
23
|
<%- end -%>
|
24
24
|
</td>
|
@@ -29,10 +29,10 @@
|
|
29
29
|
<%= agent_relationship_type.note %>
|
30
30
|
</td>
|
31
31
|
<td>
|
32
|
-
<%- if policy(
|
32
|
+
<%- if policy(agent_relationship_type).update? -%>
|
33
33
|
<%= link_to t('page.edit'), edit_agent_relationship_type_path(agent_relationship_type) -%>
|
34
34
|
<% end %>
|
35
|
-
<%- if policy(
|
35
|
+
<%- if policy(agent_relationship_type).destroy? -%>
|
36
36
|
<%= link_to t('page.destroy'), agent_relationship_type_path(agent_relationship_type), data: {confirm: t('page.are_you_sure')}, method: :delete -%>
|
37
37
|
<%- end -%>
|
38
38
|
</td>
|