Skip to content

Add i18n labels for exhibit tags which are automatically added #2842

Open
@jeremyf

Description

@jeremyf

In the following code, we are not adding label options for exhibit tags.

def add_exhibit_tags_fields(config)
# rubocop:disable Style/GuardClause
unless config.show_fields.include? :exhibit_tags
config.add_show_field :exhibit_tags, field: config.document_model.solr_field_for_tagger(exhibit),
link_to_facet: true,
separator_options: { words_connector: nil, two_words_connector: nil, last_word_connector: nil }
end
unless config.facet_fields.include? :exhibit_tags
config.add_facet_field :exhibit_tags, field: config.document_model.solr_field_for_tagger(exhibit), limit: true
end
# rubocop:enable Style/GuardClause
end

It could be that the lack of labels is not a bug as folks could add to the catalog controller the show and facet fields.

Would the following change be appropriate?

  def add_exhibit_tags_fields(config)
      # rubocop:disable Style/GuardClause
      unless config.show_fields.include? :exhibit_tags
        config.add_show_field(
          :exhibit_tags,
          field: config.document_model.solr_field_for_tagger(exhibit),
          link_to_facet: true,
          separator_options: { words_connector: nil, two_words_connector: nil, last_word_connector: nil },
          label: I18n.t('spotlight.search.fields.facet.exhibit_tags')
        )
      end

      unless config.facet_fields.include? :exhibit_tags
        config.add_facet_field(
          :exhibit_tags,
          field: config.document_model.solr_field_for_tagger(exhibit),
          limit: true,
          label: I18n.t('spotlight.search.fields.facet.exhibit_tags')
        )
      end
      # rubocop:enable Style/GuardClause
    end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions