Module: Spotlight::MainAppHelpers

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

#should_render_spotlight_search_bar?

Instance Method Details

#cache_key_for_spotlight_exhibitsObject



6
7
8
# File 'app/helpers/spotlight/main_app_helpers.rb', line 6

def cache_key_for_spotlight_exhibits
  "#{Spotlight::Exhibit.count}/#{Spotlight::Exhibit.maximum(:updated_at).try(:utc)}"
end


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

def link_back_to_catalog(opts = { label: nil })
  if (current_search_session.try(:query_params) || {}).fetch(:controller, '').starts_with? 'spotlight'
    opts[:route_set] ||= spotlight
  end
  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

#presenter(document) ⇒ Object



29
30
31
32
33
34
35
36
# File 'app/helpers/spotlight/main_app_helpers.rb', line 29

def presenter(document)
  case action_name
  when 'index'
    super
  else
    show_presenter(document)
  end
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