Class: Blacklight::Document::ActionsComponent

Inherits:
Component
  • Object
show all
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

Component::EXCLUDE_VARIABLES

Instance Method Summary collapse

Methods inherited from Component

compiler, config, #inspect

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

Parameters:



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 = options
  @url_opts = url_opts
  @wrapping_tag = wrapping_tag
  @wrapping_classes = wrapping_classes
  @link_classes = link_classes
end

Instance Method Details

#before_renderObject

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

Returns:

  • (Boolean)


35
36
37
# File 'app/components/blacklight/document/actions_component.rb', line 35

def render?
  actions.present?
end