Skip to content

Commit

Permalink
🎁 Add campus to facets
Browse files Browse the repository at this point in the history
This will render the campus in the facets field.  All of the changes
came from the current ngao app.

Ref:
- #19
  • Loading branch information
kirkkwang committed Aug 24, 2024
1 parent 2004d26 commit 098eccf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ class CatalogController < ApplicationController
# :index_range can be an array or range of prefixes that will be used to create the navigation
# (note: It is case sensitive when searching values)

config.add_facet_field 'campus_unit_sim', label: 'Campus', helper_method: :render_campus_facet
config.add_facet_field 'collection', field: 'collection_ssim', limit: 10
config.add_facet_field 'creators', field: 'creator_ssim', limit: 10
config.add_facet_field 'date_range', field: 'date_range_isim', range: true
Expand All @@ -152,6 +153,8 @@ class CatalogController < ApplicationController
# handler defaults, or have no facets.
config.add_facet_fields_to_solr_request!

config.add_index_field 'campus_unit_ssm', label: 'Campus', helper_method: :render_campus_name

# solr fields to be displayed in the index (search results) view
# The ordering of the field names is the order of the display
config.add_index_field 'highlight', accessor: 'highlights', separator_options: {
Expand Down Expand Up @@ -423,6 +426,8 @@ class CatalogController < ApplicationController
# Collection and Component Show Page Access Tab - How to Cite Section
config.add_cite_field 'prefercite', field: 'prefercite_html_tesm', helper_method: :render_html_tags

config.add_contact_field 'campus_unit_ssm', label: 'Campus', helper_method: :render_campus_name

# Collection and Component Show Page Access Tab - Contact Section
config.add_contact_field 'repository_contact', values: ->(_, document, _) { document.repository_config&.contact }

Expand Down
9 changes: 9 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,13 @@ module ApplicationHelper
def additional_locale_routing_scopes
[blacklight, arclight_engine]
end

def render_campus_name(args)
key = args[:value] || []
convert_campus_id(key[0])
end

def render_campus_facet(options = {})
convert_campus_id(options)
end
end

0 comments on commit 098eccf

Please sign in to comment.