Class: Blacklight::Document::ActionsComponent
- Inherits:
-
Component
- Object
- ViewComponent::Base
- Component
- Blacklight::Document::ActionsComponent
- Defined in:
- app/components/blacklight/document/actions_component.rb
Overview
Render a the set of actions for a document. One of the default actions is the bookmark control.
Constant Summary
Constants inherited from Component
Instance Method Summary collapse
-
#before_render ⇒ Object
rubocop:enable Metrics/ParameterLists.
-
#initialize(document: nil, actions: [], options: {}, url_opts: nil, tag: :div, classes: 'index-document-functions', wrapping_tag: nil, wrapping_classes: nil, link_classes: 'nav-link') ⇒ ActionsComponent
constructor
rubocop:disable Metrics/ParameterLists.
- #render? ⇒ Boolean
Methods inherited from Component
Constructor Details
#initialize(document: nil, actions: [], options: {}, url_opts: nil, tag: :div, classes: 'index-document-functions', wrapping_tag: nil, wrapping_classes: nil, link_classes: 'nav-link') ⇒ ActionsComponent
rubocop:disable Metrics/ParameterLists
14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/components/blacklight/document/actions_component.rb', line 14 def initialize(document: nil, actions: [], options: {}, url_opts: nil, tag: :div, classes: 'index-document-functions', wrapping_tag: nil, wrapping_classes: nil, link_classes: 'nav-link') @document = document @actions = actions @tag = tag @classes = classes @options = @url_opts = url_opts @wrapping_tag = wrapping_tag @wrapping_classes = wrapping_classes @link_classes = link_classes end |
Instance Method Details
#before_render ⇒ Object
rubocop:enable Metrics/ParameterLists
27 28 29 30 31 32 33 |
# File 'app/components/blacklight/document/actions_component.rb', line 27 def before_render return if actions.present? @actions.each do |a| with_action(component: a.component, action: a) end end |
#render? ⇒ Boolean
35 36 37 |
# File 'app/components/blacklight/document/actions_component.rb', line 35 def render? actions.present? end |