Skip to content
This repository has been archived by the owner on May 7, 2022. It is now read-only.

Commit

Permalink
Merge pull request #22 from harvard-library/dsi-development
Browse files Browse the repository at this point in the history
Card #50 - modify Language facet value
  • Loading branch information
phil-plencner-hl authored Apr 13, 2020
2 parents 673452c + 70169d0 commit 8c3ddf2
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
4 changes: 2 additions & 2 deletions app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ class CatalogController < ApplicationController

# Facets
config.add_facet_field 'originDate', label: 'Date Range', range: true, maxlength: 4
config.add_facet_field 'resourceType', label: 'Type', single: true, limit: 10, :helper_method => 'get_resource_type_translation'
config.add_facet_field 'language', label: 'Languages', single: true, limit: 10
config.add_facet_field 'resourceType', label: 'Type', single: true, limit: 10, :helper_method => 'get_facet_value_translation_for_type'
config.add_facet_field 'language', label: 'Languages', single: true, limit: 10, :helper_method => 'get_facet_value_translation_for_languages'
config.add_facet_field 'repository', label: 'Repository', single: true, limit: 10


Expand Down
19 changes: 13 additions & 6 deletions app/helpers/blacklight/facets_helper_behavior.rb
Original file line number Diff line number Diff line change
Expand Up @@ -244,14 +244,21 @@ def facet_display_value field, item
end
end

def get_facet_value_translation_for_languages *args
get_facet_value_translation "languages", args[0]
end

def get_facet_value_translation_for_type *args
get_facet_value_translation "type", args[0]
end

def get_resource_type_translation *args
puts args.inspect
translation_label = args[0].to_s().gsub(' ', '_').gsub(',', '_').gsub('-', '_').gsub('/', '_').gsub('__', '_')
puts translation_label
translation = t('blacklight.search.facets.values.' + translation_label)
def get_facet_value_translation field_name, field_label
translation_label = field_label.to_s().downcase().gsub(/[ ,;\-\/]/, '_').gsub(/__/, '_')
#puts translation_label
translation = t('blacklight.search.facets.facet_values_' + field_name + '.' + translation_label, :default => '')

if translation == ''
translation = args[0]
translation = field_label
end
translation
end
Expand Down
6 changes: 5 additions & 1 deletion config/locales/blacklight.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,19 @@ en:
facets:
title: 'Limit Your Search'
more_html: 'More <span class="sr-only">%{field_name}</span> <span class="fa fa-angle-right"></span>'
values:
facet_values_type:
cartographic: 'Maps'
mixed_material: 'Archival material'
moving_image: 'Video'
notated_music: 'Notated music'
software_multimedia: 'Multimedia'
sound_recording_musical: 'Audio - music'
sound_recording_nonmusical: 'Audio - non-music'
still_image: 'Image'
text: 'Text'
three_dimensional_object: '3D Object'
facet_values_languages:
no_linguistic_content_not_applicable: 'No language provided'
filters:
search_term: 'Search term'
pagination_info:
Expand Down
1 change: 1 addition & 0 deletions release.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
6.20.0-lts-4 PP/MC/ED
-- Modified Language facet value to "No language provided"
-- Updated placeholder and masonry icons
-- Truncate Subjects metadata after 3 lines
-- Item thumbnails focus indicator on hover (Accessibility)
Expand Down

0 comments on commit 8c3ddf2

Please sign in to comment.