class Wedge::Plugins::Popover

Public Instance Methods

ajax(el, options = {}) click to toggle source
# File lib/wedge/plugins/popover.rb, line 32
def ajax el, options = {}, &block
  options = { content: 'loading' }.merge options
  display el, options, &block
end
display(el, options = {}) click to toggle source
# File lib/wedge/plugins/popover.rb, line 8
def display el, options = {}, &block
  return if el.data 'wedge-popover'

  el.data 'wedge-popover', true
  el = el.to_n

  options = {
    content: 'Loading...',
    position: 'right middle',
    openOn: 'hover'
  }.merge(options)

  options[:classes] = "drop-theme-arrows #{options[:classes]}"

  options = options.to_n

  opts = `$.extend(options, { target: el[0] })`
  drop = Native(`new Drop(opts)`)

  block.call(Native(opts)) if block_given?

  drop
end