Module: Spotlight::Controller

Extended by:
ActiveSupport::Concern
Includes:
Blacklight::Controller, Config
Included in:
Spotlight::Concerns::ApplicationController
Defined in:
lib/spotlight/controller.rb

Overview

Spotlight controller helpers

Instance Method Summary collapse

Methods included from Config

#exhibit_specific_blacklight_config

Instance Method Details

#blacklight_configObject

overwrites Blacklight::Controller#blacklight_config



36
37
38
39
40
41
42
# File 'lib/spotlight/controller.rb', line 36

def blacklight_config
  if current_exhibit
    exhibit_specific_blacklight_config
  else
    default_catalog_controller.blacklight_config
  end
end

#current_exhibitObject



13
14
15
# File 'lib/spotlight/controller.rb', line 13

def current_exhibit
  @exhibit
end

#current_mastheadObject



17
18
19
20
21
# File 'lib/spotlight/controller.rb', line 17

def current_masthead
  @masthead ||= begin
    current_exhibit.masthead if current_exhibit && current_exhibit.masthead && current_exhibit.masthead.display?
  end
end

#current_masthead=(masthead) ⇒ Object



23
24
25
# File 'lib/spotlight/controller.rb', line 23

def current_masthead=(masthead)
  @masthead = masthead
end

#default_masthead?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/spotlight/controller.rb', line 27

def default_masthead?
  current_exhibit.nil? || current_masthead.nil?
end

#exhibit_masthead?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/spotlight/controller.rb', line 31

def exhibit_masthead?
  default_masthead? || current_masthead == current_exhibit.masthead
end

#exhibit_search_action_url(*args) ⇒ Object



60
61
62
63
64
65
66
67
68
69
70
# File 'lib/spotlight/controller.rb', line 60

def exhibit_search_action_url(*args)
  options = args.extract_options!
  only_path = options[:only_path]
  options.except! :exhibit_id, :only_path

  if only_path
    spotlight.exhibit_catalog_index_path(current_exhibit, *args, options)
  else
    spotlight.exhibit_catalog_index_url(current_exhibit, *args, options)
  end
end

#exhibit_search_facet_url(*args) ⇒ Object



72
73
74
75
76
77
78
79
80
81
82
# File 'lib/spotlight/controller.rb', line 72

def exhibit_search_facet_url(*args)
  options = args.extract_options!
  only_path = options[:only_path]
  options = params.merge(options).except(:exhibit_id, :only_path)

  if only_path
    spotlight.exhibit_catalog_facet_url(current_exhibit, *args, options)
  else
    spotlight.exhibit_catalog_facet_url(current_exhibit, *args, options)
  end
end

#search_action_url(*args) ⇒ Object



44
45
46
47
48
49
50
# File 'lib/spotlight/controller.rb', line 44

def search_action_url(*args)
  if current_exhibit
    exhibit_search_action_url(*args)
  else
    main_app.catalog_index_url(*args)
  end
end

#search_facet_url(*args) ⇒ Object



52
53
54
55
56
57
58
# File 'lib/spotlight/controller.rb', line 52

def search_facet_url(*args)
  if current_exhibit
    exhibit_search_facet_url(*args)
  else
    main_app.catalog_facet_url(*args)
  end
end