Module: Spotlight::MainAppHelpers
  
  
  
Overview
  
    
Helpers that are injected into the main application (because they used in layouts)
   
 
  
  
    
      Instance Method Summary
      collapse
    
    
  
  
  
  
  
  
  
  
  
  
  #masthead_heading_content, #masthead_subheading_content
  
  
  
  
  
  
  
  
  
  #should_render_spotlight_search_bar?
  
  
  
    Instance Method Details
    
      
  
  
    #current_exhibit_theme  ⇒ Object 
  
  
  
  
    
      
54
55
56 
     | 
    
      # File 'app/helpers/spotlight/main_app_helpers.rb', line 54
def current_exhibit_theme
  current_exhibit.theme if current_exhibit && current_exhibit.theme.present? && current_exhibit.themes.include?(current_exhibit.theme)
end 
     | 
  
 
    
      
  
  
    #document_presenter(document, view_config: nil, **kwargs)  ⇒ Object 
  
  
  
  
  
    
      
33
34
35 
     | 
    
      # File 'app/helpers/spotlight/main_app_helpers.rb', line 33
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 
  
  
  
  
    
      
37
38
39
40
41
42
43 
     | 
    
      # File 'app/helpers/spotlight/main_app_helpers.rb', line 37
def document_presenter_class(_document)
  if action_name == 'index'
    super
  else
    blacklight_config.view_config(action_name: :show).document_presenter_class
  end
end
     | 
  
 
    
      
  
  
    #exhibit_stylesheet_link_tag(tag)  ⇒ Object 
  
  
  
  
    
      
45
46
47
48
49
50
51
52 
     | 
    
      # File 'app/helpers/spotlight/main_app_helpers.rb', line 45
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
     | 
  
 
    
      
  
  
    #link_back_to_catalog(opts = { label: nil })  ⇒ Object 
  
  
  
  
    
      
27
28
29
30 
     | 
    
      # File 'app/helpers/spotlight/main_app_helpers.rb', line 27
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 
  
  
  
  
    
      
19
20
21 
     | 
    
      # File 'app/helpers/spotlight/main_app_helpers.rb', line 19
def on_about_page?
  params[:controller] == 'spotlight/about_pages'
end 
     | 
  
 
    
      
  
  
    #on_browse_page?  ⇒ Boolean 
  
  
  
  
    
      
15
16
17 
     | 
    
      # File 'app/helpers/spotlight/main_app_helpers.rb', line 15
def on_browse_page?
  params[:controller] == 'spotlight/browse'
end 
     | 
  
 
    
      
  
  
    
      
23
24
25 
     | 
    
      # File 'app/helpers/spotlight/main_app_helpers.rb', line 23
def show_contact_form?
  current_exhibit && (Spotlight::Engine.config.default_contact_email || current_exhibit.contact_emails.confirmed.any?)
end 
     |