Class: UiBibz::Ui::Core::Windows::Modal

Inherits:
Component show all
Defined in:
lib/ui_bibz/ui/core/windows/modal.rb

Overview

Create an modal

This element is an extend of UiBibz::Ui::Core::Component.

Attributes

  • content - Content of element

  • options - Options of element

  • html_options - Html Options of element

Options

You can add HTML attributes using the html_options. You can pass arguments in options attribute:

  • size (:xl:,:lg+, :md, :sm)

  • fullscreen - Boolean

  • backdrop - Symbol (:static)

  • scrollable - Boolean

  • position - Symbol (:centered)

Signatures

UiBibz::Ui::Core::Modal.new(options = nil, html_options = nil) do  |m|
  m.header content, options, html_options, &block
  m.body content, options, html_options, &block
  m.footer content, options, html_options, &block
end

Examples

UiBibz::Ui::Core::Modal.new({glyph: { name: 'eye', size: 3}, { class: 'test' }) do |m|
  m.header 'Title'
  m.body 'Content'
  m.footer do
    button_link 'Ok', '#', class: :success
  end
end.render

Helper

modal(options = {}, html_options = {}) do |m|
  m.header do
    'Title'
  end
  m.body do
    'Content'
  end
  m.footer do
    'Footer'
  end
end

Constant Summary

Constants inherited from Component

Component::BREAKPOINTS, Component::SIZES, Component::STATUSES

Instance Attribute Summary

Attributes inherited from Component

#content, #html_options, #options

Attributes inherited from Base

#output_buffer

Instance Method Summary collapse

Methods inherited from Component

#initialize, #render

Methods included from GlyphExtension

#glyph_and_content_html

Methods included from KlassExtension

#exclude_classes, #exclude_classes_in_html_options, #join_classes, #status

Methods inherited from Base

#generate_id, #i18n_set?, #inject_url

Constructor Details

This class inherits a constructor from UiBibz::Ui::Core::Component

Instance Method Details

#body(content = nil, options = nil, html_options = nil) ⇒ Object



84
85
86
# File 'lib/ui_bibz/ui/core/windows/modal.rb', line 84

def body(content = nil, options = nil, html_options = nil, &)
  @body = UiBibz::Ui::Core::Windows::Components::ModalBody.new(content, options, html_options, &)
end


80
81
82
# File 'lib/ui_bibz/ui/core/windows/modal.rb', line 80

def footer(content = nil, options = nil, html_options = nil, &)
  @footer = UiBibz::Ui::Core::Windows::Components::ModalFooter.new(content, options, html_options, &)
end

#header(content = nil, options = nil, html_options = nil) ⇒ Object



76
77
78
# File 'lib/ui_bibz/ui/core/windows/modal.rb', line 76

def header(content = nil, options = nil, html_options = nil, &)
  @header = UiBibz::Ui::Core::Windows::Components::ModalHeader.new(content, options, html_options, &)
end

#pre_renderObject

Render html tag



64
65
66
67
68
69
70
71
72
73
74
# File 'lib/ui_bibz/ui/core/windows/modal.rb', line 64

def pre_render
   :div, modal_html_options do
     :div, class: modal_dialog_classes do
       :div, class: 'modal-content' do
        concat @header&.render
        concat @body&.render
        concat @footer&.render
      end
    end
  end
end