Sha256: 140663f09eb65b6515cd496d16fac86b9bdc341c6c128bb9347ac133b8e827d0
Contents?: true
Size: 990 Bytes
Versions: 36
Compression:
Stored size: 990 Bytes
Contents
# frozen_string_literal: true module GlyphExtension # Render glyph and content html def glyph_and_content_html(content_html = nil) options[:glyph] ? generate_glyph(content_html) : content_html || content end # Render glyph html def generate_glyph(content_html) glyph_options = if options[:glyph].is_a?(Hash) options[:glyph] elsif options[:glyph] { name: options[:glyph] } else {} end glyph_options = glyph_options.tap do |h| h[:text] = options[:text] h[:label] = options[:label] || content_html || content h[:shortcut] = options[:shortcut] unless options[:shortcut].nil? end # UiBibz::Utils::GlyphChanger.new(glyph_options[:name], glyph_options).render unless glyph_options[:name].nil? UiBibz::Ui::Core::Icons::Glyph.new(glyph_options[:name], glyph_options).render if glyph_options[:name].present? end end
Version data entries
36 entries across 36 versions & 1 rubygems