Class: Spotlight::BulkActionComponent

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/spotlight/bulk_action_component.rb

Overview

Displays the “Bulk actions” button and dropdown

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bulk_actions:, button_classes: 'btn btn-secondary dropdown-toggle') ⇒ BulkActionComponent

Returns a new instance of BulkActionComponent.



6
7
8
9
10
# File 'app/components/spotlight/bulk_action_component.rb', line 6

def initialize(bulk_actions:, button_classes: 'btn btn-secondary dropdown-toggle')
  @bulk_actions = bulk_actions
  @button_classes = button_classes
  super
end

Instance Attribute Details

#bulk_actionsObject (readonly)

Returns the value of attribute bulk_actions.



12
13
14
# File 'app/components/spotlight/bulk_action_component.rb', line 12

def bulk_actions
  @bulk_actions
end

#button_classesObject (readonly)

Returns the value of attribute button_classes.



12
13
14
# File 'app/components/spotlight/bulk_action_component.rb', line 12

def button_classes
  @button_classes
end

Instance Method Details

#buttonObject



14
15
16
17
18
# File 'app/components/spotlight/bulk_action_component.rb', line 14

def button
  button_tag t(:'spotlight.bulk_actions.label'), id: 'bulk-actions-button', class: button_classes,
                                                 data: { toggle: 'dropdown', 'bs-toggle': 'dropdown' },
                                                 aria: { haspopup: true, expanded: false }
end