Class: Layered::Ui::ModalHelper::ModalBuilder
- Inherits:
-
Object
- Object
- Layered::Ui::ModalHelper::ModalBuilder
- Defined in:
- app/helpers/layered/ui/modal_helper.rb
Instance Attribute Summary collapse
-
#heading_level ⇒ Object
readonly
Returns the value of attribute heading_level.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#trigger_html ⇒ Object
readonly
Returns the value of attribute trigger_html.
Instance Method Summary collapse
-
#initialize(view, title:, id:, heading_level: :h3) ⇒ ModalBuilder
constructor
A new instance of ModalBuilder.
- #trigger(**options, &block) ⇒ Object
Constructor Details
#initialize(view, title:, id:, heading_level: :h3) ⇒ ModalBuilder
Returns a new instance of ModalBuilder.
57 58 59 60 61 62 |
# File 'app/helpers/layered/ui/modal_helper.rb', line 57 def initialize(view, title:, id:, heading_level: :h3) @view = view @title = title @id = id @heading_level = heading_level end |
Instance Attribute Details
#heading_level ⇒ Object (readonly)
Returns the value of attribute heading_level.
55 56 57 |
# File 'app/helpers/layered/ui/modal_helper.rb', line 55 def heading_level @heading_level end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
55 56 57 |
# File 'app/helpers/layered/ui/modal_helper.rb', line 55 def id @id end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
55 56 57 |
# File 'app/helpers/layered/ui/modal_helper.rb', line 55 def title @title end |
#trigger_html ⇒ Object (readonly)
Returns the value of attribute trigger_html.
55 56 57 |
# File 'app/helpers/layered/ui/modal_helper.rb', line 55 def trigger_html @trigger_html end |
Instance Method Details
#trigger(**options, &block) ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 |
# File 'app/helpers/layered/ui/modal_helper.rb', line 64 def trigger(**, &block) = .deep_dup [:type] ||= "button" data = [:data] || {} existing_action = data.delete(:action) || data.delete("action") data[:action] = [existing_action, "l-ui--modal#open"].compact.reject(&:empty?).join(" ") [:data] = data content = @view.capture(&block) @trigger_html = @view.tag.(content, **) nil end |