enju_biblio 0.1.0.pre63 → 0.1.0.pre64
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_files_controller.rb +9 -2
- data/app/controllers/agent_import_results_controller.rb +7 -0
- data/app/controllers/agent_merge_lists_controller.rb +7 -2
- data/app/controllers/agent_merges_controller.rb +7 -2
- data/app/controllers/agent_relationship_types_controller.rb +9 -4
- data/app/controllers/agent_relationships_controller.rb +8 -2
- data/app/controllers/agent_types_controller.rb +9 -4
- data/app/controllers/agents_controller.rb +15 -10
- data/app/controllers/carrier_types_controller.rb +14 -2
- data/app/controllers/content_types_controller.rb +9 -4
- data/app/controllers/countries_controller.rb +11 -4
- data/app/controllers/create_types_controller.rb +9 -4
- data/app/controllers/creates_controller.rb +8 -2
- data/app/controllers/donates_controller.rb +7 -2
- data/app/controllers/form_of_works_controller.rb +9 -4
- data/app/controllers/frequencies_controller.rb +9 -4
- data/app/controllers/identifier_types_controller.rb +11 -4
- data/app/controllers/import_requests_controller.rb +15 -2
- data/app/controllers/items_controller.rb +21 -3
- data/app/controllers/languages_controller.rb +12 -4
- data/app/controllers/licenses_controller.rb +9 -4
- data/app/controllers/manifestation_relationship_types_controller.rb +11 -4
- data/app/controllers/manifestation_relationships_controller.rb +8 -2
- data/app/controllers/manifestations_controller.rb +105 -10
- data/app/controllers/medium_of_performances_controller.rb +9 -4
- data/app/controllers/owns_controller.rb +7 -2
- data/app/controllers/picture_files_controller.rb +8 -2
- data/app/controllers/produce_types_controller.rb +9 -4
- data/app/controllers/produces_controller.rb +8 -2
- data/app/controllers/realize_types_controller.rb +11 -4
- data/app/controllers/realizes_controller.rb +8 -2
- data/app/controllers/resource_export_files_controller.rb +7 -2
- data/app/controllers/resource_import_files_controller.rb +9 -2
- data/app/controllers/resource_import_results_controller.rb +7 -0
- data/app/controllers/series_statement_merge_lists_controller.rb +7 -2
- data/app/controllers/series_statement_merges_controller.rb +9 -2
- data/app/controllers/series_statements_controller.rb +13 -2
- data/app/models/agent.rb +0 -9
- data/app/models/agent_import_file.rb +3 -3
- data/app/models/agent_import_file_transition.rb +1 -1
- data/app/models/agent_import_result.rb +0 -1
- data/app/models/agent_merge.rb +0 -1
- data/app/models/agent_merge_list.rb +0 -1
- data/app/models/agent_relationship.rb +0 -1
- data/app/models/agent_relationship_type.rb +0 -1
- data/app/models/agent_type.rb +0 -1
- data/app/models/carrier_type.rb +1 -7
- data/app/models/content_type.rb +0 -1
- data/app/models/country.rb +0 -1
- data/app/models/create.rb +0 -1
- data/app/models/create_type.rb +0 -1
- data/app/models/donate.rb +0 -1
- data/app/models/enju_biblio/ability.rb +25 -2
- data/app/models/exemplify.rb +1 -1
- data/app/models/form_of_work.rb +0 -1
- data/app/models/frequency.rb +0 -1
- data/app/models/identifier.rb +1 -1
- data/app/models/identifier_type.rb +0 -1
- data/app/models/import_request.rb +8 -7
- data/app/models/import_request_transition.rb +1 -1
- data/app/models/item.rb +0 -5
- data/app/models/language.rb +0 -2
- data/app/models/license.rb +0 -1
- data/app/models/manifestation.rb +29 -33
- data/app/models/manifestation_relationship.rb +0 -1
- data/app/models/manifestation_relationship_type.rb +0 -1
- data/app/models/medium_of_performance.rb +0 -1
- data/app/models/own.rb +0 -1
- data/app/models/picture_file.rb +1 -3
- data/app/models/produce.rb +0 -1
- data/app/models/produce_type.rb +0 -1
- data/app/models/realize.rb +0 -1
- data/app/models/realize_type.rb +0 -1
- data/app/models/resource_export_file.rb +9 -3
- data/app/models/resource_export_file_transition.rb +1 -1
- data/app/models/resource_import_file.rb +18 -10
- data/app/models/resource_import_file_transition.rb +1 -1
- data/app/models/resource_import_result.rb +0 -1
- data/app/models/series_statement.rb +0 -7
- data/app/models/series_statement_merge.rb +0 -1
- data/app/models/series_statement_merge_list.rb +0 -1
- data/app/views/items/index.html.erb +11 -0
- data/app/views/layouts/items.html.erb +29 -0
- data/app/views/manifestations/_form.html.erb +3 -3
- data/app/views/manifestations/_index_form_series_statement.html.erb +1 -1
- data/app/views/manifestations/_list.html.erb +15 -0
- data/app/views/manifestations/_manifestation.html.erb +59 -38
- data/app/views/manifestations/_pickup.html.erb +8 -0
- data/app/views/manifestations/_show_detail_librarian.html.erb +8 -0
- data/app/views/manifestations/_show_detail_user.html.erb +8 -0
- data/app/views/manifestations/_show_holding.html.erb +19 -0
- data/app/views/manifestations/_submenu_parent.html.erb +3 -0
- data/app/views/manifestations/index.atom.builder +3 -0
- data/app/views/manifestations/index.html.erb +31 -1
- data/app/views/manifestations/index.opds.builder +3 -0
- data/app/views/manifestations/show.html.erb +4 -1
- data/app/views/resource_export_files/index.html.erb +2 -2
- data/app/views/resource_export_files/show.html.erb +1 -1
- data/config/locales/translation_en.yml +1 -0
- data/config/locales/translation_ja.yml +1 -0
- data/db/migrate/20150117111136_add_foreign_key_to_items_referencing_manifestations.rb +5 -0
- data/lib/enju_biblio/biblio_helper.rb +2 -0
- data/lib/enju_biblio/engine.rb +0 -1
- data/lib/enju_biblio/version.rb +1 -1
- data/spec/controllers/agent_import_files_controller_spec.rb +3 -3
- data/spec/controllers/agent_merge_lists_controller_spec.rb +2 -2
- data/spec/controllers/agent_merges_controller_spec.rb +1 -1
- data/spec/controllers/agent_types_controller_spec.rb +8 -8
- data/spec/controllers/carrier_types_controller_spec.rb +8 -8
- data/spec/controllers/content_types_controller_spec.rb +8 -8
- data/spec/controllers/create_types_controller_spec.rb +6 -6
- data/spec/controllers/form_of_works_controller_spec.rb +6 -6
- data/spec/controllers/frequencies_controller_spec.rb +8 -8
- data/spec/controllers/identifier_types_controller_spec.rb +8 -8
- data/spec/controllers/licenses_controller_spec.rb +6 -6
- data/spec/controllers/manifestations_controller_spec.rb +22 -2
- data/spec/controllers/medium_of_performances_controller_spec.rb +6 -6
- data/spec/controllers/produce_types_controller_spec.rb +6 -6
- data/spec/controllers/realize_types_controller_spec.rb +6 -6
- data/spec/controllers/resource_export_files_controller_spec.rb +23 -23
- data/spec/controllers/resource_import_files_controller_spec.rb +4 -4
- data/spec/dummy/app/models/user.rb +0 -1
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +29 -0
- data/spec/dummy/config/application.rb +2 -2
- data/spec/dummy/config/boot.rb +4 -9
- data/spec/dummy/config/environment.rb +3 -3
- data/spec/dummy/db/schema.rb +118 -118
- data/spec/factories/manifestation.rb +8 -0
- data/spec/factories/series_statement.rb +5 -0
- data/spec/fixtures/events.yml +13 -39
- data/spec/fixtures/identifier_types.yml +7 -0
- data/spec/fixtures/identifiers.yml +7 -0
- data/spec/fixtures/manifestations.yml +9 -0
- data/spec/fixtures/use_restrictions.yml +1 -1
- data/spec/views/manifestations/show.html.erb_spec.rb +8 -0
- metadata +31 -43
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/script/rails +0 -6
- data/spec/dummy/tmp/cache/stdout +0 -25
- data/spec/dummy/tmp/pids/redis-test.pid +0 -1
@@ -38,11 +38,11 @@ class FormOfWorksController < ApplicationController
|
|
38
38
|
# POST /form_of_works
|
39
39
|
# POST /form_of_works.json
|
40
40
|
def create
|
41
|
-
@form_of_work = FormOfWork.new(
|
41
|
+
@form_of_work = FormOfWork.new(form_of_work_params)
|
42
42
|
|
43
43
|
respond_to do |format|
|
44
44
|
if @form_of_work.save
|
45
|
-
format.html { redirect_to @form_of_work, notice:
|
45
|
+
format.html { redirect_to @form_of_work, notice: t('controller.successfully_created', model: t('activerecord.models.form_of_work')) }
|
46
46
|
format.json { render json: @form_of_work, status: :created, location: @form_of_work }
|
47
47
|
else
|
48
48
|
format.html { render action: "new" }
|
@@ -60,8 +60,8 @@ class FormOfWorksController < ApplicationController
|
|
60
60
|
end
|
61
61
|
|
62
62
|
respond_to do |format|
|
63
|
-
if @form_of_work.update_attributes(
|
64
|
-
format.html { redirect_to @form_of_work, notice:
|
63
|
+
if @form_of_work.update_attributes(form_of_work_params)
|
64
|
+
format.html { redirect_to @form_of_work, notice: t('controller.successfully_updated', model: t('activerecord.models.form_of_work')) }
|
65
65
|
format.json { head :no_content }
|
66
66
|
else
|
67
67
|
format.html { render action: "edit" }
|
@@ -80,4 +80,9 @@ class FormOfWorksController < ApplicationController
|
|
80
80
|
format.json { head :no_content }
|
81
81
|
end
|
82
82
|
end
|
83
|
+
|
84
|
+
private
|
85
|
+
def form_of_work_params
|
86
|
+
params.require(:form_of_work).permit(:name, :display_name, :note)
|
87
|
+
end
|
83
88
|
end
|
@@ -38,11 +38,11 @@ class FrequenciesController < ApplicationController
|
|
38
38
|
# POST /frequencies
|
39
39
|
# POST /frequencies.json
|
40
40
|
def create
|
41
|
-
@frequency = Frequency.new(
|
41
|
+
@frequency = Frequency.new(frequency_params)
|
42
42
|
|
43
43
|
respond_to do |format|
|
44
44
|
if @frequency.save
|
45
|
-
format.html { redirect_to @frequency, notice:
|
45
|
+
format.html { redirect_to @frequency, notice: t('controller.successfully_created', model: t('activerecord.models.frequency')) }
|
46
46
|
format.json { render json: @frequency, status: :created, location: @frequency }
|
47
47
|
else
|
48
48
|
format.html { render action: "new" }
|
@@ -60,8 +60,8 @@ class FrequenciesController < ApplicationController
|
|
60
60
|
end
|
61
61
|
|
62
62
|
respond_to do |format|
|
63
|
-
if @frequency.update_attributes(
|
64
|
-
format.html { redirect_to @frequency, notice:
|
63
|
+
if @frequency.update_attributes(frequency_params)
|
64
|
+
format.html { redirect_to @frequency, notice: t('controller.successfully_updated', model: t('activerecord.models.frequency')) }
|
65
65
|
format.json { head :no_content }
|
66
66
|
else
|
67
67
|
format.html { render action: "edit" }
|
@@ -80,4 +80,9 @@ class FrequenciesController < ApplicationController
|
|
80
80
|
format.json { head :no_content }
|
81
81
|
end
|
82
82
|
end
|
83
|
+
|
84
|
+
private
|
85
|
+
def frequency_params
|
86
|
+
params.require(:frequency).permit(:name, :display_name, :note)
|
87
|
+
end
|
83
88
|
end
|
@@ -38,11 +38,11 @@ class IdentifierTypesController < ApplicationController
|
|
38
38
|
# POST /identifier_types
|
39
39
|
# POST /identifier_types.json
|
40
40
|
def create
|
41
|
-
@identifier_type = IdentifierType.new(
|
41
|
+
@identifier_type = IdentifierType.new(identifier_type_params)
|
42
42
|
|
43
43
|
respond_to do |format|
|
44
44
|
if @identifier_type.save
|
45
|
-
format.html { redirect_to @identifier_type, notice:
|
45
|
+
format.html { redirect_to @identifier_type, notice: t('controller.successfully_created', model: t('activerecord.models.identifier_type')) }
|
46
46
|
format.json { render json: @identifier_type, status: :created, location: @identifier_type }
|
47
47
|
else
|
48
48
|
format.html { render action: "new" }
|
@@ -60,8 +60,8 @@ class IdentifierTypesController < ApplicationController
|
|
60
60
|
end
|
61
61
|
|
62
62
|
respond_to do |format|
|
63
|
-
if @identifier_type.update_attributes(
|
64
|
-
format.html { redirect_to @identifier_type, notice:
|
63
|
+
if @identifier_type.update_attributes(identifier_type_params)
|
64
|
+
format.html { redirect_to @identifier_type, notice: t('controller.successfully_updated', model: t('activerecord.models.identifier_type')) }
|
65
65
|
format.json { head :no_content }
|
66
66
|
else
|
67
67
|
format.html { render action: "edit" }
|
@@ -80,4 +80,11 @@ class IdentifierTypesController < ApplicationController
|
|
80
80
|
format.json { head :no_content }
|
81
81
|
end
|
82
82
|
end
|
83
|
+
|
84
|
+
private
|
85
|
+
def identifier_type_params
|
86
|
+
params.require(:identifier_type).permit(
|
87
|
+
:display_name, :name, :note, :position
|
88
|
+
)
|
89
|
+
end
|
83
90
|
end
|
@@ -39,7 +39,7 @@ class ImportRequestsController < ApplicationController
|
|
39
39
|
# POST /import_requests
|
40
40
|
# POST /import_requests.json
|
41
41
|
def create
|
42
|
-
@import_request = ImportRequest.new(
|
42
|
+
@import_request = ImportRequest.new(import_request_params)
|
43
43
|
@import_request.user = current_user
|
44
44
|
|
45
45
|
respond_to do |format|
|
@@ -52,9 +52,17 @@ class ImportRequestsController < ApplicationController
|
|
52
52
|
redirect_to new_import_request_url, notice: t('import_request.record_not_found')
|
53
53
|
end
|
54
54
|
}
|
55
|
+
format.mobile {
|
56
|
+
if @import_request.manifestation
|
57
|
+
redirect_to @import_request.manifestation, notice: t('controller.successfully_created', model: t('activerecord.models.import_request'))
|
58
|
+
else
|
59
|
+
redirect_to new_import_request_url, notice: t('import_request.record_not_found')
|
60
|
+
end
|
61
|
+
}
|
55
62
|
format.json { render json: @import_request, status: :created, location: @import_request }
|
56
63
|
else
|
57
64
|
format.html { render action: "new" }
|
65
|
+
format.mobile { render action: "new" }
|
58
66
|
format.json { render json: @import_request.errors, status: :unprocessable_entity }
|
59
67
|
end
|
60
68
|
end
|
@@ -68,7 +76,7 @@ class ImportRequestsController < ApplicationController
|
|
68
76
|
# PUT /import_requests/1.json
|
69
77
|
def update
|
70
78
|
respond_to do |format|
|
71
|
-
if @import_request.update_attributes(
|
79
|
+
if @import_request.update_attributes(import_request_params)
|
72
80
|
@import_request.import!
|
73
81
|
format.html { redirect_to @import_request, notice: t('controller.successfully_updated', model: t('activerecord.models.import_request')) }
|
74
82
|
format.json { head :no_content }
|
@@ -89,4 +97,9 @@ class ImportRequestsController < ApplicationController
|
|
89
97
|
format.json { head :no_content }
|
90
98
|
end
|
91
99
|
end
|
100
|
+
|
101
|
+
private
|
102
|
+
def import_request_params
|
103
|
+
params.require(:import_request).permit(:isbn, :manifestation_id, :user_id)
|
104
|
+
end
|
92
105
|
end
|
@@ -70,6 +70,8 @@ class ItemsController < ApplicationController
|
|
70
70
|
with(:agent_ids).equal_to agent.id if agent
|
71
71
|
with(:manifestation_id).equal_to manifestation.id if manifestation
|
72
72
|
with(:shelf_id).equal_to shelf.id if shelf
|
73
|
+
with(:circulation_status).equal_to params[:circulation_status] if params[:circulation_status].present?
|
74
|
+
facet :circulation_status if defined?(EnjuCirculation)
|
73
75
|
end
|
74
76
|
end
|
75
77
|
|
@@ -105,7 +107,9 @@ class ItemsController < ApplicationController
|
|
105
107
|
|
106
108
|
page = params[:page] || 1
|
107
109
|
search.query.paginate(page.to_i, per_page)
|
108
|
-
|
110
|
+
result = search.execute
|
111
|
+
@circulation_status_facet = result.facet(:circulation_status).rows if defined?(EnjuCirculation)
|
112
|
+
@items = result.results
|
109
113
|
@count[:total] = @items.total_entries
|
110
114
|
end
|
111
115
|
|
@@ -131,6 +135,7 @@ class ItemsController < ApplicationController
|
|
131
135
|
def show
|
132
136
|
#@item = Item.find(params[:id])
|
133
137
|
@item = @item.versions.find(@version).item if @version
|
138
|
+
@manifestation = @item.manifestation unless @manifestation
|
134
139
|
|
135
140
|
respond_to do |format|
|
136
141
|
format.html # show.html.erb
|
@@ -178,6 +183,7 @@ class ItemsController < ApplicationController
|
|
178
183
|
# GET /items/1/edit
|
179
184
|
def edit
|
180
185
|
@item.library_id = @item.shelf.library_id
|
186
|
+
@manifestation = @item.manifestation
|
181
187
|
if defined?(EnjuCirculation)
|
182
188
|
unless @item.use_restriction
|
183
189
|
@item.build_item_has_use_restriction
|
@@ -189,7 +195,7 @@ class ItemsController < ApplicationController
|
|
189
195
|
# POST /items
|
190
196
|
# POST /items.json
|
191
197
|
def create
|
192
|
-
@item = Item.new(
|
198
|
+
@item = Item.new(item_params)
|
193
199
|
manifestation = Manifestation.find(@item.manifestation_id)
|
194
200
|
|
195
201
|
respond_to do |format|
|
@@ -217,7 +223,7 @@ class ItemsController < ApplicationController
|
|
217
223
|
# PUT /items/1.json
|
218
224
|
def update
|
219
225
|
respond_to do |format|
|
220
|
-
if @item.update_attributes(
|
226
|
+
if @item.update_attributes(item_params)
|
221
227
|
format.html { redirect_to @item, notice: t('controller.successfully_updated', model: t('activerecord.models.item')) }
|
222
228
|
format.json { head :no_content }
|
223
229
|
else
|
@@ -247,6 +253,18 @@ class ItemsController < ApplicationController
|
|
247
253
|
end
|
248
254
|
|
249
255
|
private
|
256
|
+
def item_params
|
257
|
+
params.require(:item).permit(
|
258
|
+
:call_number, :item_identifier, :circulation_status_id,
|
259
|
+
:checkout_type_id, :shelf_id, :include_supplements, :note, :url, :price,
|
260
|
+
:acquired_at, :bookstore_id, :missing_since, :budget_type_id,
|
261
|
+
:lock_version, :manifestation_id, :library_id, :required_role_id,
|
262
|
+
:binding_item_identifier, :binding_call_number, :binded_at,
|
263
|
+
:use_restriction_id,
|
264
|
+
:item_has_use_restriction_attributes => :use_restriction_id # EnjuCirculation
|
265
|
+
)
|
266
|
+
end
|
267
|
+
|
250
268
|
def prepare_options
|
251
269
|
@libraries = Library.real << Library.web
|
252
270
|
if @item.new_record?
|
@@ -38,11 +38,11 @@ class LanguagesController < ApplicationController
|
|
38
38
|
# POST /languages
|
39
39
|
# POST /languages.json
|
40
40
|
def create
|
41
|
-
@language = Language.new(
|
41
|
+
@language = Language.new(language_params)
|
42
42
|
|
43
43
|
respond_to do |format|
|
44
44
|
if @language.save
|
45
|
-
format.html { redirect_to @language, notice:
|
45
|
+
format.html { redirect_to @language, notice: t('controller.successfully_created', model: t('activerecord.models.language')) }
|
46
46
|
format.json { render json: @language, status: :created, location: @language }
|
47
47
|
else
|
48
48
|
format.html { render action: "new" }
|
@@ -60,8 +60,8 @@ class LanguagesController < ApplicationController
|
|
60
60
|
end
|
61
61
|
|
62
62
|
respond_to do |format|
|
63
|
-
if @language.update_attributes(
|
64
|
-
format.html { redirect_to @language, notice:
|
63
|
+
if @language.update_attributes(language_params)
|
64
|
+
format.html { redirect_to @language, notice: t('controller.successfully_updated', model: t('activerecord.models.language')) }
|
65
65
|
format.json { head :no_content }
|
66
66
|
else
|
67
67
|
format.html { render action: "edit" }
|
@@ -80,4 +80,12 @@ class LanguagesController < ApplicationController
|
|
80
80
|
format.json { head :no_content }
|
81
81
|
end
|
82
82
|
end
|
83
|
+
|
84
|
+
private
|
85
|
+
def language_params
|
86
|
+
params.require(:language).permit(
|
87
|
+
:name, :native_name, :display_name, :iso_639_1, :iso_639_2, :iso_639_3,
|
88
|
+
:note
|
89
|
+
)
|
90
|
+
end
|
83
91
|
end
|
@@ -38,11 +38,11 @@ class LicensesController < ApplicationController
|
|
38
38
|
# POST /licenses
|
39
39
|
# POST /licenses.json
|
40
40
|
def create
|
41
|
-
@license = License.new(
|
41
|
+
@license = License.new(license_params)
|
42
42
|
|
43
43
|
respond_to do |format|
|
44
44
|
if @license.save
|
45
|
-
format.html { redirect_to @license, notice:
|
45
|
+
format.html { redirect_to @license, notice: t('controller.successfully_created', model: t('activerecord.models.license')) }
|
46
46
|
format.json { render json: @license, status: :created, location: @license }
|
47
47
|
else
|
48
48
|
format.html { render action: "new" }
|
@@ -60,8 +60,8 @@ class LicensesController < ApplicationController
|
|
60
60
|
end
|
61
61
|
|
62
62
|
respond_to do |format|
|
63
|
-
if @license.update_attributes(
|
64
|
-
format.html { redirect_to @license, notice:
|
63
|
+
if @license.update_attributes(license_params)
|
64
|
+
format.html { redirect_to @license, notice: t('controller.successfully_updated', model: t('activerecord.models.license')) }
|
65
65
|
format.json { head :no_content }
|
66
66
|
else
|
67
67
|
format.html { render action: "edit" }
|
@@ -80,4 +80,9 @@ class LicensesController < ApplicationController
|
|
80
80
|
format.json { head :no_content }
|
81
81
|
end
|
82
82
|
end
|
83
|
+
|
84
|
+
private
|
85
|
+
def license_params
|
86
|
+
params.require(:license).permit(:name, :display_name, :note)
|
87
|
+
end
|
83
88
|
end
|
@@ -38,11 +38,11 @@ class ManifestationRelationshipTypesController < ApplicationController
|
|
38
38
|
# POST /manifestation_relationship_types
|
39
39
|
# POST /manifestation_relationship_types.json
|
40
40
|
def create
|
41
|
-
@manifestation_relationship_type = ManifestationRelationshipType.new(
|
41
|
+
@manifestation_relationship_type = ManifestationRelationshipType.new(manifestation_relationship_type_params)
|
42
42
|
|
43
43
|
respond_to do |format|
|
44
44
|
if @manifestation_relationship_type.save
|
45
|
-
format.html { redirect_to @manifestation_relationship_type, notice:
|
45
|
+
format.html { redirect_to @manifestation_relationship_type, notice: t('controller.successfully_created', model: t('activerecord.models.manifestation_relationship_type')) }
|
46
46
|
format.json { render json: @manifestation_relationship_type, status: :created, location: @manifestation_relationship_type }
|
47
47
|
else
|
48
48
|
format.html { render action: "new" }
|
@@ -60,8 +60,8 @@ class ManifestationRelationshipTypesController < ApplicationController
|
|
60
60
|
end
|
61
61
|
|
62
62
|
respond_to do |format|
|
63
|
-
if @manifestation_relationship_type.update_attributes(
|
64
|
-
format.html { redirect_to @manifestation_relationship_type, notice:
|
63
|
+
if @manifestation_relationship_type.update_attributes(manifestation_relationship_type_params)
|
64
|
+
format.html { redirect_to @manifestation_relationship_type, notice: t('controller.successfully_updated', model: t('activerecord.models.manifestation_relationship_type')) }
|
65
65
|
format.json { head :no_content }
|
66
66
|
else
|
67
67
|
format.html { render action: "edit" }
|
@@ -80,4 +80,11 @@ class ManifestationRelationshipTypesController < ApplicationController
|
|
80
80
|
format.json { head :no_content }
|
81
81
|
end
|
82
82
|
end
|
83
|
+
|
84
|
+
private
|
85
|
+
def manifestation_relationship_type_params
|
86
|
+
params.require(:manifestation_relationship_type).permit(
|
87
|
+
:name, :display_name, :note
|
88
|
+
)
|
89
|
+
end
|
83
90
|
end
|
@@ -47,7 +47,7 @@ class ManifestationRelationshipsController < ApplicationController
|
|
47
47
|
# POST /manifestation_relationships
|
48
48
|
# POST /manifestation_relationships.json
|
49
49
|
def create
|
50
|
-
@manifestation_relationship = ManifestationRelationship.new(
|
50
|
+
@manifestation_relationship = ManifestationRelationship.new(manifestation_relationship_params)
|
51
51
|
|
52
52
|
respond_to do |format|
|
53
53
|
if @manifestation_relationship.save
|
@@ -72,7 +72,7 @@ class ManifestationRelationshipsController < ApplicationController
|
|
72
72
|
end
|
73
73
|
|
74
74
|
respond_to do |format|
|
75
|
-
if @manifestation_relationship.update_attributes(
|
75
|
+
if @manifestation_relationship.update_attributes(manifestation_relationship_params)
|
76
76
|
format.html { redirect_to @manifestation_relationship, notice: t('controller.successfully_updated', model: t('activerecord.models.manifestation_relationship')) }
|
77
77
|
format.json { head :no_content }
|
78
78
|
else
|
@@ -102,6 +102,12 @@ class ManifestationRelationshipsController < ApplicationController
|
|
102
102
|
end
|
103
103
|
|
104
104
|
private
|
105
|
+
def manifestation_relationship_params
|
106
|
+
params.require(:manifestation_relationship).permit(
|
107
|
+
:parent_id, :child_id, :manifestation_relationship_type_id
|
108
|
+
)
|
109
|
+
end
|
110
|
+
|
105
111
|
def prepare_options
|
106
112
|
@manifestation_relationship_types = ManifestationRelationshipType.all
|
107
113
|
end
|
@@ -467,7 +467,7 @@ class ManifestationsController < ApplicationController
|
|
467
467
|
# POST /manifestations
|
468
468
|
# POST /manifestations.json
|
469
469
|
def create
|
470
|
-
@manifestation = Manifestation.new(
|
470
|
+
@manifestation = Manifestation.new(manifestation_params)
|
471
471
|
parent = Manifestation.where(id: @manifestation.parent_id).first
|
472
472
|
unless @manifestation.original_title?
|
473
473
|
@manifestation.original_title = @manifestation.attachment_file_name
|
@@ -496,7 +496,7 @@ class ManifestationsController < ApplicationController
|
|
496
496
|
# PUT /manifestations/1.json
|
497
497
|
def update
|
498
498
|
respond_to do |format|
|
499
|
-
if @manifestation.update_attributes(
|
499
|
+
if @manifestation.update_attributes(manifestation_params)
|
500
500
|
Sunspot.commit
|
501
501
|
format.html { redirect_to @manifestation, notice: t('controller.successfully_updated', model: t('activerecord.models.manifestation')) }
|
502
502
|
format.json { head :no_content }
|
@@ -526,6 +526,80 @@ class ManifestationsController < ApplicationController
|
|
526
526
|
end
|
527
527
|
|
528
528
|
private
|
529
|
+
def manifestation_params
|
530
|
+
params.require(:manifestation).permit(
|
531
|
+
:original_title, :title_alternative, :title_transcription,
|
532
|
+
:manifestation_identifier, :date_copyrighted,
|
533
|
+
:access_address, :language_id, :carrier_type_id, :extent, :start_page,
|
534
|
+
:end_page, :height, :width, :depth, :publication_place,
|
535
|
+
:price, :fulltext, :volume_number_string,
|
536
|
+
:issue_number_string, :serial_number_string, :edition, :note,
|
537
|
+
:repository_content, :required_role_id, :frequency_id,
|
538
|
+
:title_alternative_transcription, :description, :abstract, :available_at,
|
539
|
+
:valid_until, :date_submitted, :date_accepted, :date_captured,
|
540
|
+
:ndl_bib_id, :pub_date, :edition_string, :volume_number, :issue_number,
|
541
|
+
:serial_number, :content_type_id, :attachment, :lock_version,
|
542
|
+
:dimensions, :fulltext_content, :extent,
|
543
|
+
:number_of_page_string, :parent_id,
|
544
|
+
:serial, :statement_of_responsibility,
|
545
|
+
{:creators_attributes => [
|
546
|
+
:id, :last_name, :middle_name, :first_name,
|
547
|
+
:last_name_transcription, :middle_name_transcription,
|
548
|
+
:first_name_transcription, :corporate_name,
|
549
|
+
:corporate_name_transcription,
|
550
|
+
:full_name, :full_name_transcription, :full_name_alternative,
|
551
|
+
:other_designation, :language_id,
|
552
|
+
:country_id, :agent_type_id, :note, :required_role_id, :email, :url,
|
553
|
+
:full_name_alternative_transcription, :title,
|
554
|
+
:agent_identifier,
|
555
|
+
:_destroy
|
556
|
+
]},
|
557
|
+
{:contributors_attributes => [
|
558
|
+
:id, :last_name, :middle_name, :first_name,
|
559
|
+
:last_name_transcription, :middle_name_transcription,
|
560
|
+
:first_name_transcription, :corporate_name,
|
561
|
+
:corporate_name_transcription,
|
562
|
+
:full_name, :full_name_transcription, :full_name_alternative,
|
563
|
+
:other_designation, :language_id,
|
564
|
+
:country_id, :agent_type_id, :note, :required_role_id, :email, :url,
|
565
|
+
:full_name_alternative_transcription, :title,
|
566
|
+
:agent_identifier,
|
567
|
+
:_destroy
|
568
|
+
]},
|
569
|
+
{:publishers_attributes => [
|
570
|
+
:id, :last_name, :middle_name, :first_name,
|
571
|
+
:last_name_transcription, :middle_name_transcription,
|
572
|
+
:first_name_transcription, :corporate_name,
|
573
|
+
:corporate_name_transcription,
|
574
|
+
:full_name, :full_name_transcription, :full_name_alternative,
|
575
|
+
:other_designation, :language_id,
|
576
|
+
:country_id, :agent_type_id, :note, :required_role_id, :email, :url,
|
577
|
+
:full_name_alternative_transcription, :title,
|
578
|
+
:agent_identifier,
|
579
|
+
:_destroy
|
580
|
+
]},
|
581
|
+
{:series_statements_attributes => [
|
582
|
+
:id, :original_title, :numbering, :title_subseries,
|
583
|
+
:numbering_subseries, :title_transcription, :title_alternative,
|
584
|
+
:title_subseries_transcription, :creator_string, :volume_number_string,
|
585
|
+
:volume_number_transcription_string, :series_master,
|
586
|
+
:_destroy
|
587
|
+
]},
|
588
|
+
{:subjects_attributes => [
|
589
|
+
:id, :parent_id, :use_term_id, :term, :term_transcription,
|
590
|
+
:subject_type_id, :note, :required_role_id, :subject_heading_type_id,
|
591
|
+
:_destroy
|
592
|
+
]},
|
593
|
+
{:classifications_attributes => [
|
594
|
+
:id, :parent_id, :category, :note, :classification_type_id,
|
595
|
+
:_destroy
|
596
|
+
]},
|
597
|
+
{:identifiers_attributes => [
|
598
|
+
:id, :body, :identifier_type_id,
|
599
|
+
:_destroy
|
600
|
+
]}
|
601
|
+
)
|
602
|
+
end
|
529
603
|
|
530
604
|
def make_query(query, options = {})
|
531
605
|
# TODO: integerやstringもqfに含める
|
@@ -726,18 +800,28 @@ class ManifestationsController < ApplicationController
|
|
726
800
|
if options[:pub_date_from].blank?
|
727
801
|
pub_date[:from] = "*"
|
728
802
|
else
|
729
|
-
|
803
|
+
year = options[:pub_date_from].rjust(4, "0")
|
804
|
+
if year.length == 4
|
805
|
+
pub_date[:from] = Time.zone.parse(Time.utc(year).to_s).beginning_of_year.utc.iso8601
|
806
|
+
else
|
807
|
+
pub_date[:from] = Time.zone.parse(options[:pub_date_from]).beginning_of_day.utc.iso8601 rescue nil
|
808
|
+
end
|
730
809
|
unless pub_date[:from]
|
731
|
-
pub_date[:from] = Time.zone.parse(Time.
|
810
|
+
pub_date[:from] = Time.zone.parse(Time.utc(options[:pub_date_from]).to_s).beginning_of_day.utc.iso8601
|
732
811
|
end
|
733
812
|
end
|
734
813
|
|
735
814
|
if options[:pub_date_to].blank?
|
736
815
|
pub_date[:to] = "*"
|
737
816
|
else
|
738
|
-
|
817
|
+
year = options[:pub_date_to].rjust(4, "0")
|
818
|
+
if year.length == 4
|
819
|
+
pub_date[:to] = Time.zone.parse(Time.utc(year).to_s).end_of_year.utc.iso8601
|
820
|
+
else
|
821
|
+
pub_date[:to] = Time.zone.parse(options[:pub_date_to]).end_of_day.utc.iso8601 rescue nil
|
822
|
+
end
|
739
823
|
unless pub_date[:to]
|
740
|
-
pub_date[:to] = Time.zone.parse(Time.
|
824
|
+
pub_date[:to] = Time.zone.parse(Time.utc(options[:pub_date_to]).to_s).end_of_year.utc.iso8601
|
741
825
|
end
|
742
826
|
end
|
743
827
|
pub_date
|
@@ -762,20 +846,31 @@ class ManifestationsController < ApplicationController
|
|
762
846
|
if options[:acquired_from].blank?
|
763
847
|
acquisition_date[:from] = "*"
|
764
848
|
else
|
765
|
-
|
849
|
+
year = options[:acquired_from].rjust(4, "0")
|
850
|
+
if year.length == 4
|
851
|
+
acquisition_date[:from] = Time.zone.parse(Time.utc(year).to_s).beginning_of_year.utc.iso8601
|
852
|
+
else
|
853
|
+
acquisition_date[:from] = Time.zone.parse(options[:acquired_from]).beginning_of_day.utc.iso8601 rescue nil
|
854
|
+
end
|
766
855
|
unless acquisition_date[:from]
|
767
|
-
acquisition_date[:from] = Time.zone.parse(Time.
|
856
|
+
acquisition_date[:from] = Time.zone.parse(Time.utc(options[:acquired_from]).to_s).beginning_of_day.utc.iso8601
|
768
857
|
end
|
769
858
|
end
|
770
859
|
|
771
860
|
if options[:acquired_to].blank?
|
772
861
|
acquisition_date[:to] = "*"
|
773
862
|
else
|
774
|
-
|
863
|
+
year = options[:acquired_to].rjust(4, "0")
|
864
|
+
if year.length == 4
|
865
|
+
acquisition_date[:to] = Time.zone.parse(Time.utc(year).to_s).end_of_year.utc.iso8601
|
866
|
+
else
|
867
|
+
acquisition_date[:to] = Time.zone.parse(options[:acquired_to]).end_of_day.utc.iso8601 rescue nil
|
868
|
+
end
|
775
869
|
unless acquisition_date[:to]
|
776
|
-
|
870
|
+
pub_date[:to] = Time.zone.parse(Time.utc(options[:acquired_to]).to_s).end_of_year.utc.iso8601
|
777
871
|
end
|
778
872
|
end
|
873
|
+
|
779
874
|
query = "#{query} acquired_at_d:[#{acquisition_date[:from]} TO #{acquisition_date[:to]}]"
|
780
875
|
end
|
781
876
|
query
|