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

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


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

Returns:

  • (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

Returns:

  • (Boolean)


12
13
14
# File 'app/helpers/spotlight/main_app_helpers.rb', line 12

def on_browse_page?
  params[:controller] == 'spotlight/browse'
end

#show_contact_form?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'app/helpers/spotlight/main_app_helpers.rb', line 20

def show_contact_form?
  current_exhibit && (Spotlight::Engine.config.default_contact_email || current_exhibit.contact_emails.confirmed.any?)
end