Skip to content

Commit

Permalink
Make QA work for allinson_flex
Browse files Browse the repository at this point in the history
Allinson Flex profiles don't have an option other than indicating which
fields to be facetable.  This commit will make QA work for Allinson Flex
by assuming the field names "rights_statement" and "license" will be QA
fields.
  • Loading branch information
kirkkwang committed Apr 29, 2023
1 parent 6b854e3 commit ce4074e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/iiif_print/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def scrub(value)
def cast_to_value(field_name:, options:)
if options&.[](:render_as) == :faceted
faceted_values_for(field_name: field_name)
elsif options&.[](:render_as) == :rights_statement || options&.[](:render_as) == :license
elsif qa_field?(field_name: options&.dig(:render_as)) || qa_field?(field_name: field_name)
authority_values_for(field_name: field_name)
else
make_link(values_for(field_name: field_name))
Expand All @@ -85,6 +85,12 @@ def faceted_values_for(field_name:)
end
end

def qa_field?(field_name:)
# assuming that rights_statement and license are fields that use questioning authority
# this will allow Allinson Flex applications that don't have render_as options to still use QA
['rights_statement', 'license'].include?(field_name.to_s)
end

def authority_values_for(field_name:)
authority = Qa::Authorities::Local.subauthority_for(field_name.to_s.pluralize)
values_for(field_name: field_name).map do |value|
Expand Down

0 comments on commit ce4074e

Please sign in to comment.