Skip to content

Commit

Permalink
allow bookmark link to render without extra catalog controller config
Browse files Browse the repository at this point in the history
  • Loading branch information
tampakis committed Aug 9, 2024
1 parent 834231f commit 92216a1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions config/locales/blacklight_ris.en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
en:
blacklight:
tools:
ris: 'Download in RIS format'
4 changes: 2 additions & 2 deletions lib/blacklight/ris/catalog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ module Catalog

included do
# this also causes Blacklight's show endpoint to handle .ris
blacklight_config.add_show_tools_partial(:ris, label: 'Download in RIS format', if: :render_ris_action?, modal: false, path: :ris_path)
blacklight_config.add_show_tools_partial(:ris, label: I18n.t('blacklight.tools.ris'), if: :render_ris_action?, modal: false, path: :ris_path)
end

private

def render_ris_action? config, options = {}
doc = options[:document] || (options[:document_list] || []).first
doc = options[:document] || (@response.documents || []).first
doc && doc.respond_to?(:export_formats) && doc.export_formats.keys.include?(:ris )
end

Expand Down

0 comments on commit 92216a1

Please sign in to comment.