Class: Arara::DialogComponent
- Inherits:
-
ActionView::Component::Base
- Object
- ActionView::Component::Base
- Arara::DialogComponent
- Includes:
- BaseComponent
- Defined in:
- app/components/arara/dialog_component.rb
Instance Attribute Summary collapse
-
#describedby ⇒ Object
readonly
Returns the value of attribute describedby.
-
#labelledby ⇒ Object
readonly
Returns the value of attribute labelledby.
-
#role ⇒ Object
readonly
Returns the value of attribute role.
-
#surface_class ⇒ Object
readonly
Returns the value of attribute surface_class.
Instance Method Summary collapse
- #default_html_class ⇒ Object
-
#initialize(role: "alertdialog", labelledby:, describedby:, surface_class: nil, **kw) ⇒ DialogComponent
constructor
A new instance of DialogComponent.
- #surface_options ⇒ Object
Methods included from BaseComponent
#default_data_controller, #default_html_tag, #html_class, #html_content, #html_data, #html_options, #html_tag, included
Constructor Details
#initialize(role: "alertdialog", labelledby:, describedby:, surface_class: nil, **kw) ⇒ DialogComponent
Returns a new instance of DialogComponent.
9 10 11 12 13 14 15 16 |
# File 'app/components/arara/dialog_component.rb', line 9 def initialize(role: "alertdialog", labelledby:, describedby:, surface_class: nil, **kw) super(tag: "div", role: role, **kw) @role = role @labelledby = labelledby @describedby = describedby @surface_class = surface_class end |
Instance Attribute Details
#describedby ⇒ Object (readonly)
Returns the value of attribute describedby.
7 8 9 |
# File 'app/components/arara/dialog_component.rb', line 7 def describedby @describedby end |
#labelledby ⇒ Object (readonly)
Returns the value of attribute labelledby.
7 8 9 |
# File 'app/components/arara/dialog_component.rb', line 7 def labelledby @labelledby end |
#role ⇒ Object (readonly)
Returns the value of attribute role.
7 8 9 |
# File 'app/components/arara/dialog_component.rb', line 7 def role @role end |
#surface_class ⇒ Object (readonly)
Returns the value of attribute surface_class.
7 8 9 |
# File 'app/components/arara/dialog_component.rb', line 7 def surface_class @surface_class end |
Instance Method Details
#default_html_class ⇒ Object
19 20 21 |
# File 'app/components/arara/dialog_component.rb', line 19 def default_html_class "mdc-dialog" end |
#surface_options ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/components/arara/dialog_component.rb', line 23 def html_class = ["mdc-dialog__surface"] html_class << surface_class if surface_class { class: html_class.join(" "), role: role, aria: { modal: "true", labelledby: labelledby, describedby: describedby } } end |