Module: Spotlight::MainAppHelpers

Included in:
SpotlightHelper
Defined in:
app/helpers/spotlight/main_app_helpers.rb

Instance Method Summary collapse

Instance Method Details

#cache_key_for_spotlight_exhibitsObject



2
3
4
# File 'app/helpers/spotlight/main_app_helpers.rb', line 2

def cache_key_for_spotlight_exhibits
  Spotlight::Exhibit.maximum(:updated_at).try(:utc).try(:to_s, :number)
end

#enabled_in_spotlight_view_type_configuration?(config) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
21
22
23
24
# File 'app/helpers/spotlight/main_app_helpers.rb', line 18

def enabled_in_spotlight_view_type_configuration? config
  return true unless current_exhibit

  return true if controller.is_a? Spotlight::PagesController

  return current_exhibit.blacklight_configuration.document_index_view_types.include? config.key.to_s
end

#field_enabled?(field, *args) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
# File 'app/helpers/spotlight/main_app_helpers.rb', line 26

def field_enabled? field, *args
  field.enabled && field.send((:show if controller.is_a? Blacklight::Catalog and action_name == "show") || document_index_view_type)
end

#on_about_page?Boolean

Returns:

  • (Boolean)


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

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

#on_browse_page?Boolean

Returns:

  • (Boolean)


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

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

#show_contact_form?Boolean

Returns:

  • (Boolean)


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

def show_contact_form?
  current_exhibit && current_exhibit.contact_emails.confirmed.any?
end