Module: UltimateStaticModal::Helpers::ViewHelper
- Defined in:
- lib/ultimate_static_modal/helpers/view_helper.rb
Instance Method Summary collapse
- #static_drawer(position: nil, size: nil, **options, &block) ⇒ Object
- #static_drawer_template(id, **opts, &block) ⇒ Object
- #static_modal(**opts, &block) ⇒ Object
- #static_modal_template(id, **opts, &block) ⇒ Object
- #static_modal_trigger(template_id, **button_opts, &block) ⇒ Object
Instance Method Details
#static_drawer(position: nil, size: nil, **options, &block) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/ultimate_static_modal/helpers/view_helper.rb', line 10 def static_drawer(position: nil, size: nil, **, &block) cfg = UltimateTurboModal.configuration.drawer_config position = UltimateTurboModal::Base.validate_drawer_position!(position || cfg.position) size = UltimateTurboModal::Base.validate_drawer_size!(size || cfg.size) static_modal(drawer_position: position, size: size, **, &block) end |
#static_drawer_template(id, **opts, &block) ⇒ Object
21 22 23 |
# File 'lib/ultimate_static_modal/helpers/view_helper.rb', line 21 def static_drawer_template(id, **opts, &block) content_tag(:template, id: id) { static_drawer(**opts, &block) } end |
#static_modal(**opts, &block) ⇒ Object
6 7 8 |
# File 'lib/ultimate_static_modal/helpers/view_helper.rb', line 6 def static_modal(**opts, &block) render(UltimateStaticModal.new(**opts), &block) end |
#static_modal_template(id, **opts, &block) ⇒ Object
17 18 19 |
# File 'lib/ultimate_static_modal/helpers/view_helper.rb', line 17 def static_modal_template(id, **opts, &block) content_tag(:template, id: id) { static_modal(**opts, &block) } end |
#static_modal_trigger(template_id, **button_opts, &block) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/ultimate_static_modal/helpers/view_helper.rb', line 25 def static_modal_trigger(template_id, **, &block) data = .delete(:data) || {} data = data.merge( controller: [data[:controller], "static-modal"].compact.join(" "), static_modal_id_value: template_id, action: [data[:action], "click->static-modal#open"].compact.join(" ") ) = {type: "button"}.merge().merge(data: data) (, &block) end |