enju_biblio 0.3.8 → 0.3.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/items_controller.rb +0 -4
  3. data/app/controllers/manifestations_controller.rb +4 -10
  4. data/app/models/agent.rb +6 -6
  5. data/app/models/agent_import_file.rb +7 -7
  6. data/app/models/item.rb +0 -12
  7. data/app/models/manifestation.rb +0 -12
  8. data/app/models/resource_import_file.rb +15 -15
  9. data/app/views/agent_import_results/index.txt.ruby +5 -0
  10. data/app/views/agent_relationship_types/_form.html.erb +1 -1
  11. data/app/views/agent_types/_form.html.erb +1 -1
  12. data/app/views/carrier_types/_form.html.erb +1 -1
  13. data/app/views/create_types/_form.html.erb +1 -1
  14. data/app/views/form_of_works/_form.html.erb +1 -1
  15. data/app/views/frequencies/_form.html.erb +1 -1
  16. data/app/views/items/_form.html.erb +0 -10
  17. data/app/views/items/show.html.erb +0 -7
  18. data/app/views/licenses/_form.html.erb +1 -1
  19. data/app/views/manifestation_relationship_types/_form.html.erb +1 -1
  20. data/app/views/manifestations/_form.html.erb +0 -10
  21. data/app/views/manifestations/_show_detail_librarian.html.erb +0 -8
  22. data/app/views/medium_of_performances/_form.html.erb +1 -1
  23. data/app/views/produce_types/_form.html.erb +1 -1
  24. data/app/views/realize_types/_form.html.erb +1 -1
  25. data/app/views/resource_import_results/index.txt.ruby +5 -0
  26. data/app/views/series_statement_merges/_form.html.erb +1 -1
  27. data/db/migrate/20200322053443_add_default_custom_label_to_library_group.rb +6 -0
  28. data/db/migrate/20200322083313_create_custom_labels.rb +10 -0
  29. data/db/migrate/{20191219122214_create_custom_properties.rb → 20200322083458_create_custom_properties.rb} +1 -1
  30. data/lib/enju_biblio/version.rb +1 -1
  31. data/spec/controllers/items_controller_spec.rb +0 -25
  32. data/spec/controllers/manifestations_controller_spec.rb +0 -25
  33. data/spec/dummy/db/schema.rb +13 -2
  34. data/spec/fixtures/library_groups.yml +31 -15
  35. data/spec/fixtures/resource_import_results.yml +2 -2
  36. data/spec/models/manifestation_spec.rb +0 -25
  37. data/spec/views/agent_import_results/index.html.erb_spec.rb +29 -0
  38. data/spec/views/agent_import_results/index.txt.ruby_spec.rb +20 -0
  39. data/spec/views/agent_import_results/show.html.erb_spec.rb +24 -0
  40. data/spec/views/manifestations/show.txt.ruby_spec.rb +1 -1
  41. data/spec/views/resource_import_results/index.txt.ruby_spec.rb +22 -0
  42. data/spec/views/resource_import_results/show.html.erb_spec.rb +1 -1
  43. metadata +33 -32
  44. data/app/models/custom_property.rb +0 -17
  45. data/app/views/agent_import_results/index.txt.erb +0 -3
  46. data/app/views/items/_custom_property_fields.html.erb +0 -7
  47. data/app/views/manifestations/_custom_property_fields.html.erb +0 -7
  48. data/app/views/resource_import_results/index.txt.erb +0 -3
  49. data/spec/factories/custom_property.rb +0 -18
  50. data/spec/models/custom_property_spec.rb +0 -18
  51. 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,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