Module: Spotlight::MainAppHelpers
- Includes:
- Blacklight::DocumentHelperBehavior, ExhibitThemeHelper, MastheadHelper, NavbarHelper
- Included in:
- SpotlightHelper
- Defined in:
- app/helpers/spotlight/main_app_helpers.rb
Overview
Helpers that are injected into the main application (because they used in layouts)
Instance Method Summary collapse
-
#document_presenter(document, view_config: nil, **kwargs) ⇒ Object
Expecting to upstream this override in github.com/projectblacklight/blacklight/pull/3343/files.
- #document_presenter_class(_document) ⇒ Object
- #link_back_to_catalog(opts = { label: nil }) ⇒ Object
- #on_about_page? ⇒ Boolean
- #on_browse_page? ⇒ Boolean
- #show_contact_form? ⇒ Boolean
Methods included from MastheadHelper
#masthead_heading_content, #masthead_subheading_content
Methods included from NavbarHelper
#should_render_spotlight_search_bar?
Methods included from ExhibitThemeHelper
#current_exhibit_theme, #exhibit_stylesheet_link_tag
Instance Method Details
#document_presenter(document, view_config: nil, **kwargs) ⇒ Object
Expecting to upstream this override in github.com/projectblacklight/blacklight/pull/3343/files
30 31 32 |
# File 'app/helpers/spotlight/main_app_helpers.rb', line 30 def document_presenter(document, view_config: nil, **kwargs) (view_config&.document_presenter_class || document_presenter_class(document)).new(document, self, view_config:, **kwargs) end |
#document_presenter_class(_document) ⇒ Object
34 35 36 37 38 39 40 |
# File 'app/helpers/spotlight/main_app_helpers.rb', line 34 def document_presenter_class(_document) if action_name == 'index' super else blacklight_config.view_config(action_name: :show).document_presenter_class end end |
#link_back_to_catalog(opts = { label: nil }) ⇒ Object
24 25 26 27 |
# File 'app/helpers/spotlight/main_app_helpers.rb', line 24 def link_back_to_catalog(opts = { label: nil }) opts[:route_set] ||= spotlight if (current_search_session&.query_params || {}).fetch(:controller, '').starts_with? 'spotlight' super end |
#on_about_page? ⇒ Boolean
16 17 18 |
# File 'app/helpers/spotlight/main_app_helpers.rb', line 16 def on_about_page? params[:controller] == 'spotlight/about_pages' end |
#on_browse_page? ⇒ Boolean
12 13 14 |
# File 'app/helpers/spotlight/main_app_helpers.rb', line 12 def on_browse_page? params[:controller] == 'spotlight/browse' end |