Class: ActiveAction::BootstrapDropdown

Inherits:
Renderer
  • Object
show all
Defined in:
lib/active_action/bootstrap_dropdown.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label:, actions:) ⇒ BootstrapDropdown

Returns a new instance of BootstrapDropdown.



8
9
10
11
# File 'lib/active_action/bootstrap_dropdown.rb', line 8

def initialize(label:, actions:)
  @label = label
  @actions = actions
end

Instance Attribute Details

#actionsObject (readonly)

Returns the value of attribute actions.



7
8
9
# File 'lib/active_action/bootstrap_dropdown.rb', line 7

def actions
  @actions
end

#labelObject (readonly)

Returns the value of attribute label.



7
8
9
# File 'lib/active_action/bootstrap_dropdown.rb', line 7

def label
  @label
end

Class Method Details

.to_html(label:, actions:) ⇒ Object



3
4
5
# File 'lib/active_action/bootstrap_dropdown.rb', line 3

def self.to_html(label:, actions:)
  new(label: label, actions: actions).to_html
end

Instance Method Details

#to_htmlObject



13
14
15
16
17
18
19
20
# File 'lib/active_action/bootstrap_dropdown.rb', line 13

def to_html
  capture do
    (:div, class: "dropdown") do
      concat dropdown_tag(label)
      concat dropdown_for(actions)
    end
  end
end