Sha256: 253e1059e321266c4605ee68257e19694f4c55e1502d06afd68f4df433b73bda

Contents?: true

Size: 1.28 KB

Versions: 6

Compression:

Stored size: 1.28 KB

Contents

module PopoverExtension

  TOOLTIP_METHODS = %i(animation container delay html placement selector template title trigger
    offset fallback_placement boundary sanitize white_list santitize_fn)

  POPOVER_METHODS = %i(animation container content delay html placement selector template title
    trigger offset fallback_placement boundary sanitize white_list sanitize_fn)

  def popover_data_html
    unless options[:popover].blank?
      add_html_data :toggle, "popover"
      add_html_data :content, (options[:popover].kind_of?(String) ? options[:popover] : options[:popover][:content])
    end
    if options[:popover].kind_of?(Hash)
      POPOVER_METHODS.each{ |mth| add_html_data(mth, options[:popover].try(:[], mth)) unless options[:popover].try(:[], mth).nil? }
      add_html_data :placement, options[:popover].try(:[], :position)  unless options[:popover].try(:[], :position).nil?
    end
  end

  def tooltip_data_html
    add_html_data :toggle, "tooltip" unless options[:tooltip].nil?

    if options[:tooltip].kind_of?(Hash)
      TOOLTIP_METHODS.each{ |mth| add_html_data(mth, options[:tooltip].try(:[], mth)) unless options[:tooltip].try(:[], mth).nil? }
      add_html_data :placement, options[:tooltip].try(:[], :position)  unless options[:tooltip].try(:[], :position).nil?
    end
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ui_bibz-2.3.5 lib/ui_bibz/ui/extensions/core/component/popover_extension.rb
ui_bibz-2.3.4 lib/ui_bibz/ui/extensions/core/component/popover_extension.rb
ui_bibz-2.3.3 lib/ui_bibz/ui/extensions/core/component/popover_extension.rb
ui_bibz-2.3.2 lib/ui_bibz/ui/extensions/core/component/popover_extension.rb
ui_bibz-2.3.1 lib/ui_bibz/ui/extensions/core/component/popover_extension.rb
ui_bibz-2.3.0 lib/ui_bibz/ui/extensions/core/component/popover_extension.rb