Class: ElementComponent::Components::ModalDialog
- Defined in:
- lib/element_component/components/modal/dialog.rb
Constant Summary collapse
- VALID_SIZES =
%i[sm lg xl].freeze
- VALID_FULLSCREEN =
%i[always sm md lg xl xxl].freeze
Instance Attribute Summary
Attributes inherited from Element
#attributes, #contents, #element, #html
Instance Method Summary collapse
-
#initialize(scrollable: false, centered: false, size: nil, fullscreen: nil, **attributes, &block) ⇒ ModalDialog
constructor
A new instance of ModalDialog.
Methods inherited from Element
#add_attribute, #add_attribute!, #add_content, #add_content!, #new_element, #remove_attribute, #remove_attribute_value, #render, #reset_attributes!, #reset_contents!
Constructor Details
#initialize(scrollable: false, centered: false, size: nil, fullscreen: nil, **attributes, &block) ⇒ ModalDialog
Returns a new instance of ModalDialog.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/element_component/components/modal/dialog.rb', line 9 def initialize(scrollable: false, centered: false, size: nil, fullscreen: nil, **attributes, &block) super("div", &block) add_attribute(class: "modal-dialog") add_attribute(class: "modal-dialog-scrollable") if scrollable add_attribute(class: "modal-dialog-centered") if centered add_attribute(class: "modal-#{size}") if size add_attribute(class: "modal-fullscreen#{"-#{fullscreen}-down" unless fullscreen == :always}") if fullscreen add_attribute(attributes) unless attributes.empty? end |