class UiBibz::Ui::Core::Notifications::Components::ToastHeader
Create a alert body
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::ToastHeader.new(content, options = nil, html_options = nil) UiBibz::Ui::Core::Notifications::ToastHeader.new(options = nil, html_options = nil) do content end
Examples¶ ↑
UiBibz::Ui::Core::Notifications::ToastHeader.new.render UiBibz::Ui::Core::Notifications::ToastHeader.new do 'Exemple' end.render
Public Instance Methods
pre_render()
click to toggle source
See UiBibz::Ui::Core::Component.initialize
# File lib/ui_bibz/ui/core/notifications/components/toast_header.rb, line 37 def pre_render content_tag :div, html_options do concat UiBibz::Ui::Core::Icons::Glyph.new(options[:glyph], class: 'me-2').render unless options[:glyph].nil? concat image unless options[:image].nil? concat content_tag(:strong, content, class: 'me-auto') concat content_tag(:small, options[:time], class: 'text-muted') unless options[:time].nil? concat close_button end end
Private Instance Methods
component_html_classes()
click to toggle source
# File lib/ui_bibz/ui/core/notifications/components/toast_header.rb, line 66 def component_html_classes 'toast-header' end
image()
click to toggle source
# File lib/ui_bibz/ui/core/notifications/components/toast_header.rb, line 49 def image if options[:image].is_a?(String) image_tag(options[:image], class: 'rounded me-2', alt: sanitize_text(options[:image])) unless options[:image].nil? else options[:image][:class] = UiBibz::Utils::Screwdriver.join_classes(options[:image][:class], 'rounded me-2') if options[:image].delete(:pack) image_pack_tag(options[:image].delete(:href), **options[:image]) else image_tag(options[:image].delete(:href), **options[:image]) end end end