Module: Spotlight::MainAppHelpers

Includes:
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?

Instance Method Details

#current_exhibit_themeObject



44
45
46
# File 'app/helpers/spotlight/main_app_helpers.rb', line 44

def current_exhibit_theme
  current_exhibit.theme if current_exhibit && current_exhibit.theme.present? && current_exhibit.themes.include?(current_exhibit.theme)
end

#document_presenter_class(_document) ⇒ Object



27
28
29
30
31
32
33
# File 'app/helpers/spotlight/main_app_helpers.rb', line 27

def document_presenter_class(_document)
  if action_name == 'index'
    super
  else
    blacklight_config.view_config(action_name: :show).document_presenter_class
  end
end


35
36
37
38
39
40
41
42
# File 'app/helpers/spotlight/main_app_helpers.rb', line 35

def exhibit_stylesheet_link_tag(tag)
  if current_exhibit_theme && current_exhibit&.theme != 'default'
    stylesheet_link_tag "#{tag}_#{current_exhibit_theme}"
  else
    Rails.logger.warn "Exhibit theme '#{current_exhibit_theme}' not in the list of available themes: #{current_exhibit&.themes}"
    stylesheet_link_tag(tag)
  end
end


22
23
24
25
# File 'app/helpers/spotlight/main_app_helpers.rb', line 22

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)


14
15
16
# File 'app/helpers/spotlight/main_app_helpers.rb', line 14

def on_about_page?
  params[:controller] == 'spotlight/about_pages'
end

#on_browse_page?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'app/helpers/spotlight/main_app_helpers.rb', line 10

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

#show_contact_form?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'app/helpers/spotlight/main_app_helpers.rb', line 18

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