Class: UiBibz::Ui::Core::Notifications::Popover

Inherits:
Component show all
Includes:
UiBibz::Ui::Concerns::NotificationConcern
Defined in:
lib/ui_bibz/ui/core/notifications/popover.rb

Overview

Create a popover

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:

Signatures

UiBibz::Ui::Core::Notifications::Popover.new(content, options = nil, html_options = nil)

UiBibz::Ui::Core::Notifications::Popover.new(options = nil, html_options = nil) do
  content
end

Examples

UiBibz::Ui::Core::Notifications::Popover.new(class: 'my-toast').tap |t|
  t.header "My header toast", glyph: 'eye', time: 'now'
  t.body "My body toast"
end

Helper

popover = UiBibz::Ui::Core::Notifications::Popover.new(position: :left) do
   My content
end
ui_glyph("diamond", popover: popover)

# or

ui_glyph("diamond", {popover: true}, { title: "My content" })

# or

ui_glyph("diamond", popover: { title: "My content", position: :right})

Constant Summary collapse

DATA_ATTRIBUTES =

Note that for security reasons the sanitize, sanitizeFn, and allowList options cannot be supplied using data attributes. getbootstrap.com/docs/5.0/components/popovers/#options

%i[animation container delay html selector
template title trigger offset fallbackPlacement
boundary customClass popperConfig].freeze

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

#pre_render, #tapped?

Methods included from PopoverExtension

#popover_data_html, #tooltip_data_html

Methods included from GlyphExtension

#generate_glyph, #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

#initialize(content = nil, options = nil, html_options = nil, &block) ⇒ Popover

See UiBibz::Ui::Core::Component.initialize



60
61
62
63
# File 'lib/ui_bibz/ui/core/notifications/popover.rb', line 60

def initialize(content = nil, options = nil, html_options = nil, &block)
  super
  @content = @options[:content] if content.is_a?(Hash) && block.nil?
end

Instance Method Details

#renderObject

Render html tag



66
67
68
# File 'lib/ui_bibz/ui/core/notifications/popover.rb', line 66

def render
  base_attributes.merge(data_attributes)
end