Class: Matestack::Ui::Bootstrap::Components::Button

Inherits:
Component
  • Object
show all
Defined in:
app/concepts/matestack/ui/bootstrap/components/button.rb

Instance Method Summary collapse

Instance Method Details

#button_responseObject



32
33
34
35
36
# File 'app/concepts/matestack/ui/bootstrap/components/button.rb', line 32

def button_response
  button button_attributes do
    inner_response
  end
end

#inner_responseObject



38
39
40
41
# File 'app/concepts/matestack/ui/bootstrap/components/button.rb', line 38

def inner_response
  plain text if text
  yield_components
end

#responseObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/concepts/matestack/ui/bootstrap/components/button.rb', line 10

def response
  if bs_btn_transition.present? && bs_btn_transition.is_a?(Hash)
    transition button_attributes.merge(bs_btn_transition.merge({attributes: { role: "button"} })) do
      inner_response
    end
  elsif bs_btn_action.present? && bs_btn_action.is_a?(Hash)
    action button_attributes.merge(bs_btn_action.merge({attributes: { role: "button"} })) do
      inner_response
    end
  elsif bs_btn_onclick.present? && bs_btn_onclick.is_a?(Hash)
    onclick button_attributes.merge(bs_btn_onclick.merge({attributes: { role: "button"} })) do
      inner_response
    end
  elsif bs_btn_link.present? && bs_btn_link.is_a?(Hash)
    link button_attributes.merge(bs_btn_link.merge({attributes: { role: "button"} })) do
      inner_response
    end
  else
    button_response
  end
end