Class: Practical::Views::OpenDrawerButtonComponent
- Inherits:
-
ButtonComponent
- Object
- ViewComponent::Base
- BaseComponent
- ButtonComponent
- Practical::Views::OpenDrawerButtonComponent
- Defined in:
- app/components/practical/views/open_drawer_button_component.rb
Instance Attribute Summary collapse
-
#drawer_id ⇒ Object
Returns the value of attribute drawer_id.
Attributes inherited from ButtonComponent
#appearance, #color_variant, #options, #size, #type
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(drawer_id:, appearance: nil, color_variant: nil, size: nil, options: {}) ⇒ OpenDrawerButtonComponent
constructor
A new instance of OpenDrawerButtonComponent.
Methods inherited from ButtonComponent
Methods included from ElementHelper
Constructor Details
#initialize(drawer_id:, appearance: nil, color_variant: nil, size: nil, options: {}) ⇒ OpenDrawerButtonComponent
Returns a new instance of OpenDrawerButtonComponent.
6 7 8 9 10 11 |
# File 'app/components/practical/views/open_drawer_button_component.rb', line 6 def initialize(drawer_id:, appearance: nil, color_variant: nil, size: nil, options: {}) = .with_defaults( onclick: self.class.inline_js_to_open_dialog(drawer_id: drawer_id) ) super(type: :button, appearance: appearance, color_variant: color_variant, size: size, options: ) end |
Instance Attribute Details
#drawer_id ⇒ Object
Returns the value of attribute drawer_id.
4 5 6 |
# File 'app/components/practical/views/open_drawer_button_component.rb', line 4 def drawer_id @drawer_id end |
Class Method Details
.inline_js_to_open_dialog(drawer_id:) ⇒ Object
13 14 15 |
# File 'app/components/practical/views/open_drawer_button_component.rb', line 13 def self.inline_js_to_open_dialog(drawer_id:) return "document.getElementById(`#{drawer_id}`).open = true" end |