Class: PhlexyUI::Button
- Defined in:
- lib/phlexy_ui/button.rb
Instance Method Summary collapse
-
#initialize(as: :button, modal: nil) ⇒ Button
constructor
A new instance of Button.
- #view_template ⇒ Object
Constructor Details
#initialize(as: :button, modal: nil) ⇒ Button
Returns a new instance of Button.
7 8 9 10 11 |
# File 'lib/phlexy_ui/button.rb', line 7 def initialize(*, as: :button, modal: nil, **) super(*, **) @as = as @modal = modal end |
Instance Method Details
#view_template ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/phlexy_ui/button.rb', line 13 def view_template(&) generate_classes!( component_html_class: :btn, modifiers_map: modifiers, base_modifiers:, options: ).then do |classes| if modal public_send( as, class: classes, onclick: safe("#{Phlex::Escape.html_escape(modal)}.showModal()"), **, & ) else public_send(as, class: classes, **, &) end end end |