Module: Spotlight::Controller
Overview
Spotlight controller helpers
Instance Method Summary
collapse
Methods included from Config
#exhibit_specific_blacklight_config
Instance Method Details
#blacklight_config ⇒ Object
overwrites Blacklight::Controller#blacklight_config
48
49
50
51
52
53
54
|
# File 'app/controllers/concerns/spotlight/controller.rb', line 48
def blacklight_config
if current_exhibit
exhibit_specific_blacklight_config
else
default_catalog_controller.blacklight_config
end
end
|
#current_exhibit ⇒ Object
18
19
20
|
# File 'app/controllers/concerns/spotlight/controller.rb', line 18
def current_exhibit
@exhibit
end
|
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'app/controllers/concerns/spotlight/controller.rb', line 22
def current_masthead
@masthead ||= if resource_masthead?
nil
elsif current_exhibit
current_exhibit.masthead if exhibit_masthead?
elsif current_site.masthead && current_site.masthead.display?
current_site.masthead
end
end
|
35
36
37
|
# File 'app/controllers/concerns/spotlight/controller.rb', line 35
def current_masthead=(masthead)
@masthead = masthead
end
|
#current_site ⇒ Object
14
15
16
|
# File 'app/controllers/concerns/spotlight/controller.rb', line 14
def current_site
@current_site ||= Spotlight::Site.instance
end
|
43
44
45
|
# File 'app/controllers/concerns/spotlight/controller.rb', line 43
def exhibit_masthead?
current_exhibit && current_exhibit.masthead && current_exhibit.masthead.display?
end
|
#exhibit_search_action_url(*args) ⇒ Object
72
73
74
75
76
77
78
79
80
81
82
|
# File 'app/controllers/concerns/spotlight/controller.rb', line 72
def exhibit_search_action_url(*args)
options = args.
only_path = options[:only_path]
options.except! :exhibit_id, :only_path
if only_path
spotlight.search_exhibit_catalog_path(current_exhibit, *args, options)
else
spotlight.search_exhibit_catalog_url(current_exhibit, *args, options)
end
end
|
#exhibit_search_facet_url(*args) ⇒ Object
84
85
86
87
88
|
# File 'app/controllers/concerns/spotlight/controller.rb', line 84
def exhibit_search_facet_url(*args)
options = args.
options = Blacklight::Parameters.sanitize(params.to_unsafe_h.with_indifferent_access).merge(options).except(:exhibit_id, :only_path)
spotlight.facet_exhibit_catalog_url(current_exhibit, *args, options)
end
|
#redirect_back(fallback_location:, **args) ⇒ Object
91
92
93
94
95
96
97
98
99
|
# File 'app/controllers/concerns/spotlight/controller.rb', line 91
def redirect_back(fallback_location:, **args)
if defined?(super)
super
elsif request.['Referer']
redirect_to request.['Referer'], **args
else
redirect_to fallback_location, **args
end
end
|
39
40
41
|
# File 'app/controllers/concerns/spotlight/controller.rb', line 39
def resource_masthead?
false
end
|
#search_action_url(*args) ⇒ Object
56
57
58
59
60
61
62
|
# File 'app/controllers/concerns/spotlight/controller.rb', line 56
def search_action_url(*args)
if current_exhibit
exhibit_search_action_url(*args)
else
main_app.search_catalog_url(*args)
end
end
|
#search_facet_url(*args) ⇒ Object
64
65
66
67
68
69
70
|
# File 'app/controllers/concerns/spotlight/controller.rb', line 64
def search_facet_url(*args)
if current_exhibit
exhibit_search_facet_url(*args)
else
main_app.catalog_facet_url(*args)
end
end
|