Skip to content
This repository has been archived by the owner on Oct 31, 2020. It is now read-only.

Commit

Permalink
Do some stuff that resolves #4
Browse files Browse the repository at this point in the history
  • Loading branch information
jkeck committed Oct 16, 2017
1 parent baf0f60 commit 984b5fd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ class CatalogController < ApplicationController
config.add_index_field 'title_vern_display', label: 'Title'
config.add_index_field 'author_display', label: 'Author'
config.add_index_field 'author_vern_display', label: 'Author'
config.add_index_field 'combine_author_field_whatever_we_want', label: 'Accessor Author', accessor: :display_combined_author
config.add_index_field 'linked_author_field', label: 'Helper Author', helper_method: :helper_method_demo, field: :author_display
config.add_index_field 'format', label: 'Format'
config.add_index_field 'language_facet', label: 'Language'
config.add_index_field 'published_display', label: 'Published'
Expand Down
4 changes: 3 additions & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
module ApplicationHelper

def helper_method_demo(document:,field:,value:,config:)
"#{document.first(:author_vern_display)} (#{link_to document.first(:author_display), search_action_url(q: document.first(:author_display), search_field: :author)})".html_safe
end
end
4 changes: 4 additions & 0 deletions app/models/solr_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@ class SolrDocument
# and Blacklight::Document::SemanticFields#to_semantic_values
# Recommendation: Use field names from Dublin Core
use_extension(Blacklight::Document::DublinCore)

def display_combined_author
"#{first(:author_vern_display)} (#{first(:author_display)})"
end
end

0 comments on commit 984b5fd

Please sign in to comment.