Skip to content

Commit a3a1be7

Browse files
committed
Adding 5880_a field for tind spreadsheet validator
1 parent 83a31a5 commit a3a1be7

6 files changed

Lines changed: 15 additions & 3 deletions

File tree

app/lib/tind_spread/make_batch.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module TindSpread
66
module MakeBatch
77

88
def self.added_headers(form_params)
9-
added_headers = %i[336__a 852__c 540__a 980__a 982__a 982__b 982__p 991__a]
9+
added_headers = %i[336__a 852__c 540__a 5880_a 980__a 982__a 982__b 982__p 991__a]
1010
form_params.select { |key| added_headers.include?(key) }
1111
end
1212

app/lib/tind_spread/spread_tool.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def header(row)
4444
end
4545

4646
def delete_unnecessary_fields(all)
47-
remove = %w[035__a 980__a 982__a 982__b 982__p 540__a 852__a 336__a 852__c 902__ 991__a FFT__a]
47+
remove = %w[035__a 980__a 982__a 982__b 982__p 540__a 5880_a 852__a 336__a 852__c 902__ 991__a FFT__a]
4848
all.each_key do |key|
4949
all.delete(key) if remove.any? { |r| key.to_s.match(/#{r}/) }
5050
end

app/models/tind_validator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ class TindValidator < ActiveRecord::Base
33

44
# REQUIRED_PARAMS = %i[directory 980__a 982__a 982__b 540__a 336__a 852__c 902__n].freeze
55
REQUIRED_PARAMS = %i[980__a 982__a 982__b 540__a 336__a 852__c 902__n].freeze
6-
OPTIONAL_PARAMS = %i[982__p 991__a directory].freeze
6+
OPTIONAL_PARAMS = %i[982__p 991__a 5880_a directory].freeze
77

88
has_one_attached :input_file
99
validate :directory_must_exist

app/views/tind_validator/new.html.erb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,13 @@
9393
<%= f.text_area(:'540__a', class: 'narrow form-control', autofocus: true, value: t('tind_marc_batch.standard_rights_statement'), rows: 8, required: true ) %>
9494
</div>
9595

96+
<div class="form-label form-group">
97+
<%= label_tag('5880_a', '5880_a (optional, source of description)', class: 'control-label') %>
98+
</div>
99+
<div class="form-input mb-4">
100+
<%= f.text_field(:'5880_a', class: 'narrow form-control', required: false, autofocus: true) %>
101+
</div>
102+
96103
<div class="form-label form-group">
97104
<%= label_tag('991__a', 'Restriction (optional)', class: 'control-label') %>
98105
</div>

spec/models/tind_validator_spec.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
'982__b': 'Italian Librettos',
1919
'982__p': 'Some larger project',
2020
'540__a': 'some restriction text',
21+
'5880_a': 'image, source of description',
2122
'336__a': 'Image',
2223
'852__c': 'The Bancroft Library',
2324
'902__n': 'DMZ',
@@ -44,6 +45,7 @@
4445
'982__b': 'Italian Librettos',
4546
'982__p': 'Some parent collection',
4647
'540__a': 'some restriction text',
48+
'5880_a': 'image, source of description',
4749
'336__a': 'Image',
4850
'852__c': 'The Bancroft Library',
4951
'902__n': 'DMZ',
@@ -71,6 +73,7 @@
7173
resource_type: nil,
7274
library: nil,
7375
f_982_p: nil,
76+
f_588_p: nil,
7477
restriction: nil,
7578
fail: nil
7679
}

spec/request/tind_validator_request_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
'982__b': 'Italian Librettos',
5252
'982__p': 'Some larger project',
5353
'540__a': 'some restriction text',
54+
'5880_a': 'Image, source of description',
5455
'336__a': 'Image',
5556
'852__c': 'The Bancroft Library',
5657
'902__n': 'DMZ',
@@ -74,6 +75,7 @@
7475
'982__b': 'Italian Librettos',
7576
'982__p': 'Some larger project',
7677
'540__a': 'some restriction text',
78+
'5880_a': 'Image, source of description',
7779
'336__a': 'Image',
7880
'852__c': 'The Bancroft Library',
7981
'902__n': 'DMZ',

0 commit comments

Comments
 (0)