enju_biblio 0.3.9 → 0.3.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) 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 +3 -0
  5. data/app/controllers/manifestation_custom_properties_controller.rb +69 -0
  6. data/app/controllers/manifestations_controller.rb +9 -6
  7. data/app/controllers/resource_import_results_controller.rb +6 -2
  8. data/app/models/agent_type.rb +0 -1
  9. data/app/models/carrier_type.rb +0 -1
  10. data/app/models/content_type.rb +0 -1
  11. data/app/models/form_of_work.rb +1 -2
  12. data/app/models/frequency.rb +0 -1
  13. data/app/models/identifier_type.rb +0 -1
  14. data/app/models/item.rb +17 -6
  15. data/app/models/item_custom_property.rb +18 -0
  16. data/app/models/item_custom_value.rb +17 -0
  17. data/app/models/license.rb +0 -1
  18. data/app/models/manifestation.rb +55 -11
  19. data/app/models/manifestation_custom_property.rb +18 -0
  20. data/app/models/manifestation_custom_value.rb +17 -0
  21. data/app/models/medium_of_performance.rb +1 -2
  22. data/app/models/picture_file.rb +0 -2
  23. data/app/models/resource_export_file.rb +4 -2
  24. data/app/models/resource_import_file.rb +151 -61
  25. data/app/policies/item_custom_property_policy.rb +21 -0
  26. data/app/policies/manifestation_custom_property_policy.rb +21 -0
  27. data/app/views/item_custom_properties/_form.html.erb +32 -0
  28. data/app/views/item_custom_properties/edit.html.erb +13 -0
  29. data/app/views/item_custom_properties/index.html.erb +43 -0
  30. data/app/views/item_custom_properties/new.html.erb +12 -0
  31. data/app/views/item_custom_properties/show.html.erb +28 -0
  32. data/app/views/items/_form.html.erb +13 -0
  33. data/app/views/items/show.html.erb +6 -0
  34. data/app/views/manifestation_custom_properties/_form.html.erb +32 -0
  35. data/app/views/manifestation_custom_properties/edit.html.erb +13 -0
  36. data/app/views/manifestation_custom_properties/index.html.erb +43 -0
  37. data/app/views/manifestation_custom_properties/new.html.erb +12 -0
  38. data/app/views/manifestation_custom_properties/show.html.erb +28 -0
  39. data/app/views/manifestations/_export_detail.html.erb +1 -0
  40. data/app/views/manifestations/_export_list.html.erb +1 -0
  41. data/app/views/manifestations/_form.html.erb +18 -0
  42. data/app/views/manifestations/_show_detail_librarian.html.erb +14 -0
  43. data/app/views/manifestations/_show_detail_user.html.erb +8 -0
  44. data/app/views/manifestations/show.json.jbuilder +2 -0
  45. data/app/views/picture_files/edit.html.erb +4 -0
  46. data/config/locales/translation_en.yml +22 -8
  47. data/config/locales/translation_ja.yml +22 -8
  48. data/config/routes.rb +2 -0
  49. data/db/migrate/20081027150907_create_picture_files.rb +0 -2
  50. data/db/migrate/20200425072340_create_manifestation_custom_properties.rb +12 -0
  51. data/db/migrate/20200425072349_create_item_custom_properties.rb +12 -0
  52. data/db/migrate/20200425074758_create_manifestation_custom_values.rb +12 -0
  53. data/db/migrate/20200425074822_create_item_custom_values.rb +12 -0
  54. data/lib/enju_biblio/openurl.rb +5 -1
  55. data/lib/enju_biblio/sru.rb +2 -0
  56. data/lib/enju_biblio/version.rb +1 -1
  57. data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/when_it_is_written_in_utf-8/should_import_custom_values.yml +121 -0
  58. data/spec/cassette_library/resource_import_results/index_txt_ruby/renders_a_list_of_resource_import_results.yml +121 -0
  59. data/spec/controllers/content_types_controller_spec.rb +1 -1
  60. data/spec/controllers/item_custom_properties_controller_spec.rb +449 -0
  61. data/spec/controllers/items_controller_spec.rb +22 -0
  62. data/spec/controllers/manifestation_custom_properties_controller_spec.rb +449 -0
  63. data/spec/controllers/manifestations_controller_spec.rb +22 -0
  64. data/spec/dummy/db/schema.rb +43 -23
  65. data/spec/factories/item_custom_property.rb +6 -0
  66. data/spec/factories/item_custom_value.rb +6 -0
  67. data/spec/factories/manifestation_custom_property.rb +6 -0
  68. data/spec/factories/manifestation_custom_value.rb +6 -0
  69. data/spec/fixtures/creates.yml +2 -0
  70. data/spec/fixtures/item_custom_properties.yml +24 -0
  71. data/spec/fixtures/library_groups.yml +0 -2
  72. data/spec/fixtures/manifestation_custom_properties.yml +24 -0
  73. data/spec/fixtures/picture_files.yml +0 -2
  74. data/spec/fixtures/produces.yml +2 -0
  75. data/spec/fixtures/realizes.yml +2 -0
  76. data/spec/models/item_custom_property_spec.rb +18 -0
  77. data/spec/models/item_custom_value_spec.rb +17 -0
  78. data/spec/models/manifestation_custom_property_spec.rb +18 -0
  79. data/spec/models/manifestation_custom_value_spec.rb +17 -0
  80. data/spec/models/manifestation_spec.rb +16 -1
  81. data/spec/models/picture_file_spec.rb +0 -2
  82. data/spec/models/resource_export_file_spec.rb +61 -8
  83. data/spec/models/resource_import_file_spec.rb +43 -13
  84. data/spec/requests/item_custom_properties_spec.rb +129 -0
  85. data/spec/requests/manifestation_custom_properties_spec.rb +129 -0
  86. data/spec/routing/item_custom_properties_routing_spec.rb +38 -0
  87. data/spec/routing/manifestation_custom_properties_routing_spec.rb +38 -0
  88. data/spec/system/items_spec.rb +12 -0
  89. data/spec/system/manifestations_spec.rb +12 -0
  90. data/spec/views/item_custom_properties/edit.html.erb_spec.rb +21 -0
  91. data/spec/views/item_custom_properties/index.html.erb_spec.rb +25 -0
  92. data/spec/views/item_custom_properties/new.html.erb_spec.rb +21 -0
  93. data/spec/views/item_custom_properties/show.html.erb_spec.rb +16 -0
  94. data/spec/views/manifestation_custom_properties/edit.html.erb_spec.rb +21 -0
  95. data/spec/views/manifestation_custom_properties/index.html.erb_spec.rb +25 -0
  96. data/spec/views/manifestation_custom_properties/new.html.erb_spec.rb +21 -0
  97. data/spec/views/manifestation_custom_properties/show.html.erb_spec.rb +16 -0
  98. data/spec/views/manifestations/show.json.jbuilder_spec.rb +16 -0
  99. data/spec/views/resource_import_results/index.txt.ruby_spec.rb +4 -4
  100. metadata +560 -481
  101. data/db/migrate/20200322053443_add_default_custom_label_to_library_group.rb +0 -6
  102. data/db/migrate/20200322083313_create_custom_labels.rb +0 -10
  103. data/db/migrate/20200322083458_create_custom_properties.rb +0 -12
@@ -0,0 +1,18 @@
1
+ class ManifestationCustomProperty < ApplicationRecord
2
+ include MasterModel
3
+ validates :name, presence: true, uniqueness: true
4
+ acts_as_list
5
+ end
6
+
7
+ # == Schema Information
8
+ #
9
+ # Table name: manifestation_custom_properties
10
+ #
11
+ # id :integer not null, primary key
12
+ # name :string not null
13
+ # display_name :text not null
14
+ # note :text
15
+ # position :integer default(1), not null
16
+ # created_at :datetime not null
17
+ # updated_at :datetime not null
18
+ #
@@ -0,0 +1,17 @@
1
+ class ManifestationCustomValue < ApplicationRecord
2
+ belongs_to :manifestation_custom_property
3
+ belongs_to :manifestation, required: false
4
+ validates :manifestation_custom_property, uniqueness: {scope: :manifestation_id}
5
+ end
6
+
7
+ # == Schema Information
8
+ #
9
+ # Table name: manifestation_custom_values
10
+ #
11
+ # id :integer not null, primary key
12
+ # manifestation_custom_property_id :integer not null
13
+ # manifestation_id :integer not null
14
+ # value :text
15
+ # created_at :datetime not null
16
+ # updated_at :datetime not null
17
+ #
@@ -1,7 +1,6 @@
1
1
  class MediumOfPerformance < ApplicationRecord
2
2
  include MasterModel
3
- default_scope { order('medium_of_performances.position') }
4
- has_many :works
3
+ has_many :works, class_name: 'Manifestation'
5
4
  end
6
5
 
7
6
  # == Schema Information
@@ -45,9 +45,7 @@ end
45
45
  # id :integer not null, primary key
46
46
  # picture_attachable_id :integer
47
47
  # picture_attachable_type :string
48
- # content_type :string
49
48
  # title :text
50
- # thumbnail :string
51
49
  # position :integer
52
50
  # created_at :datetime
53
51
  # updated_at :datetime
@@ -31,8 +31,10 @@ class ResourceExportFile < ApplicationRecord
31
31
  transition_to!(:started)
32
32
  role_name = user.try(:role).try(:name)
33
33
  tsv = Manifestation.export(role: role_name)
34
- self.resource_export = StringIO.new(tsv)
35
- self.resource_export.instance_write(:filename, "resource_export.txt")
34
+ file = StringIO.new(tsv)
35
+ file.class.class_eval { attr_accessor :original_filename, :content_type }
36
+ file.original_filename = 'resource_export.txt'
37
+ self.resource_export = file
36
38
  save!
37
39
  transition_to!(:completed)
38
40
  mailer = ResourceExportMailer.completed(self)
@@ -76,12 +76,13 @@ class ResourceImportFile < ApplicationRecord
76
76
  #end
77
77
  row_num = 1
78
78
 
79
- ResourceImportResult.create!(resource_import_file_id: id, body: rows.headers.join("\t"))
79
+ ResourceImportResult.create!(resource_import_file_id: id, body: (%w( imported_manifestation_id imported_item_id ) + rows.headers).join("\t"))
80
80
  rows.each do |row|
81
81
  row_num += 1
82
- import_result = ResourceImportResult.create!(resource_import_file_id: id, body: row.fields.join("\t"))
82
+ import_result = ResourceImportResult.new(resource_import_file_id: id)
83
83
  if row['dummy'].to_s.strip.present?
84
84
  import_result.error_message = "line #{row_num}: #{I18n.t('import.dummy')}"
85
+ import_result.body = ([nil, nil] + row.fields).join("\t")
85
86
  import_result.save!
86
87
  next
87
88
  end
@@ -92,6 +93,7 @@ class ResourceImportFile < ApplicationRecord
92
93
  import_result.item = item
93
94
  import_result.manifestation = item.manifestation
94
95
  import_result.error_message = "line #{row_num}: #{I18n.t('import.item_found')}"
96
+ import_result.body = ([item.manifestation.id, item.id] + row.fields).join("\t")
95
97
  import_result.save!
96
98
  num[:item_found] += 1
97
99
  next
@@ -187,8 +189,13 @@ class ResourceImportFile < ApplicationRecord
187
189
  import_result.manifestation = manifestation
188
190
 
189
191
  if manifestation
192
+ ResourceImportFile.import_manifestation_custom_value(row, manifestation).each do |value|
193
+ value.update!(manifestation: manifestation)
194
+ end
195
+
196
+ item = nil
190
197
  if item_identifier.present? || row['shelf'].present? || row['call_number'].present?
191
- import_result.item = create_item(row, manifestation)
198
+ item = create_item(row, manifestation)
192
199
  else
193
200
  if manifestation.fulltext_content?
194
201
  item = create_item(row, manifestation)
@@ -200,17 +207,21 @@ class ResourceImportFile < ApplicationRecord
200
207
  end
201
208
  num[:failed] += 1
202
209
  end
210
+
211
+ if item
212
+ ResourceImportFile.import_item_custom_value(row, item).each do |value|
213
+ value.update!(item: item)
214
+ end
215
+
216
+ import_result.item = item
217
+ end
203
218
  else
204
219
  num[:failed] += 1
205
220
  end
206
221
 
222
+ import_result.body = ([manifestation.try(:id), item.try(:id)] + row.fields).join("\t")
207
223
  import_result.save!
208
- num[:item_imported] +=1 if import_result.item
209
-
210
- if row_num % 50 == 0
211
- Sunspot.commit
212
- GC.start
213
- end
224
+ num[:item_imported] += 1 if import_result.item
214
225
  end
215
226
 
216
227
  Sunspot.commit
@@ -311,56 +322,24 @@ class ResourceImportFile < ApplicationRecord
311
322
  rows.each do |row|
312
323
  row_num += 1
313
324
  import_result = ResourceImportResult.create!(resource_import_file_id: id, body: row.fields.join("\t"))
314
- item_identifier = row['item_identifier'].to_s.strip
315
- item = Item.find_by(item_identifier: item_identifier) if item_identifier.present?
325
+ item = Item.find_by(item_identifier: row['item_identifier'].to_s.strip) if row['item_identifier'].to_s.strip.present?
326
+ unless item
327
+ item = Item.find_by(id: row['item_id'].to_s.strip) if row['item_id'].to_s.strip.present?
328
+ end
329
+
316
330
  if item
317
331
  if item.manifestation
318
332
  fetch(row, edit_mode: 'update')
333
+ item = update_item(item, row)
319
334
  end
320
335
 
321
- shelf = Shelf.find_by(name: row['shelf'].to_s.strip)
322
- bookstore = Bookstore.find_by(name: row['bookstore'])
323
- required_role = Role.find_by(name: row['required_role'])
324
-
325
- item.shelf = shelf if shelf
326
- item.bookstore = bookstore if bookstore
327
- item.required_role = required_role if required_role
328
-
329
- acquired_at = Time.zone.parse(row['acquired_at']) rescue nil
330
- binded_at = Time.zone.parse(row['binded_at']) rescue nil
331
- item.acquired_at = acquired_at if acquired_at
332
- item.binded_at = binded_at if binded_at
333
-
334
- if defined?(EnjuCirculation)
335
- circulation_status = CirculationStatus.find_by(name: row['circulation_status'])
336
- checkout_type = CheckoutType.find_by(name: row['checkout_type'])
337
- use_restriction = UseRestriction.find_by(name: row['use_restriction'].to_s.strip)
338
- item.circulation_status = circulation_status if circulation_status
339
- item.checkout_type = checkout_type if checkout_type
340
- item.use_restriction = use_restriction if use_restriction
336
+ ResourceImportFile.import_item_custom_value(row, item).each do |value|
337
+ value.update!(item: item)
341
338
  end
342
-
343
- item_columns = %w(
344
- call_number
345
- binding_item_identifier binding_call_number binded_at
346
- )
347
- item_columns.each do |column|
348
- if row[column].present?
349
- item.assign_attributes(:"#{column}" => row[column])
350
- end
339
+ ResourceImportFile.import_manifestation_custom_value(row, item.manifestation).each do |value|
340
+ value.update!(manifestation: item.manifestation)
351
341
  end
352
342
 
353
- item.price = row['item_price'] if row['item_price'].present?
354
- item.note = row['item_note'].try(:gsub, /\\n/, "\n") if row['item_note'].present?
355
- item.url = row['item_url'] if row['item_url'].present?
356
-
357
- if row['include_supplements']
358
- if %w(t true).include?(row['include_supplements'].downcase.strip)
359
- item.include_supplements = true
360
- else
361
- item.include_supplements = false if item.include_supplements
362
- end
363
- end
364
343
  item.manifestation.reload
365
344
  item.save!
366
345
  import_result.item = item
@@ -372,6 +351,9 @@ class ResourceImportFile < ApplicationRecord
372
351
  end
373
352
  if manifestation
374
353
  fetch(row, edit_mode: 'update')
354
+ ResourceImportFile.import_manifestation_custom_value(row, manifestation).each do |value|
355
+ value.update!(manifestation: manifestation)
356
+ end
375
357
  import_result.manifestation = manifestation
376
358
  end
377
359
  end
@@ -397,8 +379,11 @@ class ResourceImportFile < ApplicationRecord
397
379
 
398
380
  rows.each do |row|
399
381
  row_num += 1
400
- item_identifier = row['item_identifier'].to_s.strip
401
- item = Item.find_by(item_identifier: item_identifier)
382
+ item = Item.find_by(item_identifier: row['item_identifier'].to_s.strip) if row['item_identifier'].to_s.strip.present?
383
+ unless item
384
+ item = Item.find_by(id: row['item_id'].to_s.strip) if row['item_id'].to_s.strip.present?
385
+ end
386
+
402
387
  if item
403
388
  item.destroy if item.removable?
404
389
  end
@@ -422,10 +407,9 @@ class ResourceImportFile < ApplicationRecord
422
407
  row_num = 1
423
408
 
424
409
  rows.each do |row|
425
- item_identifier = row['item_identifier'].to_s.strip
426
- item = Item.find_by(item_identifier: item_identifier)
410
+ item = Item.find_by(item_identifier: row['item_identifier'].to_s.strip) if row['item_identifier'].to_s.strip.present?
427
411
  unless item
428
- item = Item.find_by(id: row['item_id'].to_s.strip)
412
+ item = Item.find_by(id: row['item_id'].to_s.strip) if row['item_id'].to_s.strip.present?
429
413
  end
430
414
 
431
415
  manifestation_identifier = row['manifestation_identifier'].to_s.strip
@@ -482,6 +466,9 @@ class ResourceImportFile < ApplicationRecord
482
466
  use_restriction include_supplements item_note item_url
483
467
  dummy
484
468
  )
469
+ header_columns += ManifestationCustomProperty.order(:position).pluck(:name).map{|c| "manifestation:#{c}"}
470
+ header_columns += ItemCustomProperty.order(:position).pluck(:name).map{|c| "item:#{c}"}
471
+
485
472
  if defined?(EnjuSubject)
486
473
  header_columns += ClassificationType.order(:position).pluck(:name).map{|c| "classification:#{c}"}
487
474
  header_columns += SubjectHeadingType.order(:position).pluck(:name).map{|s| "subject:#{s}"}
@@ -578,12 +565,68 @@ class ResourceImportFile < ApplicationRecord
578
565
  item
579
566
  end
580
567
 
568
+ def update_item(item, row)
569
+ shelf = Shelf.find_by(name: row['shelf'].to_s.strip)
570
+ bookstore = Bookstore.find_by(name: row['bookstore'])
571
+ required_role = Role.find_by(name: row['required_role'])
572
+
573
+ item.shelf = shelf if shelf
574
+ item.bookstore = bookstore if bookstore
575
+ item.required_role = required_role if required_role
576
+
577
+ acquired_at = Time.zone.parse(row['acquired_at']) rescue nil
578
+ binded_at = Time.zone.parse(row['binded_at']) rescue nil
579
+ item.acquired_at = acquired_at if acquired_at
580
+ item.binded_at = binded_at if binded_at
581
+
582
+ if defined?(EnjuCirculation)
583
+ circulation_status = CirculationStatus.find_by(name: row['circulation_status'])
584
+ checkout_type = CheckoutType.find_by(name: row['checkout_type'])
585
+ use_restriction = UseRestriction.find_by(name: row['use_restriction'].to_s.strip)
586
+ item.circulation_status = circulation_status if circulation_status
587
+ item.checkout_type = checkout_type if checkout_type
588
+ item.use_restriction = use_restriction if use_restriction
589
+ end
590
+
591
+ item_columns = %w(
592
+ call_number
593
+ binding_item_identifier binding_call_number binded_at
594
+ )
595
+ item_columns.each do |column|
596
+ if row[column].present?
597
+ item.assign_attributes(:"#{column}" => row[column])
598
+ end
599
+ end
600
+
601
+ item.price = row['item_price'] if row['item_price'].present?
602
+ item.note = row['item_note'].try(:gsub, /\\n/, "\n") if row['item_note'].present?
603
+ item.url = row['item_url'] if row['item_url'].present?
604
+
605
+ if row['include_supplements']
606
+ if %w(t true).include?(row['include_supplements'].downcase.strip)
607
+ item.include_supplements = true
608
+ else
609
+ item.include_supplements = false if item.include_supplements
610
+ end
611
+ end
612
+
613
+ item
614
+ end
615
+
581
616
  def fetch(row, options = {edit_mode: 'create'})
582
- case options[:edit_mode]
583
- when 'create'
584
- manifestation = nil
585
- when 'update'
586
- manifestation = Item.find_by(item_identifier: row['item_identifier'].to_s.strip).try(:manifestation)
617
+ manifestation = nil
618
+ item = nil
619
+
620
+ if options[:edit_mode] == 'update'
621
+ if row['item_identifier'].to_s.strip.present?
622
+ item = Item.find_by(item_identifier: row['item_identifier'].to_s.strip)
623
+ end
624
+ if row['item_id'].to_s.strip.present?
625
+ item = Item.find_by(id: row['item_id'].to_s.strip)
626
+ end
627
+
628
+ manifestation = item.manifestation if item
629
+
587
630
  unless manifestation
588
631
  manifestation_identifier = row['manifestation_identifier'].to_s.strip
589
632
  manifestation = Manifestation.find_by(manifestation_identifier: manifestation_identifier) if manifestation_identifier
@@ -764,6 +807,7 @@ class ResourceImportFile < ApplicationRecord
764
807
  manifestation.set_agent_role_type(publishers_list, scope: :publisher)
765
808
  end
766
809
  end
810
+
767
811
  manifestation
768
812
  end
769
813
 
@@ -790,6 +834,52 @@ class ResourceImportFile < ApplicationRecord
790
834
  end
791
835
  identifiers
792
836
  end
837
+
838
+ def self.import_manifestation_custom_value(row, manifestation)
839
+ values = []
840
+ ManifestationCustomProperty.order(:position).pluck(:name).map{|c| "manifestation:#{c}"}.each do |column_name|
841
+ value = nil
842
+ property = column_name.split(':').last
843
+ next if row[column_name].blank?
844
+ if manifestation
845
+ value = manifestation.manifestation_custom_values.find_by(manifestation_custom_property: property)
846
+ end
847
+
848
+ if value
849
+ value.value = row[column_name]
850
+ else
851
+ value = ManifestationCustomValue.new(
852
+ manifestation_custom_property: ManifestationCustomProperty.find_by(name: property),
853
+ value: row[column_name]
854
+ )
855
+ end
856
+ values << value
857
+ end
858
+ values
859
+ end
860
+
861
+ def self.import_item_custom_value(row, item)
862
+ values = []
863
+ ItemCustomProperty.order(:position).pluck(:name).map{|c| "item:#{c}"}.each do |column_name|
864
+ value = nil
865
+ property = column_name.split(':').last
866
+ next if row[column_name].blank?
867
+ if item
868
+ value = item.item_custom_values.find_by(item_custom_property: property)
869
+ end
870
+
871
+ if value
872
+ value.value = row[column_name]
873
+ else
874
+ value = ItemCustomValue.new(
875
+ item_custom_property: ItemCustomProperty.find_by(name: property),
876
+ value: row[column_name]
877
+ )
878
+ end
879
+ values << value
880
+ end
881
+ values
882
+ end
793
883
  end
794
884
 
795
885
  # == Schema Information
@@ -0,0 +1,21 @@
1
+ class ItemCustomPropertyPolicy < ApplicationPolicy
2
+ def index?
3
+ true if user.try(:has_role?, 'Librarian')
4
+ end
5
+
6
+ def show?
7
+ true if user.try(:has_role?, 'Librarian')
8
+ end
9
+
10
+ def create?
11
+ true if user.try(:has_role?, 'Administrator')
12
+ end
13
+
14
+ def update?
15
+ true if user.try(:has_role?, 'Administrator')
16
+ end
17
+
18
+ def destroy?
19
+ true if user.try(:has_role?, 'Administrator')
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ class ManifestationCustomPropertyPolicy < ApplicationPolicy
2
+ def index?
3
+ true if user.try(:has_role?, 'Librarian')
4
+ end
5
+
6
+ def show?
7
+ true if user.try(:has_role?, 'Librarian')
8
+ end
9
+
10
+ def create?
11
+ true if user.try(:has_role?, 'Administrator')
12
+ end
13
+
14
+ def update?
15
+ true if user.try(:has_role?, 'Administrator')
16
+ end
17
+
18
+ def destroy?
19
+ true if user.try(:has_role?, 'Administrator')
20
+ end
21
+ end
@@ -0,0 +1,32 @@
1
+ <%= form_with(model: item_custom_property, local: true) do |form| %>
2
+ <% if item_custom_property.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(item_custom_property.errors.count, "error") %> prohibited this item_custom_property from being saved:</h2>
5
+
6
+ <ul>
7
+ <% item_custom_property.errors.full_messages.each do |message| %>
8
+ <li><%= message %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div class="form-group">
15
+ <%= form.label :name %>
16
+ <%= form.text_field :name, class: 'form-control' %>
17
+ </div>
18
+
19
+ <div class="form-group">
20
+ <%= form.label :display_name %>
21
+ <%= form.text_area :display_name, class: 'form-control' %>
22
+ </div>
23
+
24
+ <div class="form-group">
25
+ <%= form.label :note %>
26
+ <%= form.text_area :note, class: 'form-control' %>
27
+ </div>
28
+
29
+ <div class="actions">
30
+ <%= form.submit class: 'btn btn-primary' -%>
31
+ </div>
32
+ <% end %>