Module: ModalStack::Helpers::ModalStackContainerHelper

Defined in:
lib/modal_stack/helpers/modal_stack_container_helper.rb

Overview

Wraps the layout content in the panel structure expected by the JS runtime. The layout ‘modal.html.erb` typically reads:

<%= modal_stack_container size: :md, dismissible: true do %>
  <%= yield %>
<% end %>

Constant Summary collapse

DEFAULT_SIZE =
:md

Instance Method Summary collapse

Instance Method Details



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/modal_stack/helpers/modal_stack_container_helper.rb', line 15

def modal_stack_container(size: DEFAULT_SIZE, dismissible: true, variant: :modal, side: nil, width: nil, height: nil,
                          back: false, transition: nil, html: {}, &)
  attrs = build_panel_attrs(size: size, variant: variant, side: side,
                            dismissible: dismissible, width: width,
                            height: height, transition: transition, html: html)
  body = capture(&)
  back_html = back ? modal_stack_container_back_button : nil

  render partial: "modal_stack/panel", locals: {
    content: body, back_button: back_html, wrapper_attrs: attrs,
    size: size, variant: variant, dismissible: dismissible,
    side: side, width: width, height: height, transition: transition
  }
end