Module: Spotlight::Controller

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

Instance Method Summary collapse

Methods included from Config

#exhibit_specific_blacklight_config

Instance Method Details

#blacklight_configObject

overwrites Blacklight::Controller#blacklight_config



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

def blacklight_config
  if current_exhibit
    exhibit_specific_blacklight_config
  else
    default_catalog_controller.blacklight_config
  end
end

#current_exhibitObject



11
12
13
# File 'lib/spotlight/controller.rb', line 11

def current_exhibit
  @exhibit
end

#current_mastheadObject



15
16
17
18
19
# File 'lib/spotlight/controller.rb', line 15

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

#current_masthead=(masthead) ⇒ Object



21
22
23
# File 'lib/spotlight/controller.rb', line 21

def current_masthead= masthead
  @masthead = masthead
end

#default_masthead?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/spotlight/controller.rb', line 25

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

#exhibit_masthead?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/spotlight/controller.rb', line 29

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

#exhibit_search_action_url(*args) ⇒ Object



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

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



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

def exhibit_search_facet_url *args
  options = args.extract_options!
  only_path = options[:only_path]
  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



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

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



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

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