mods_display 0.10.1 → 1.0.0.alpha1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -1
- data/.rubocop_todo.yml +433 -35
- data/README.md +0 -95
- data/app/components/mods_display/field_component.html.erb +13 -0
- data/app/components/mods_display/field_component.rb +27 -0
- data/app/components/mods_display/list_field_component.html.erb +11 -0
- data/app/components/mods_display/list_field_component.rb +10 -0
- data/app/components/mods_display/record_component.html.erb +5 -0
- data/app/components/mods_display/record_component.rb +39 -0
- data/app/helpers/mods_display/record_helper.rb +106 -0
- data/app/models/mods_display/record.rb +26 -0
- data/config/locales/en.yml +1 -1
- data/config.ru +9 -0
- data/lib/mods_display/engine.rb +13 -0
- data/lib/mods_display/fields/access_condition.rb +4 -0
- data/lib/mods_display/fields/contents.rb +14 -15
- data/lib/mods_display/fields/field.rb +13 -149
- data/lib/mods_display/fields/genre.rb +4 -0
- data/lib/mods_display/fields/imprint.rb +52 -3
- data/lib/mods_display/fields/name.rb +11 -20
- data/lib/mods_display/fields/nested_related_item.rb +7 -18
- data/lib/mods_display/fields/note.rb +4 -0
- data/lib/mods_display/fields/related_item.rb +4 -0
- data/lib/mods_display/fields/sub_title.rb +3 -3
- data/lib/mods_display/fields/subject.rb +13 -39
- data/lib/mods_display/fields/title.rb +4 -0
- data/lib/mods_display/fields/values.rb +4 -4
- data/lib/mods_display/html.rb +54 -107
- data/lib/mods_display/version.rb +1 -1
- data/lib/mods_display.rb +2 -23
- data/mods_display.gemspec +15 -9
- metadata +45 -105
- data/.github/workflows/ruby.yml +0 -24
- data/.gitignore +0 -21
- data/lib/mods_display/configuration/access_condition.rb +0 -21
- data/lib/mods_display/configuration/base.rb +0 -34
- data/lib/mods_display/configuration/genre.rb +0 -9
- data/lib/mods_display/configuration/imprint.rb +0 -13
- data/lib/mods_display/configuration/name.rb +0 -9
- data/lib/mods_display/configuration/note.rb +0 -9
- data/lib/mods_display/configuration/related_item.rb +0 -9
- data/lib/mods_display/configuration/subject.rb +0 -13
- data/lib/mods_display/configuration/title.rb +0 -9
- data/lib/mods_display/configuration.rb +0 -93
- data/lib/mods_display/controller_extension.rb +0 -32
- data/lib/mods_display/helpers/record_helper.rb +0 -131
- data/lib/mods_display/model_extension.rb +0 -22
- data/lib/mods_display/railtie.rb +0 -10
- data/spec/configuration/access_condition_spec.rb +0 -10
- data/spec/configuration/base_spec.rb +0 -39
- data/spec/fake_app.rb +0 -18
- data/spec/fields/abstract_spec.rb +0 -39
- data/spec/fields/access_condition_spec.rb +0 -107
- data/spec/fields/audience_spec.rb +0 -24
- data/spec/fields/cartographics_spec.rb +0 -38
- data/spec/fields/collection_spec.rb +0 -77
- data/spec/fields/contact_spec.rb +0 -23
- data/spec/fields/contents_spec.rb +0 -39
- data/spec/fields/description_spec.rb +0 -55
- data/spec/fields/extent_spec.rb +0 -31
- data/spec/fields/form_spec.rb +0 -49
- data/spec/fields/genre_spec.rb +0 -34
- data/spec/fields/geo_spec.rb +0 -40
- data/spec/fields/identifier_spec.rb +0 -61
- data/spec/fields/imprint_spec.rb +0 -289
- data/spec/fields/language_spec.rb +0 -51
- data/spec/fields/location_spec.rb +0 -81
- data/spec/fields/name_spec.rb +0 -166
- data/spec/fields/nested_related_item_spec.rb +0 -89
- data/spec/fields/note_spec.rb +0 -72
- data/spec/fields/related_item_spec.rb +0 -72
- data/spec/fields/resource_type_spec.rb +0 -34
- data/spec/fields/sub_title_spec.rb +0 -20
- data/spec/fields/subject_spec.rb +0 -113
- data/spec/fields/title_spec.rb +0 -82
- data/spec/fixtures/access_condition_fixtures.rb +0 -58
- data/spec/fixtures/cartographics_fixtures.rb +0 -52
- data/spec/fixtures/imprint_fixtures.rb +0 -349
- data/spec/fixtures/name_fixtures.rb +0 -398
- data/spec/fixtures/nested_realted_items_fixtures.rb +0 -64
- data/spec/fixtures/related_item_fixtures.rb +0 -107
- data/spec/fixtures/subjects_fixtures.rb +0 -115
- data/spec/fixtures/title_fixtures.rb +0 -115
- data/spec/helpers/record_helper_spec.rb +0 -241
- data/spec/integration/configuration_spec.rb +0 -57
- data/spec/integration/html_spec.rb +0 -87
- data/spec/integration/installation_spec.rb +0 -26
- data/spec/spec_helper.rb +0 -46
- data/spec/test_fr.yml +0 -3
| @@ -18,30 +18,19 @@ module ModsDisplay | |
| 18 18 | 
             
                  end
         | 
| 19 19 | 
             
                end
         | 
| 20 20 |  | 
| 21 | 
            -
                def to_html
         | 
| 22 | 
            -
                   | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
| 26 | 
            -
             | 
| 27 | 
            -
                      output << "<dt#{label_class} #{sanitized_field_title(field.label)}>#{field.label}</dt>"
         | 
| 28 | 
            -
                      output << "<dd#{value_class}>"
         | 
| 29 | 
            -
                      output << '<ul class="mods_display_nested_related_items">'
         | 
| 30 | 
            -
                      output << field.values.map do |val|
         | 
| 31 | 
            -
                        "<li class='mods_display_nested_related_item open'>#{link_urls_and_email(val.to_s)}</li>"
         | 
| 32 | 
            -
                      end.join
         | 
| 33 | 
            -
                      output << '</ul>'
         | 
| 34 | 
            -
                      output << '</dd>'
         | 
| 35 | 
            -
                    end
         | 
| 36 | 
            -
                    output
         | 
| 37 | 
            -
                  end
         | 
| 21 | 
            +
                def to_html(view_context = ApplicationController.renderer)
         | 
| 22 | 
            +
                  helpers = view_context.respond_to?(:simple_format) ? view_context : ApplicationController.new.view_context
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                  component = ModsDisplay::FieldComponent.with_collection(fields, value_transformer: ->(value) { helpers.link_urls_and_email(value.to_s) })
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                  view_context.render component
         | 
| 38 27 | 
             
                end
         | 
| 39 28 |  | 
| 40 29 | 
             
                private
         | 
| 41 30 |  | 
| 42 31 | 
             
                def related_item_mods_object(value)
         | 
| 43 32 | 
             
                  mods = ::Stanford::Mods::Record.new.tap { |r| r.from_str("<mods>#{value.children.to_xml}</mods>", false) }
         | 
| 44 | 
            -
                  related_item = ModsDisplay::HTML.new( | 
| 33 | 
            +
                  related_item = ModsDisplay::HTML.new(mods)
         | 
| 45 34 |  | 
| 46 35 | 
             
                  ModsDisplay::Values.new(
         | 
| 47 36 | 
             
                    label: related_item_label(value),
         | 
| @@ -27,44 +27,14 @@ module ModsDisplay | |
| 27 27 | 
             
                end
         | 
| 28 28 |  | 
| 29 29 | 
             
                # Would really like to clean this up, but it works and is tested for now.
         | 
| 30 | 
            -
                def to_html
         | 
| 31 | 
            -
                   | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 34 | 
            -
                     | 
| 35 | 
            -
             | 
| 36 | 
            -
             | 
| 37 | 
            -
             | 
| 38 | 
            -
                      buffer = []
         | 
| 39 | 
            -
                      sub_parts = []
         | 
| 40 | 
            -
                      subjects.each do |val|
         | 
| 41 | 
            -
                        if val.is_a?(ModsDisplay::Name::Person)
         | 
| 42 | 
            -
                          buffer << val.name
         | 
| 43 | 
            -
                        else
         | 
| 44 | 
            -
                          buffer << val
         | 
| 45 | 
            -
                        end
         | 
| 46 | 
            -
                        if @config.link && @config.hierarchical_link
         | 
| 47 | 
            -
                          if val.is_a?(ModsDisplay::Name::Person)
         | 
| 48 | 
            -
                            sub_parts << link_to_value(val.name, buffer.join(' '))
         | 
| 49 | 
            -
                          else
         | 
| 50 | 
            -
                            sub_parts << link_to_value(val, buffer.join(' '))
         | 
| 51 | 
            -
                          end
         | 
| 52 | 
            -
                        elsif @config.link
         | 
| 53 | 
            -
                          if val.is_a?(ModsDisplay::Name::Person)
         | 
| 54 | 
            -
                            sub_parts << link_to_value(val.name)
         | 
| 55 | 
            -
                          else
         | 
| 56 | 
            -
                            sub_parts << link_to_value(val.to_s)
         | 
| 57 | 
            -
                          end
         | 
| 58 | 
            -
                        else
         | 
| 59 | 
            -
                          sub_parts << val.to_s
         | 
| 60 | 
            -
                        end
         | 
| 61 | 
            -
                      end
         | 
| 62 | 
            -
                      subs << sub_parts.join(@config.delimiter)
         | 
| 63 | 
            -
                    end
         | 
| 64 | 
            -
                    output << subs.join('<br/>')
         | 
| 65 | 
            -
                    output << '</dd>'
         | 
| 66 | 
            -
                  end
         | 
| 67 | 
            -
                  output
         | 
| 30 | 
            +
                def to_html(view_context = ApplicationController.renderer)
         | 
| 31 | 
            +
                  component = ModsDisplay::FieldComponent.with_collection(
         | 
| 32 | 
            +
                    fields,
         | 
| 33 | 
            +
                    delimiter: '<br />'.html_safe,
         | 
| 34 | 
            +
                    value_transformer: ->(value) { value.join(' > ') }
         | 
| 35 | 
            +
                  )
         | 
| 36 | 
            +
             | 
| 37 | 
            +
                  view_context.render component
         | 
| 68 38 | 
             
                end
         | 
| 69 39 |  | 
| 70 40 | 
             
                def process_hierarchicalGeographic(element)
         | 
| @@ -72,13 +42,17 @@ module ModsDisplay | |
| 72 42 | 
             
                end
         | 
| 73 43 |  | 
| 74 44 | 
             
                def process_name(element)
         | 
| 75 | 
            -
                  name = ModsDisplay::Name.new([element] | 
| 45 | 
            +
                  name = ModsDisplay::Name.new([element]).fields.first
         | 
| 76 46 |  | 
| 77 47 | 
             
                  name.values.first if name
         | 
| 78 48 | 
             
                end
         | 
| 79 49 |  | 
| 80 50 | 
             
                private
         | 
| 81 51 |  | 
| 52 | 
            +
                def delimiter
         | 
| 53 | 
            +
                  ' > '
         | 
| 54 | 
            +
                end
         | 
| 55 | 
            +
             | 
| 82 56 | 
             
                def values_from_subjects(element)
         | 
| 83 57 | 
             
                  return_values = []
         | 
| 84 58 | 
             
                  selected_subjects(element).each do |child|
         | 
| @@ -1,10 +1,10 @@ | |
| 1 1 | 
             
            module ModsDisplay
         | 
| 2 2 | 
             
              class Values
         | 
| 3 3 | 
             
                attr_accessor :label, :values
         | 
| 4 | 
            -
             | 
| 5 | 
            -
             | 
| 6 | 
            -
             | 
| 7 | 
            -
                   | 
| 4 | 
            +
             | 
| 5 | 
            +
                def initialize(label: nil, values: [])
         | 
| 6 | 
            +
                  @label = label
         | 
| 7 | 
            +
                  @values = values
         | 
| 8 8 | 
             
                end
         | 
| 9 9 | 
             
              end
         | 
| 10 10 | 
             
            end
         | 
    
        data/lib/mods_display/html.rb
    CHANGED
    
    | @@ -1,136 +1,83 @@ | |
| 1 1 | 
             
            module ModsDisplay
         | 
| 2 2 | 
             
              class HTML
         | 
| 3 | 
            -
                 | 
| 4 | 
            -
                   | 
| 3 | 
            +
                MODS_DISPLAY_FIELD_MAPPING = {
         | 
| 4 | 
            +
                  title: :title_info,
         | 
| 5 | 
            +
                  subTitle: :title_info,
         | 
| 6 | 
            +
                  name: :plain_name,
         | 
| 7 | 
            +
                  resourceType: :typeOfResource,
         | 
| 8 | 
            +
                  genre: :genre,
         | 
| 9 | 
            +
                  form: :physical_description,
         | 
| 10 | 
            +
                  extent: :physical_description,
         | 
| 11 | 
            +
                  geo: :extension,
         | 
| 12 | 
            +
                  imprint: :origin_info,
         | 
| 13 | 
            +
                  language: :language,
         | 
| 14 | 
            +
                  description: :physical_description,
         | 
| 15 | 
            +
                  cartographics: :subject,
         | 
| 16 | 
            +
                  abstract: :abstract,
         | 
| 17 | 
            +
                  contents: :tableOfContents,
         | 
| 18 | 
            +
                  audience: :targetAudience,
         | 
| 19 | 
            +
                  note: :note,
         | 
| 20 | 
            +
                  contact: :note,
         | 
| 21 | 
            +
                  collection: :related_item,
         | 
| 22 | 
            +
                  nestedRelatedItem: :related_item,
         | 
| 23 | 
            +
                  relatedItem: :related_item,
         | 
| 24 | 
            +
                  subject: :subject,
         | 
| 25 | 
            +
                  identifier: :identifier,
         | 
| 26 | 
            +
                  location: :location,
         | 
| 27 | 
            +
                  accessCondition: :accessCondition
         | 
| 28 | 
            +
                }.freeze
         | 
| 29 | 
            +
             | 
| 30 | 
            +
                def initialize(xml)
         | 
| 5 31 | 
             
                  @stanford_mods = xml
         | 
| 6 32 | 
             
                  @xml = xml.mods_ng_xml
         | 
| 7 | 
            -
                  @klass = klass
         | 
| 8 33 | 
             
                end
         | 
| 9 34 |  | 
| 10 35 | 
             
                def title
         | 
| 11 | 
            -
                  unless mods_field( | 
| 12 | 
            -
                    return mods_field( | 
| 36 | 
            +
                  unless mods_field(:title).fields.empty?
         | 
| 37 | 
            +
                    return mods_field(:title).fields.first.values
         | 
| 13 38 | 
             
                  end
         | 
| 14 39 | 
             
                  ''
         | 
| 15 40 | 
             
                end
         | 
| 16 41 |  | 
| 42 | 
            +
                def render_in(view_context)
         | 
| 43 | 
            +
                  body(view_context)
         | 
| 44 | 
            +
                end
         | 
| 45 | 
            +
             | 
| 17 46 | 
             
                # Need to figure out how to get the 1st title out of the list.
         | 
| 18 47 | 
             
                # Maybe have a separate class that will omit the first tite natively
         | 
| 19 48 | 
             
                # and replace the first key in the the fields list with that.
         | 
| 20 | 
            -
                def body
         | 
| 21 | 
            -
                   | 
| 22 | 
            -
                  body_fields = mods_display_fields.dup
         | 
| 23 | 
            -
                  body_fields[0] = :subTitle
         | 
| 24 | 
            -
                  body_fields.each do |field_key|
         | 
| 25 | 
            -
                    field = mods_field(@xml, field_key)
         | 
| 26 | 
            -
                    output << field.to_html unless field.nil? || field.to_html.nil?
         | 
| 27 | 
            -
                  end
         | 
| 28 | 
            -
                  output << '</dl>'
         | 
| 29 | 
            -
                end
         | 
| 30 | 
            -
             | 
| 31 | 
            -
                def to_html
         | 
| 32 | 
            -
                  output = '<dl>'
         | 
| 33 | 
            -
                  mods_display_fields.each do |field_key|
         | 
| 34 | 
            -
                    field = mods_field(@xml, field_key)
         | 
| 35 | 
            -
                    output << field.to_html unless field.nil? || field.to_html.nil?
         | 
| 36 | 
            -
                  end
         | 
| 37 | 
            -
                  output << '</dl>'
         | 
| 49 | 
            +
                def body(view_context = ApplicationController.renderer)
         | 
| 50 | 
            +
                  view_context.render ModsDisplay::RecordComponent.new(record: self)
         | 
| 38 51 | 
             
                end
         | 
| 39 52 |  | 
| 40 | 
            -
                 | 
| 41 | 
            -
             | 
| 42 | 
            -
             | 
| 43 | 
            -
                   | 
| 44 | 
            -
                    field = mods_field(@xml, method_name)
         | 
| 45 | 
            -
                    return field if (args.dig(0, :raw))
         | 
| 46 | 
            -
                    field.fields
         | 
| 47 | 
            -
                  else
         | 
| 48 | 
            -
                    super
         | 
| 49 | 
            -
                  end
         | 
| 53 | 
            +
                # @deprecated
         | 
| 54 | 
            +
                def to_html(view_context = ApplicationController.renderer)
         | 
| 55 | 
            +
                  fields = [:title] + ModsDisplay::RecordComponent::DEFAULT_FIELDS - [:subTitle]
         | 
| 56 | 
            +
                  view_context.render ModsDisplay::RecordComponent.new(record: self, fields: fields)
         | 
| 50 57 | 
             
                end
         | 
| 51 58 |  | 
| 52 | 
            -
                 | 
| 59 | 
            +
                MODS_DISPLAY_FIELD_MAPPING.except(:title).each do |key, _value|
         | 
| 60 | 
            +
                  define_method(key) do |raw: false|
         | 
| 61 | 
            +
                    field = mods_field(key)
         | 
| 62 | 
            +
                    next field if raw
         | 
| 53 63 |  | 
| 54 | 
            -
             | 
| 55 | 
            -
                  if xml.respond_to?(mods_display_field_mapping[field_key])
         | 
| 56 | 
            -
                    field = xml.send(mods_display_field_mapping[field_key])
         | 
| 57 | 
            -
                    ModsDisplay.const_get(
         | 
| 58 | 
            -
                      "#{field_key.slice(0, 1).upcase}#{field_key.slice(1..-1)}"
         | 
| 59 | 
            -
                    ).new(field, field_config(field_key), @klass)
         | 
| 60 | 
            -
                  elsif @stanford_mods.respond_to?(field_key)
         | 
| 61 | 
            -
                    ModsDisplay.const_get(
         | 
| 62 | 
            -
                      "#{field_key.slice(0, 1).upcase}#{field_key.slice(1..-1)}"
         | 
| 63 | 
            -
                    ).new(@stanford_mods, field_config(field_key), @klass)
         | 
| 64 | 
            +
                    field.fields
         | 
| 64 65 | 
             
                  end
         | 
| 65 66 | 
             
                end
         | 
| 66 67 |  | 
| 67 | 
            -
                def  | 
| 68 | 
            -
                  @ | 
| 69 | 
            -
                rescue
         | 
| 70 | 
            -
                  ModsDisplay::Configuration::Base.new
         | 
| 71 | 
            -
                end
         | 
| 68 | 
            +
                def mods_field(key)
         | 
| 69 | 
            +
                  raise ArgumentError unless MODS_DISPLAY_FIELD_MAPPING[key] && @xml.respond_to?(MODS_DISPLAY_FIELD_MAPPING[key])
         | 
| 72 70 |  | 
| 73 | 
            -
             | 
| 74 | 
            -
                   | 
| 75 | 
            -
                   :name,
         | 
| 76 | 
            -
                   :language,
         | 
| 77 | 
            -
                   :imprint,
         | 
| 78 | 
            -
                   :resourceType,
         | 
| 79 | 
            -
                   :genre,
         | 
| 80 | 
            -
                   :form,
         | 
| 81 | 
            -
                   :extent,
         | 
| 82 | 
            -
                   :geo,
         | 
| 83 | 
            -
                   :description,
         | 
| 84 | 
            -
                   :cartographics,
         | 
| 85 | 
            -
                   :abstract,
         | 
| 86 | 
            -
                   :contents,
         | 
| 87 | 
            -
                   :audience,
         | 
| 88 | 
            -
                   :note,
         | 
| 89 | 
            -
                   :contact,
         | 
| 90 | 
            -
                   :collection,
         | 
| 91 | 
            -
                   :nestedRelatedItem,
         | 
| 92 | 
            -
                   :relatedItem,
         | 
| 93 | 
            -
                   :subject,
         | 
| 94 | 
            -
                   :identifier,
         | 
| 95 | 
            -
                   :location,
         | 
| 96 | 
            -
                   :accessCondition
         | 
| 97 | 
            -
                  ]
         | 
| 71 | 
            +
                  field = @xml.public_send(MODS_DISPLAY_FIELD_MAPPING[key])
         | 
| 72 | 
            +
                  mods_field_class(key).new(field)
         | 
| 98 73 | 
             
                end
         | 
| 99 74 |  | 
| 100 | 
            -
                 | 
| 101 | 
            -
                  { title: :title_info,
         | 
| 102 | 
            -
                    subTitle: :title_info,
         | 
| 103 | 
            -
                    name: :plain_name,
         | 
| 104 | 
            -
                    resourceType: :typeOfResource,
         | 
| 105 | 
            -
                    genre: :genre,
         | 
| 106 | 
            -
                    form: :physical_description,
         | 
| 107 | 
            -
                    extent: :physical_description,
         | 
| 108 | 
            -
                    geo: :extension,
         | 
| 109 | 
            -
                    imprint: :origin_info,
         | 
| 110 | 
            -
                    language: :language,
         | 
| 111 | 
            -
                    description: :physical_description,
         | 
| 112 | 
            -
                    cartographics: :subject,
         | 
| 113 | 
            -
                    abstract: :abstract,
         | 
| 114 | 
            -
                    contents: :tableOfContents,
         | 
| 115 | 
            -
                    audience: :targetAudience,
         | 
| 116 | 
            -
                    note: :note,
         | 
| 117 | 
            -
                    contact: :note,
         | 
| 118 | 
            -
                    collection: :related_item,
         | 
| 119 | 
            -
                    nestedRelatedItem: :related_item,
         | 
| 120 | 
            -
                    relatedItem: :related_item,
         | 
| 121 | 
            -
                    subject: :subject,
         | 
| 122 | 
            -
                    identifier: :identifier,
         | 
| 123 | 
            -
                    location: :location,
         | 
| 124 | 
            -
                    accessCondition: :accessCondition }
         | 
| 125 | 
            -
                end
         | 
| 75 | 
            +
                private
         | 
| 126 76 |  | 
| 127 | 
            -
                def  | 
| 128 | 
            -
                   | 
| 129 | 
            -
                     | 
| 130 | 
            -
             | 
| 131 | 
            -
                    accessCondition: :access_condition,
         | 
| 132 | 
            -
                    nestedRelatedItem: :nested_related_item
         | 
| 133 | 
            -
                  }
         | 
| 77 | 
            +
                def mods_field_class(key)
         | 
| 78 | 
            +
                  ModsDisplay.const_get(
         | 
| 79 | 
            +
                    "#{key.slice(0, 1).upcase}#{key.slice(1..-1)}"
         | 
| 80 | 
            +
                  )
         | 
| 134 81 | 
             
                end
         | 
| 135 82 | 
             
              end
         | 
| 136 83 | 
             
            end
         | 
    
        data/lib/mods_display/version.rb
    CHANGED
    
    
    
        data/lib/mods_display.rb
    CHANGED
    
    | @@ -1,20 +1,8 @@ | |
| 1 1 | 
             
            require 'mods_display/version'
         | 
| 2 | 
            -
            require 'mods_display/controller_extension'
         | 
| 3 2 | 
             
            require 'mods_display/html'
         | 
| 4 | 
            -
            require 'mods_display/model_extension'
         | 
| 5 3 | 
             
            require 'mods_display/country_codes'
         | 
| 6 4 | 
             
            require 'mods_display/relator_codes'
         | 
| 7 5 | 
             
            require 'mods_display/related_item_concerns'
         | 
| 8 | 
            -
            require 'mods_display/configuration'
         | 
| 9 | 
            -
            require 'mods_display/configuration/base'
         | 
| 10 | 
            -
            require 'mods_display/configuration/access_condition'
         | 
| 11 | 
            -
            require 'mods_display/configuration/imprint'
         | 
| 12 | 
            -
            require 'mods_display/configuration/genre'
         | 
| 13 | 
            -
            require 'mods_display/configuration/name'
         | 
| 14 | 
            -
            require 'mods_display/configuration/note'
         | 
| 15 | 
            -
            require 'mods_display/configuration/related_item'
         | 
| 16 | 
            -
            require 'mods_display/configuration/subject'
         | 
| 17 | 
            -
            require 'mods_display/configuration/title'
         | 
| 18 6 | 
             
            require 'mods_display/fields/field'
         | 
| 19 7 | 
             
            require 'mods_display/fields/abstract'
         | 
| 20 8 | 
             
            require 'mods_display/fields/access_condition'
         | 
| @@ -38,8 +26,8 @@ require 'mods_display/fields/note' | |
| 38 26 | 
             
            require 'mods_display/fields/related_item'
         | 
| 39 27 | 
             
            require 'mods_display/fields/resource_type'
         | 
| 40 28 | 
             
            require 'mods_display/fields/subject'
         | 
| 41 | 
            -
            require 'mods_display/fields/sub_title'
         | 
| 42 29 | 
             
            require 'mods_display/fields/title'
         | 
| 30 | 
            +
            require 'mods_display/fields/sub_title'
         | 
| 43 31 | 
             
            require 'mods_display/fields/values'
         | 
| 44 32 |  | 
| 45 33 | 
             
            require 'stanford-mods'
         | 
| @@ -50,13 +38,4 @@ I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks) | |
| 50 38 | 
             
            I18n.load_path += Dir["#{File.expand_path('../..', __FILE__)}/config/locales/*.yml"]
         | 
| 51 39 | 
             
            I18n.backend.load_translations
         | 
| 52 40 |  | 
| 53 | 
            -
             | 
| 54 | 
            -
            begin
         | 
| 55 | 
            -
              require 'rails'
         | 
| 56 | 
            -
            rescue LoadError
         | 
| 57 | 
            -
              #do nothing
         | 
| 58 | 
            -
            end
         | 
| 59 | 
            -
             | 
| 60 | 
            -
            if defined? ::Rails::Railtie
         | 
| 61 | 
            -
              require 'mods_display/railtie'
         | 
| 62 | 
            -
            end
         | 
| 41 | 
            +
            require 'mods_display/engine'
         | 
    
        data/mods_display.gemspec
    CHANGED
    
    | @@ -1,7 +1,5 @@ | |
| 1 | 
            -
            #  | 
| 2 | 
            -
             | 
| 3 | 
            -
            $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
         | 
| 4 | 
            -
            require 'mods_display/version'
         | 
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
            require_relative "lib/mods_display/version"
         | 
| 5 3 |  | 
| 6 4 | 
             
            Gem::Specification.new do |gem|
         | 
| 7 5 | 
             
              gem.name          = 'mods_display'
         | 
| @@ -12,13 +10,20 @@ Gem::Specification.new do |gem| | |
| 12 10 | 
             
              gem.summary       = 'The MODS Display gem allows implementers to configure a customized display of MODS metadata.  This display implements the specifications defined at Stanford for how to display MODS.'
         | 
| 13 11 | 
             
              gem.homepage      = 'https://github.com/sul-dlss/mods_display'
         | 
| 14 12 |  | 
| 15 | 
            -
               | 
| 16 | 
            -
               | 
| 17 | 
            -
              gem. | 
| 18 | 
            -
             | 
| 13 | 
            +
              # Specify which files should be added to the gem when it is released.
         | 
| 14 | 
            +
              # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
         | 
| 15 | 
            +
              gem.files = Dir.chdir(File.expand_path(__dir__)) do
         | 
| 16 | 
            +
                `git ls-files -z`.split("\x0").reject do |f|
         | 
| 17 | 
            +
                  (f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
         | 
| 18 | 
            +
                end
         | 
| 19 | 
            +
              end
         | 
| 20 | 
            +
              gem.bindir = "exe"
         | 
| 21 | 
            +
              gem.executables = gem.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
         | 
| 22 | 
            +
              gem.require_paths = ["lib"]
         | 
| 19 23 |  | 
| 20 24 | 
             
              gem.add_dependency 'stanford-mods', '~> 2.1'
         | 
| 21 25 | 
             
              gem.add_dependency 'i18n'
         | 
| 26 | 
            +
              gem.add_dependency 'view_component'
         | 
| 22 27 |  | 
| 23 28 | 
             
              gem.add_development_dependency 'rake'
         | 
| 24 29 | 
             
              gem.add_development_dependency 'rspec', '~> 3.0'
         | 
| @@ -26,5 +31,6 @@ Gem::Specification.new do |gem| | |
| 26 31 | 
             
              gem.add_development_dependency 'rubocop'
         | 
| 27 32 | 
             
              gem.add_development_dependency 'capybara'
         | 
| 28 33 | 
             
              gem.add_development_dependency 'byebug'
         | 
| 29 | 
            -
              gem.add_development_dependency 'rails', '~> 6.0'
         | 
| 34 | 
            +
              gem.add_development_dependency 'rails', ENV['RAILS_VERSION'] || '~> 6.0'
         | 
| 35 | 
            +
              gem.add_development_dependency 'combustion', '~> 1.3'
         | 
| 30 36 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: mods_display
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 1.0.0.alpha1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Jessie Keck
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 | 
            -
            bindir:  | 
| 9 | 
            +
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2022-01-11 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: stanford-mods
         | 
| @@ -38,6 +38,20 @@ dependencies: | |
| 38 38 | 
             
                - - ">="
         | 
| 39 39 | 
             
                  - !ruby/object:Gem::Version
         | 
| 40 40 | 
             
                    version: '0'
         | 
| 41 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 42 | 
            +
              name: view_component
         | 
| 43 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 44 | 
            +
                requirements:
         | 
| 45 | 
            +
                - - ">="
         | 
| 46 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 47 | 
            +
                    version: '0'
         | 
| 48 | 
            +
              type: :runtime
         | 
| 49 | 
            +
              prerelease: false
         | 
| 50 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 51 | 
            +
                requirements:
         | 
| 52 | 
            +
                - - ">="
         | 
| 53 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 54 | 
            +
                    version: '0'
         | 
| 41 55 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 42 56 | 
             
              name: rake
         | 
| 43 57 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -136,6 +150,20 @@ dependencies: | |
| 136 150 | 
             
                - - "~>"
         | 
| 137 151 | 
             
                  - !ruby/object:Gem::Version
         | 
| 138 152 | 
             
                    version: '6.0'
         | 
| 153 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 154 | 
            +
              name: combustion
         | 
| 155 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 156 | 
            +
                requirements:
         | 
| 157 | 
            +
                - - "~>"
         | 
| 158 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 159 | 
            +
                    version: '1.3'
         | 
| 160 | 
            +
              type: :development
         | 
| 161 | 
            +
              prerelease: false
         | 
| 162 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 163 | 
            +
                requirements:
         | 
| 164 | 
            +
                - - "~>"
         | 
| 165 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 166 | 
            +
                    version: '1.3'
         | 
| 139 167 | 
             
            description: MODS Display is a gem to centralize the display logic of MODS medadata.
         | 
| 140 168 | 
             
            email:
         | 
| 141 169 | 
             
            - jessie.keck@gmail.com
         | 
| @@ -143,28 +171,25 @@ executables: [] | |
| 143 171 | 
             
            extensions: []
         | 
| 144 172 | 
             
            extra_rdoc_files: []
         | 
| 145 173 | 
             
            files:
         | 
| 146 | 
            -
            - ".github/workflows/ruby.yml"
         | 
| 147 | 
            -
            - ".gitignore"
         | 
| 148 174 | 
             
            - ".rubocop.yml"
         | 
| 149 175 | 
             
            - ".rubocop_todo.yml"
         | 
| 150 176 | 
             
            - Gemfile
         | 
| 151 177 | 
             
            - LICENSE.txt
         | 
| 152 178 | 
             
            - README.md
         | 
| 153 179 | 
             
            - Rakefile
         | 
| 180 | 
            +
            - app/components/mods_display/field_component.html.erb
         | 
| 181 | 
            +
            - app/components/mods_display/field_component.rb
         | 
| 182 | 
            +
            - app/components/mods_display/list_field_component.html.erb
         | 
| 183 | 
            +
            - app/components/mods_display/list_field_component.rb
         | 
| 184 | 
            +
            - app/components/mods_display/record_component.html.erb
         | 
| 185 | 
            +
            - app/components/mods_display/record_component.rb
         | 
| 186 | 
            +
            - app/helpers/mods_display/record_helper.rb
         | 
| 187 | 
            +
            - app/models/mods_display/record.rb
         | 
| 188 | 
            +
            - config.ru
         | 
| 154 189 | 
             
            - config/locales/en.yml
         | 
| 155 190 | 
             
            - lib/mods_display.rb
         | 
| 156 | 
            -
            - lib/mods_display/configuration.rb
         | 
| 157 | 
            -
            - lib/mods_display/configuration/access_condition.rb
         | 
| 158 | 
            -
            - lib/mods_display/configuration/base.rb
         | 
| 159 | 
            -
            - lib/mods_display/configuration/genre.rb
         | 
| 160 | 
            -
            - lib/mods_display/configuration/imprint.rb
         | 
| 161 | 
            -
            - lib/mods_display/configuration/name.rb
         | 
| 162 | 
            -
            - lib/mods_display/configuration/note.rb
         | 
| 163 | 
            -
            - lib/mods_display/configuration/related_item.rb
         | 
| 164 | 
            -
            - lib/mods_display/configuration/subject.rb
         | 
| 165 | 
            -
            - lib/mods_display/configuration/title.rb
         | 
| 166 | 
            -
            - lib/mods_display/controller_extension.rb
         | 
| 167 191 | 
             
            - lib/mods_display/country_codes.rb
         | 
| 192 | 
            +
            - lib/mods_display/engine.rb
         | 
| 168 193 | 
             
            - lib/mods_display/fields/abstract.rb
         | 
| 169 194 | 
             
            - lib/mods_display/fields/access_condition.rb
         | 
| 170 195 | 
             
            - lib/mods_display/fields/audience.rb
         | 
| @@ -191,55 +216,11 @@ files: | |
| 191 216 | 
             
            - lib/mods_display/fields/subject.rb
         | 
| 192 217 | 
             
            - lib/mods_display/fields/title.rb
         | 
| 193 218 | 
             
            - lib/mods_display/fields/values.rb
         | 
| 194 | 
            -
            - lib/mods_display/helpers/record_helper.rb
         | 
| 195 219 | 
             
            - lib/mods_display/html.rb
         | 
| 196 | 
            -
            - lib/mods_display/model_extension.rb
         | 
| 197 | 
            -
            - lib/mods_display/railtie.rb
         | 
| 198 220 | 
             
            - lib/mods_display/related_item_concerns.rb
         | 
| 199 221 | 
             
            - lib/mods_display/relator_codes.rb
         | 
| 200 222 | 
             
            - lib/mods_display/version.rb
         | 
| 201 223 | 
             
            - mods_display.gemspec
         | 
| 202 | 
            -
            - spec/configuration/access_condition_spec.rb
         | 
| 203 | 
            -
            - spec/configuration/base_spec.rb
         | 
| 204 | 
            -
            - spec/fake_app.rb
         | 
| 205 | 
            -
            - spec/fields/abstract_spec.rb
         | 
| 206 | 
            -
            - spec/fields/access_condition_spec.rb
         | 
| 207 | 
            -
            - spec/fields/audience_spec.rb
         | 
| 208 | 
            -
            - spec/fields/cartographics_spec.rb
         | 
| 209 | 
            -
            - spec/fields/collection_spec.rb
         | 
| 210 | 
            -
            - spec/fields/contact_spec.rb
         | 
| 211 | 
            -
            - spec/fields/contents_spec.rb
         | 
| 212 | 
            -
            - spec/fields/description_spec.rb
         | 
| 213 | 
            -
            - spec/fields/extent_spec.rb
         | 
| 214 | 
            -
            - spec/fields/form_spec.rb
         | 
| 215 | 
            -
            - spec/fields/genre_spec.rb
         | 
| 216 | 
            -
            - spec/fields/geo_spec.rb
         | 
| 217 | 
            -
            - spec/fields/identifier_spec.rb
         | 
| 218 | 
            -
            - spec/fields/imprint_spec.rb
         | 
| 219 | 
            -
            - spec/fields/language_spec.rb
         | 
| 220 | 
            -
            - spec/fields/location_spec.rb
         | 
| 221 | 
            -
            - spec/fields/name_spec.rb
         | 
| 222 | 
            -
            - spec/fields/nested_related_item_spec.rb
         | 
| 223 | 
            -
            - spec/fields/note_spec.rb
         | 
| 224 | 
            -
            - spec/fields/related_item_spec.rb
         | 
| 225 | 
            -
            - spec/fields/resource_type_spec.rb
         | 
| 226 | 
            -
            - spec/fields/sub_title_spec.rb
         | 
| 227 | 
            -
            - spec/fields/subject_spec.rb
         | 
| 228 | 
            -
            - spec/fields/title_spec.rb
         | 
| 229 | 
            -
            - spec/fixtures/access_condition_fixtures.rb
         | 
| 230 | 
            -
            - spec/fixtures/cartographics_fixtures.rb
         | 
| 231 | 
            -
            - spec/fixtures/imprint_fixtures.rb
         | 
| 232 | 
            -
            - spec/fixtures/name_fixtures.rb
         | 
| 233 | 
            -
            - spec/fixtures/nested_realted_items_fixtures.rb
         | 
| 234 | 
            -
            - spec/fixtures/related_item_fixtures.rb
         | 
| 235 | 
            -
            - spec/fixtures/subjects_fixtures.rb
         | 
| 236 | 
            -
            - spec/fixtures/title_fixtures.rb
         | 
| 237 | 
            -
            - spec/helpers/record_helper_spec.rb
         | 
| 238 | 
            -
            - spec/integration/configuration_spec.rb
         | 
| 239 | 
            -
            - spec/integration/html_spec.rb
         | 
| 240 | 
            -
            - spec/integration/installation_spec.rb
         | 
| 241 | 
            -
            - spec/spec_helper.rb
         | 
| 242 | 
            -
            - spec/test_fr.yml
         | 
| 243 224 | 
             
            homepage: https://github.com/sul-dlss/mods_display
         | 
| 244 225 | 
             
            licenses: []
         | 
| 245 226 | 
             
            metadata: {}
         | 
| @@ -254,55 +235,14 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 254 235 | 
             
                  version: '0'
         | 
| 255 236 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 256 237 | 
             
              requirements:
         | 
| 257 | 
            -
              - - " | 
| 238 | 
            +
              - - ">"
         | 
| 258 239 | 
             
                - !ruby/object:Gem::Version
         | 
| 259 | 
            -
                  version:  | 
| 240 | 
            +
                  version: 1.3.1
         | 
| 260 241 | 
             
            requirements: []
         | 
| 261 | 
            -
            rubygems_version: 3.2. | 
| 242 | 
            +
            rubygems_version: 3.2.32
         | 
| 262 243 | 
             
            signing_key:
         | 
| 263 244 | 
             
            specification_version: 4
         | 
| 264 245 | 
             
            summary: The MODS Display gem allows implementers to configure a customized display
         | 
| 265 246 | 
             
              of MODS metadata.  This display implements the specifications defined at Stanford
         | 
| 266 247 | 
             
              for how to display MODS.
         | 
| 267 | 
            -
            test_files:
         | 
| 268 | 
            -
            - spec/configuration/access_condition_spec.rb
         | 
| 269 | 
            -
            - spec/configuration/base_spec.rb
         | 
| 270 | 
            -
            - spec/fake_app.rb
         | 
| 271 | 
            -
            - spec/fields/abstract_spec.rb
         | 
| 272 | 
            -
            - spec/fields/access_condition_spec.rb
         | 
| 273 | 
            -
            - spec/fields/audience_spec.rb
         | 
| 274 | 
            -
            - spec/fields/cartographics_spec.rb
         | 
| 275 | 
            -
            - spec/fields/collection_spec.rb
         | 
| 276 | 
            -
            - spec/fields/contact_spec.rb
         | 
| 277 | 
            -
            - spec/fields/contents_spec.rb
         | 
| 278 | 
            -
            - spec/fields/description_spec.rb
         | 
| 279 | 
            -
            - spec/fields/extent_spec.rb
         | 
| 280 | 
            -
            - spec/fields/form_spec.rb
         | 
| 281 | 
            -
            - spec/fields/genre_spec.rb
         | 
| 282 | 
            -
            - spec/fields/geo_spec.rb
         | 
| 283 | 
            -
            - spec/fields/identifier_spec.rb
         | 
| 284 | 
            -
            - spec/fields/imprint_spec.rb
         | 
| 285 | 
            -
            - spec/fields/language_spec.rb
         | 
| 286 | 
            -
            - spec/fields/location_spec.rb
         | 
| 287 | 
            -
            - spec/fields/name_spec.rb
         | 
| 288 | 
            -
            - spec/fields/nested_related_item_spec.rb
         | 
| 289 | 
            -
            - spec/fields/note_spec.rb
         | 
| 290 | 
            -
            - spec/fields/related_item_spec.rb
         | 
| 291 | 
            -
            - spec/fields/resource_type_spec.rb
         | 
| 292 | 
            -
            - spec/fields/sub_title_spec.rb
         | 
| 293 | 
            -
            - spec/fields/subject_spec.rb
         | 
| 294 | 
            -
            - spec/fields/title_spec.rb
         | 
| 295 | 
            -
            - spec/fixtures/access_condition_fixtures.rb
         | 
| 296 | 
            -
            - spec/fixtures/cartographics_fixtures.rb
         | 
| 297 | 
            -
            - spec/fixtures/imprint_fixtures.rb
         | 
| 298 | 
            -
            - spec/fixtures/name_fixtures.rb
         | 
| 299 | 
            -
            - spec/fixtures/nested_realted_items_fixtures.rb
         | 
| 300 | 
            -
            - spec/fixtures/related_item_fixtures.rb
         | 
| 301 | 
            -
            - spec/fixtures/subjects_fixtures.rb
         | 
| 302 | 
            -
            - spec/fixtures/title_fixtures.rb
         | 
| 303 | 
            -
            - spec/helpers/record_helper_spec.rb
         | 
| 304 | 
            -
            - spec/integration/configuration_spec.rb
         | 
| 305 | 
            -
            - spec/integration/html_spec.rb
         | 
| 306 | 
            -
            - spec/integration/installation_spec.rb
         | 
| 307 | 
            -
            - spec/spec_helper.rb
         | 
| 308 | 
            -
            - spec/test_fr.yml
         | 
| 248 | 
            +
            test_files: []
         |