Class: Blacklight::Document::PageHeaderComponent
- Inherits:
-
Component
- Object
- ViewComponent::Base
- Component
- Blacklight::Document::PageHeaderComponent
show all
- Defined in:
- app/components/blacklight/document/page_header_component.rb
Overview
Render the start over and prev/next displays
Constant Summary
Constants inherited
from Component
Component::EXCLUDE_VARIABLES
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Component
compiler, config, #inspect
Constructor Details
#initialize(document:, search_context:, search_session:) ⇒ PageHeaderComponent
Returns a new instance of PageHeaderComponent.
11
12
13
14
15
16
|
# File 'app/components/blacklight/document/page_header_component.rb', line 11
def initialize(document:, search_context:, search_session:)
super
@search_context = search_context
@search_session = search_session
@document = document
end
|
Instance Attribute Details
#blacklight_config ⇒ Object
Returns the value of attribute blacklight_config.
7
8
9
|
# File 'app/components/blacklight/document/page_header_component.rb', line 7
def blacklight_config
@blacklight_config
end
|
#document ⇒ Object
Returns the value of attribute document.
7
8
9
|
# File 'app/components/blacklight/document/page_header_component.rb', line 7
def document
@document
end
|
#search_context ⇒ Object
Returns the value of attribute search_context.
7
8
9
|
# File 'app/components/blacklight/document/page_header_component.rb', line 7
def search_context
@search_context
end
|
#search_session ⇒ Object
Returns the value of attribute search_session.
7
8
9
|
# File 'app/components/blacklight/document/page_header_component.rb', line 7
def search_session
@search_session
end
|
Instance Method Details
#action_component_tag ⇒ Object
64
65
66
|
# File 'app/components/blacklight/document/page_header_component.rb', line 64
def action_component_tag
'div'
end
|
#applied_params_component ⇒ Object
22
23
24
25
26
|
# File 'app/components/blacklight/document/page_header_component.rb', line 22
def applied_params_component
return unless blacklight_config.track_search_session.applied_params_component
blacklight_config.track_search_session.applied_params_component.new
end
|
#classes ⇒ Object
68
69
70
|
# File 'app/components/blacklight/document/page_header_component.rb', line 68
def classes
'd-inline-flex header-tools align-items-center col-12 col-md-6 ms-auto justify-content-md-end'
end
|
#default_action_component_render ⇒ Object
55
56
57
58
59
60
61
62
|
# File 'app/components/blacklight/document/page_header_component.rb', line 55
def default_action_component_render
render Blacklight::Document::ActionsComponent.new(document: document,
tag: action_component_tag,
classes: classes,
link_classes: link_classes,
actions: ,
url_opts: Blacklight::Parameters.sanitize(params.to_unsafe_h))
end
|
34
35
36
|
# File 'app/components/blacklight/document/page_header_component.rb', line 34
def
.any? ||
end
|
46
47
48
49
|
# File 'app/components/blacklight/document/page_header_component.rb', line 46
def
actions = helpers.filter_partials(blacklight_config.view_config(:show)., { document: document })
actions.map { |_k, v| v }
end
|
42
43
44
|
# File 'app/components/blacklight/document/page_header_component.rb', line 42
def
? 'row pagination-search-widgets pb-2' : 'pagination-search-widgets'
end
|
#link_classes ⇒ Object
72
73
74
|
# File 'app/components/blacklight/document/page_header_component.rb', line 72
def link_classes
'btn btn-outline-primary ms-2'
end
|
28
29
30
31
32
|
# File 'app/components/blacklight/document/page_header_component.rb', line 28
def
return unless blacklight_config.track_search_session.
blacklight_config.track_search_session..new(search_context: search_context, search_session: search_session, current_document: document)
end
|
38
39
40
|
# File 'app/components/blacklight/document/page_header_component.rb', line 38
def
? 'col-12 col-md-6 ms-auto' : ''
end
|
#render? ⇒ Boolean
18
19
20
|
# File 'app/components/blacklight/document/page_header_component.rb', line 18
def render?
search_context.present? || search_session.present? ||
end
|
76
77
78
79
80
81
82
|
# File 'app/components/blacklight/document/page_header_component.rb', line 76
def
return unless
return render .new(document: document) if
default_action_component_render
end
|
51
52
53
|
# File 'app/components/blacklight/document/page_header_component.rb', line 51
def
blacklight_config.view_config(:show).
end
|