enju_biblio 0.3.8 → 0.3.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/content_types_controller.rb +1 -1
- data/app/controllers/item_custom_properties_controller.rb +69 -0
- data/app/controllers/items_controller.rb +2 -3
- data/app/controllers/manifestation_custom_properties_controller.rb +69 -0
- data/app/controllers/manifestations_controller.rb +12 -15
- data/app/controllers/resource_import_results_controller.rb +6 -2
- data/app/models/agent.rb +6 -6
- data/app/models/agent_import_file.rb +7 -7
- data/app/models/agent_type.rb +0 -1
- data/app/models/carrier_type.rb +0 -1
- data/app/models/content_type.rb +0 -1
- data/app/models/form_of_work.rb +1 -2
- data/app/models/frequency.rb +0 -1
- data/app/models/identifier_type.rb +0 -1
- data/app/models/item.rb +15 -16
- data/app/models/item_custom_property.rb +18 -0
- data/app/models/item_custom_value.rb +17 -0
- data/app/models/license.rb +0 -1
- data/app/models/manifestation.rb +54 -22
- data/app/models/manifestation_custom_property.rb +18 -0
- data/app/models/manifestation_custom_value.rb +17 -0
- data/app/models/medium_of_performance.rb +1 -2
- data/app/models/picture_file.rb +0 -2
- data/app/models/resource_export_file.rb +4 -2
- data/app/models/resource_import_file.rb +157 -67
- data/app/policies/item_custom_property_policy.rb +21 -0
- data/app/policies/manifestation_custom_property_policy.rb +21 -0
- data/app/views/agent_import_results/index.txt.ruby +5 -0
- data/app/views/agent_relationship_types/_form.html.erb +1 -1
- data/app/views/agent_types/_form.html.erb +1 -1
- data/app/views/carrier_types/_form.html.erb +1 -1
- data/app/views/create_types/_form.html.erb +1 -1
- data/app/views/form_of_works/_form.html.erb +1 -1
- data/app/views/frequencies/_form.html.erb +1 -1
- data/app/views/item_custom_properties/_form.html.erb +32 -0
- data/app/views/item_custom_properties/edit.html.erb +13 -0
- data/app/views/item_custom_properties/index.html.erb +43 -0
- data/app/views/item_custom_properties/new.html.erb +12 -0
- data/app/views/item_custom_properties/show.html.erb +28 -0
- data/app/views/items/_form.html.erb +13 -10
- data/app/views/items/show.html.erb +3 -4
- data/app/views/licenses/_form.html.erb +1 -1
- data/app/views/manifestation_custom_properties/_form.html.erb +32 -0
- data/app/views/manifestation_custom_properties/edit.html.erb +13 -0
- data/app/views/manifestation_custom_properties/index.html.erb +43 -0
- data/app/views/manifestation_custom_properties/new.html.erb +12 -0
- data/app/views/manifestation_custom_properties/show.html.erb +28 -0
- data/app/views/manifestation_relationship_types/_form.html.erb +1 -1
- data/app/views/manifestations/_export_detail.html.erb +1 -0
- data/app/views/manifestations/_export_list.html.erb +1 -0
- data/app/views/manifestations/_form.html.erb +18 -10
- data/app/views/manifestations/_show_detail_librarian.html.erb +9 -3
- data/app/views/manifestations/_show_detail_user.html.erb +8 -0
- data/app/views/manifestations/show.json.jbuilder +2 -0
- data/app/views/medium_of_performances/_form.html.erb +1 -1
- data/app/views/picture_files/edit.html.erb +4 -0
- data/app/views/produce_types/_form.html.erb +1 -1
- data/app/views/realize_types/_form.html.erb +1 -1
- data/app/views/resource_import_results/index.txt.ruby +5 -0
- data/app/views/series_statement_merges/_form.html.erb +1 -1
- data/config/locales/translation_en.yml +22 -8
- data/config/locales/translation_ja.yml +22 -8
- data/config/routes.rb +2 -0
- data/db/migrate/20081027150907_create_picture_files.rb +0 -2
- data/db/migrate/20200425072340_create_manifestation_custom_properties.rb +12 -0
- data/db/migrate/20200425072349_create_item_custom_properties.rb +12 -0
- data/db/migrate/20200425074758_create_manifestation_custom_values.rb +12 -0
- data/db/migrate/20200425074822_create_item_custom_values.rb +12 -0
- data/lib/enju_biblio/version.rb +1 -1
- data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/when_it_is_written_in_utf-8/should_import_custom_values.yml +121 -0
- data/spec/cassette_library/resource_import_results/index_txt_ruby/renders_a_list_of_resource_import_results.yml +121 -0
- data/spec/controllers/content_types_controller_spec.rb +1 -1
- data/spec/controllers/item_custom_properties_controller_spec.rb +449 -0
- data/spec/controllers/items_controller_spec.rb +22 -25
- data/spec/controllers/manifestation_custom_properties_controller_spec.rb +449 -0
- data/spec/controllers/manifestations_controller_spec.rb +20 -23
- data/spec/dummy/db/schema.rb +43 -12
- data/spec/factories/item_custom_property.rb +6 -0
- data/spec/factories/item_custom_value.rb +6 -0
- data/spec/factories/manifestation_custom_property.rb +6 -0
- data/spec/factories/manifestation_custom_value.rb +6 -0
- data/spec/fixtures/creates.yml +2 -0
- data/spec/fixtures/item_custom_properties.yml +24 -0
- data/spec/fixtures/library_groups.yml +29 -15
- data/spec/fixtures/manifestation_custom_properties.yml +24 -0
- data/spec/fixtures/picture_files.yml +0 -2
- data/spec/fixtures/produces.yml +2 -0
- data/spec/fixtures/realizes.yml +2 -0
- data/spec/fixtures/resource_import_results.yml +2 -2
- data/spec/models/item_custom_property_spec.rb +18 -0
- data/spec/models/item_custom_value_spec.rb +17 -0
- data/spec/models/manifestation_custom_property_spec.rb +18 -0
- data/spec/models/manifestation_custom_value_spec.rb +17 -0
- data/spec/models/manifestation_spec.rb +11 -21
- data/spec/models/picture_file_spec.rb +0 -2
- data/spec/models/resource_export_file_spec.rb +61 -8
- data/spec/models/resource_import_file_spec.rb +43 -13
- data/spec/requests/item_custom_properties_spec.rb +129 -0
- data/spec/requests/manifestation_custom_properties_spec.rb +129 -0
- data/spec/routing/item_custom_properties_routing_spec.rb +38 -0
- data/spec/routing/manifestation_custom_properties_routing_spec.rb +38 -0
- data/spec/system/items_spec.rb +12 -0
- data/spec/system/manifestations_spec.rb +12 -0
- data/spec/views/agent_import_results/index.html.erb_spec.rb +29 -0
- data/spec/views/agent_import_results/index.txt.ruby_spec.rb +20 -0
- data/spec/views/agent_import_results/show.html.erb_spec.rb +24 -0
- data/spec/views/item_custom_properties/edit.html.erb_spec.rb +21 -0
- data/spec/views/item_custom_properties/index.html.erb_spec.rb +25 -0
- data/spec/views/item_custom_properties/new.html.erb_spec.rb +21 -0
- data/spec/views/item_custom_properties/show.html.erb_spec.rb +16 -0
- data/spec/views/manifestation_custom_properties/edit.html.erb_spec.rb +21 -0
- data/spec/views/manifestation_custom_properties/index.html.erb_spec.rb +25 -0
- data/spec/views/manifestation_custom_properties/new.html.erb_spec.rb +21 -0
- data/spec/views/manifestation_custom_properties/show.html.erb_spec.rb +16 -0
- data/spec/views/manifestations/show.json.jbuilder_spec.rb +16 -0
- data/spec/views/manifestations/show.txt.ruby_spec.rb +1 -1
- data/spec/views/resource_import_results/index.txt.ruby_spec.rb +22 -0
- data/spec/views/resource_import_results/show.html.erb_spec.rb +1 -1
- metadata +118 -37
- data/app/models/custom_property.rb +0 -17
- data/app/views/agent_import_results/index.txt.erb +0 -3
- data/app/views/items/_custom_property_fields.html.erb +0 -7
- data/app/views/manifestations/_custom_property_fields.html.erb +0 -7
- data/app/views/resource_import_results/index.txt.erb +0 -3
- data/db/migrate/20191219122214_create_custom_properties.rb +0 -12
- data/spec/factories/custom_property.rb +0 -18
- data/spec/models/custom_property_spec.rb +0 -18
- data/spec/system/custom_properties_spec.rb +0 -84
@@ -1,17 +0,0 @@
|
|
1
|
-
class CustomProperty < ApplicationRecord
|
2
|
-
belongs_to :resource, polymorphic: true
|
3
|
-
validates :label, presence: true
|
4
|
-
end
|
5
|
-
|
6
|
-
# == Schema Information
|
7
|
-
#
|
8
|
-
# Table name: custom_properties
|
9
|
-
#
|
10
|
-
# id :integer not null, primary key
|
11
|
-
# resource_id :integer not null
|
12
|
-
# resource_type :string not null
|
13
|
-
# label :text not null
|
14
|
-
# value :text
|
15
|
-
# created_at :datetime not null
|
16
|
-
# updated_at :datetime not null
|
17
|
-
#
|
@@ -1,7 +0,0 @@
|
|
1
|
-
<div class="nested-fields">
|
2
|
-
<%= f.label :label %>
|
3
|
-
<%= f.text_field :label, class: 'resource_custom_property_body' -%>
|
4
|
-
<%= f.label :value %>
|
5
|
-
<%= f.text_field :value, class: 'resource_custom_property_body' -%>
|
6
|
-
<%= link_to_remove_association t('page.remove'), f, data: {confirm: t('page.are_you_sure')} %><br />
|
7
|
-
</div>
|
@@ -1,7 +0,0 @@
|
|
1
|
-
<div class="nested-fields">
|
2
|
-
<%= f.label :label %>
|
3
|
-
<%= f.text_field :label, class: 'resource_custom_property_body' -%>
|
4
|
-
<%= f.label :value %>
|
5
|
-
<%= f.text_field :value, class: 'resource_custom_property_body' -%>
|
6
|
-
<%= link_to_remove_association t('page.remove'), f, data: {confirm: t('page.are_you_sure')} %><br />
|
7
|
-
</div>
|
@@ -1,12 +0,0 @@
|
|
1
|
-
class CreateCustomProperties < ActiveRecord::Migration[5.2]
|
2
|
-
def change
|
3
|
-
create_table :custom_properties do |t|
|
4
|
-
t.integer :resource_id, null: false
|
5
|
-
t.string :resource_type, null: false
|
6
|
-
t.text :label, null: false
|
7
|
-
t.text :value
|
8
|
-
|
9
|
-
t.timestamps
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
FactoryBot.define do
|
2
|
-
factory :custom_property do
|
3
|
-
sequence(:label){|n| "custom property #{n}"}
|
4
|
-
sequence(:value){|n| "カスタム項目 #{n}"}
|
5
|
-
end
|
6
|
-
|
7
|
-
factory :manifestation_custom_property, class: CustomProperty do
|
8
|
-
association :resource, factory: :manifestation
|
9
|
-
sequence(:label){|n| "custom property #{n}"}
|
10
|
-
sequence(:value){|n| "カスタム項目 #{n}"}
|
11
|
-
end
|
12
|
-
|
13
|
-
factory :item_custom_property, class: CustomProperty do
|
14
|
-
association :resource, factory: :item
|
15
|
-
sequence(:label){|n| "custom property #{n}"}
|
16
|
-
sequence(:value){|n| "カスタム項目 #{n}"}
|
17
|
-
end
|
18
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'rails_helper'
|
2
|
-
|
3
|
-
RSpec.describe CustomProperty, type: :model do
|
4
|
-
pending "add some examples to (or delete) #{__FILE__}"
|
5
|
-
end
|
6
|
-
|
7
|
-
# == Schema Information
|
8
|
-
#
|
9
|
-
# Table name: custom_properties
|
10
|
-
#
|
11
|
-
# id :integer not null, primary key
|
12
|
-
# resource_id :integer not null
|
13
|
-
# resource_type :string not null
|
14
|
-
# label :text not null
|
15
|
-
# value :text
|
16
|
-
# created_at :datetime not null
|
17
|
-
# updated_at :datetime not null
|
18
|
-
#
|
@@ -1,84 +0,0 @@
|
|
1
|
-
require 'rails_helper'
|
2
|
-
|
3
|
-
RSpec.describe 'CustomProperties', type: :system do
|
4
|
-
include Devise::Test::IntegrationHelpers
|
5
|
-
fixtures :all
|
6
|
-
|
7
|
-
describe 'Manifestation' do
|
8
|
-
before do
|
9
|
-
@manifestation = FactoryBot.create(:manifestation_custom_property).resource
|
10
|
-
CarrierType.find_by(name: 'volume').update(attachment: File.open("#{Rails.root.to_s}/../../app/assets/images/icons/book.png"))
|
11
|
-
end
|
12
|
-
|
13
|
-
describe 'When logged in as Librarian' do
|
14
|
-
before do
|
15
|
-
sign_in users(:librarian1)
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'should show custom property' do
|
19
|
-
visit manifestation_path(@manifestation.id, locale: :ja)
|
20
|
-
expect(page).to have_content @manifestation.custom_properties.first.label
|
21
|
-
expect(page).to have_content @manifestation.custom_properties.first.value
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
describe 'When logged in as User' do
|
26
|
-
before do
|
27
|
-
sign_in users(:user1)
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'should not show custom property' do
|
31
|
-
visit manifestation_path(@manifestation.id, locale: :ja)
|
32
|
-
expect(page).not_to have_content @manifestation.custom_properties.first.label
|
33
|
-
expect(page).not_to have_content @manifestation.custom_properties.first.value
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
describe 'When not logged in' do
|
38
|
-
it 'should not show custom property' do
|
39
|
-
visit manifestation_path(@manifestation.id, locale: :ja)
|
40
|
-
expect(page).not_to have_content @manifestation.custom_properties.first.label
|
41
|
-
expect(page).not_to have_content @manifestation.custom_properties.first.value
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
describe 'Item' do
|
47
|
-
before do
|
48
|
-
@item = FactoryBot.create(:item_custom_property).resource
|
49
|
-
CarrierType.find_by(name: 'volume').update(attachment: File.open("#{Rails.root.to_s}/../../app/assets/images/icons/book.png"))
|
50
|
-
end
|
51
|
-
|
52
|
-
describe 'When logged in as Librarian' do
|
53
|
-
before do
|
54
|
-
sign_in users(:librarian1)
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'should show custom property' do
|
58
|
-
visit item_path(@item.id, locale: :ja)
|
59
|
-
expect(page).to have_content @item.custom_properties.first.label
|
60
|
-
expect(page).to have_content @item.custom_properties.first.value
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
describe 'When logged in as User' do
|
65
|
-
before do
|
66
|
-
sign_in users(:user1)
|
67
|
-
end
|
68
|
-
|
69
|
-
it 'should not show custom property' do
|
70
|
-
visit item_path(@item.id, locale: :ja)
|
71
|
-
expect(page).not_to have_content @item.custom_properties.first.label
|
72
|
-
expect(page).not_to have_content @item.custom_properties.first.value
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
describe 'When not logged in' do
|
77
|
-
it 'should not show custom property' do
|
78
|
-
visit item_path(@item.id, locale: :ja)
|
79
|
-
expect(page).not_to have_content @item.custom_properties.first.label
|
80
|
-
expect(page).not_to have_content @item.custom_properties.first.value
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|