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.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/content_types_controller.rb +1 -1
  3. data/app/controllers/item_custom_properties_controller.rb +69 -0
  4. data/app/controllers/items_controller.rb +2 -3
  5. data/app/controllers/manifestation_custom_properties_controller.rb +69 -0
  6. data/app/controllers/manifestations_controller.rb +12 -15
  7. data/app/controllers/resource_import_results_controller.rb +6 -2
  8. data/app/models/agent.rb +6 -6
  9. data/app/models/agent_import_file.rb +7 -7
  10. data/app/models/agent_type.rb +0 -1
  11. data/app/models/carrier_type.rb +0 -1
  12. data/app/models/content_type.rb +0 -1
  13. data/app/models/form_of_work.rb +1 -2
  14. data/app/models/frequency.rb +0 -1
  15. data/app/models/identifier_type.rb +0 -1
  16. data/app/models/item.rb +15 -16
  17. data/app/models/item_custom_property.rb +18 -0
  18. data/app/models/item_custom_value.rb +17 -0
  19. data/app/models/license.rb +0 -1
  20. data/app/models/manifestation.rb +54 -22
  21. data/app/models/manifestation_custom_property.rb +18 -0
  22. data/app/models/manifestation_custom_value.rb +17 -0
  23. data/app/models/medium_of_performance.rb +1 -2
  24. data/app/models/picture_file.rb +0 -2
  25. data/app/models/resource_export_file.rb +4 -2
  26. data/app/models/resource_import_file.rb +157 -67
  27. data/app/policies/item_custom_property_policy.rb +21 -0
  28. data/app/policies/manifestation_custom_property_policy.rb +21 -0
  29. data/app/views/agent_import_results/index.txt.ruby +5 -0
  30. data/app/views/agent_relationship_types/_form.html.erb +1 -1
  31. data/app/views/agent_types/_form.html.erb +1 -1
  32. data/app/views/carrier_types/_form.html.erb +1 -1
  33. data/app/views/create_types/_form.html.erb +1 -1
  34. data/app/views/form_of_works/_form.html.erb +1 -1
  35. data/app/views/frequencies/_form.html.erb +1 -1
  36. data/app/views/item_custom_properties/_form.html.erb +32 -0
  37. data/app/views/item_custom_properties/edit.html.erb +13 -0
  38. data/app/views/item_custom_properties/index.html.erb +43 -0
  39. data/app/views/item_custom_properties/new.html.erb +12 -0
  40. data/app/views/item_custom_properties/show.html.erb +28 -0
  41. data/app/views/items/_form.html.erb +13 -10
  42. data/app/views/items/show.html.erb +3 -4
  43. data/app/views/licenses/_form.html.erb +1 -1
  44. data/app/views/manifestation_custom_properties/_form.html.erb +32 -0
  45. data/app/views/manifestation_custom_properties/edit.html.erb +13 -0
  46. data/app/views/manifestation_custom_properties/index.html.erb +43 -0
  47. data/app/views/manifestation_custom_properties/new.html.erb +12 -0
  48. data/app/views/manifestation_custom_properties/show.html.erb +28 -0
  49. data/app/views/manifestation_relationship_types/_form.html.erb +1 -1
  50. data/app/views/manifestations/_export_detail.html.erb +1 -0
  51. data/app/views/manifestations/_export_list.html.erb +1 -0
  52. data/app/views/manifestations/_form.html.erb +18 -10
  53. data/app/views/manifestations/_show_detail_librarian.html.erb +9 -3
  54. data/app/views/manifestations/_show_detail_user.html.erb +8 -0
  55. data/app/views/manifestations/show.json.jbuilder +2 -0
  56. data/app/views/medium_of_performances/_form.html.erb +1 -1
  57. data/app/views/picture_files/edit.html.erb +4 -0
  58. data/app/views/produce_types/_form.html.erb +1 -1
  59. data/app/views/realize_types/_form.html.erb +1 -1
  60. data/app/views/resource_import_results/index.txt.ruby +5 -0
  61. data/app/views/series_statement_merges/_form.html.erb +1 -1
  62. data/config/locales/translation_en.yml +22 -8
  63. data/config/locales/translation_ja.yml +22 -8
  64. data/config/routes.rb +2 -0
  65. data/db/migrate/20081027150907_create_picture_files.rb +0 -2
  66. data/db/migrate/20200425072340_create_manifestation_custom_properties.rb +12 -0
  67. data/db/migrate/20200425072349_create_item_custom_properties.rb +12 -0
  68. data/db/migrate/20200425074758_create_manifestation_custom_values.rb +12 -0
  69. data/db/migrate/20200425074822_create_item_custom_values.rb +12 -0
  70. data/lib/enju_biblio/version.rb +1 -1
  71. data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/when_it_is_written_in_utf-8/should_import_custom_values.yml +121 -0
  72. data/spec/cassette_library/resource_import_results/index_txt_ruby/renders_a_list_of_resource_import_results.yml +121 -0
  73. data/spec/controllers/content_types_controller_spec.rb +1 -1
  74. data/spec/controllers/item_custom_properties_controller_spec.rb +449 -0
  75. data/spec/controllers/items_controller_spec.rb +22 -25
  76. data/spec/controllers/manifestation_custom_properties_controller_spec.rb +449 -0
  77. data/spec/controllers/manifestations_controller_spec.rb +20 -23
  78. data/spec/dummy/db/schema.rb +43 -12
  79. data/spec/factories/item_custom_property.rb +6 -0
  80. data/spec/factories/item_custom_value.rb +6 -0
  81. data/spec/factories/manifestation_custom_property.rb +6 -0
  82. data/spec/factories/manifestation_custom_value.rb +6 -0
  83. data/spec/fixtures/creates.yml +2 -0
  84. data/spec/fixtures/item_custom_properties.yml +24 -0
  85. data/spec/fixtures/library_groups.yml +29 -15
  86. data/spec/fixtures/manifestation_custom_properties.yml +24 -0
  87. data/spec/fixtures/picture_files.yml +0 -2
  88. data/spec/fixtures/produces.yml +2 -0
  89. data/spec/fixtures/realizes.yml +2 -0
  90. data/spec/fixtures/resource_import_results.yml +2 -2
  91. data/spec/models/item_custom_property_spec.rb +18 -0
  92. data/spec/models/item_custom_value_spec.rb +17 -0
  93. data/spec/models/manifestation_custom_property_spec.rb +18 -0
  94. data/spec/models/manifestation_custom_value_spec.rb +17 -0
  95. data/spec/models/manifestation_spec.rb +11 -21
  96. data/spec/models/picture_file_spec.rb +0 -2
  97. data/spec/models/resource_export_file_spec.rb +61 -8
  98. data/spec/models/resource_import_file_spec.rb +43 -13
  99. data/spec/requests/item_custom_properties_spec.rb +129 -0
  100. data/spec/requests/manifestation_custom_properties_spec.rb +129 -0
  101. data/spec/routing/item_custom_properties_routing_spec.rb +38 -0
  102. data/spec/routing/manifestation_custom_properties_routing_spec.rb +38 -0
  103. data/spec/system/items_spec.rb +12 -0
  104. data/spec/system/manifestations_spec.rb +12 -0
  105. data/spec/views/agent_import_results/index.html.erb_spec.rb +29 -0
  106. data/spec/views/agent_import_results/index.txt.ruby_spec.rb +20 -0
  107. data/spec/views/agent_import_results/show.html.erb_spec.rb +24 -0
  108. data/spec/views/item_custom_properties/edit.html.erb_spec.rb +21 -0
  109. data/spec/views/item_custom_properties/index.html.erb_spec.rb +25 -0
  110. data/spec/views/item_custom_properties/new.html.erb_spec.rb +21 -0
  111. data/spec/views/item_custom_properties/show.html.erb_spec.rb +16 -0
  112. data/spec/views/manifestation_custom_properties/edit.html.erb_spec.rb +21 -0
  113. data/spec/views/manifestation_custom_properties/index.html.erb_spec.rb +25 -0
  114. data/spec/views/manifestation_custom_properties/new.html.erb_spec.rb +21 -0
  115. data/spec/views/manifestation_custom_properties/show.html.erb_spec.rb +16 -0
  116. data/spec/views/manifestations/show.json.jbuilder_spec.rb +16 -0
  117. data/spec/views/manifestations/show.txt.ruby_spec.rb +1 -1
  118. data/spec/views/resource_import_results/index.txt.ruby_spec.rb +22 -0
  119. data/spec/views/resource_import_results/show.html.erb_spec.rb +1 -1
  120. metadata +118 -37
  121. data/app/models/custom_property.rb +0 -17
  122. data/app/views/agent_import_results/index.txt.erb +0 -3
  123. data/app/views/items/_custom_property_fields.html.erb +0 -7
  124. data/app/views/manifestations/_custom_property_fields.html.erb +0 -7
  125. data/app/views/resource_import_results/index.txt.erb +0 -3
  126. data/db/migrate/20191219122214_create_custom_properties.rb +0 -12
  127. data/spec/factories/custom_property.rb +0 -18
  128. data/spec/models/custom_property_spec.rb +0 -18
  129. 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,3 +0,0 @@
1
- <%- @agent_import_results.each do |agent_import_result| -%>
2
- <%= agent_import_result.body %>
3
- <%- end -%>
@@ -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,3 +0,0 @@
1
- <%- @resource_import_results.each do |resource_import_result| -%>
2
- <%= resource_import_result.manifestation_id %> <%= resource_import_result.item_id %> <%= resource_import_result.body %>
3
- <%- end -%>
@@ -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