Module: GlyphExtension
- Included in:
- UiBibz::Ui::Core::Component
- Defined in:
- lib/ui_bibz/ui/extensions/core/component/glyph_extension.rb
Instance Method Summary collapse
-
#generate_glyph(content_html) ⇒ Object
Render glyph html.
-
#glyph_and_content_html(content_html = nil) ⇒ Object
Render glyph and content html.
Instance Method Details
#generate_glyph(content_html) ⇒ Object
Render glyph html
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/ui_bibz/ui/extensions/core/component/glyph_extension.rb', line 10 def generate_glyph(content_html) = if [:glyph].is_a?(Hash) [:glyph] elsif [:glyph] { name: [:glyph] } else {} end = .tap do |h| h[:text] = [:text] h[:label] = [:label] || content_html || content h[:shortcut] = [:shortcut] unless [:shortcut].nil? end # UiBibz::Utils::GlyphChanger.new(glyph_options[:name], glyph_options).render unless glyph_options[:name].nil? UiBibz::Ui::Core::Icons::Glyph.new([:name], ).render if [:name].present? end |
#glyph_and_content_html(content_html = nil) ⇒ Object
Render glyph and content html
5 6 7 |
# File 'lib/ui_bibz/ui/extensions/core/component/glyph_extension.rb', line 5 def glyph_and_content_html(content_html = nil) [:glyph] ? generate_glyph(content_html) : content_html || content end |