Sha256: e72f3d072f899387a81015e8c5cf07cbfbb313128ea2f2a9ed375b169aa2cda1

Contents?: true

Size: 868 Bytes

Versions: 1

Compression:

Stored size: 868 Bytes

Contents

# frozen_string_literal: true

module PopoverExtension
  def popover_data_html
    return if options[:popover].nil?

    html_options.update(generate_popover.render)
  end

  def tooltip_data_html
    return if options[:tooltip].nil?

    html_options.update(generate_tooltip.render)
  end

  private

  def generate_tooltip
    case options[:tooltip].class.name
    when 'UiBibz::Ui::Core::Notifications::Tooltip'
      options[:tooltip]
    when 'TrueClass'
      UiBibz::Ui::Core::Notifications::Tooltip.new(html_options.delete(:title))
    else
      UiBibz::Ui::Core::Notifications::Tooltip.new(options[:tooltip])
    end
  end

  def generate_popover
    case options[:popover].class.name
    when 'UiBibz::Ui::Core::Notifications::Popover'
      options[:popover]
    else
      UiBibz::Ui::Core::Notifications::Popover.new(options[:popover])
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ui_bibz-3.0.0.beta8 lib/ui_bibz/ui/extensions/core/component/popover_extension.rb