API reference
Coupdoeil::Popover
Class methods
.with
Allows to set params for a popover.
ProjectPopover.with(project: @project).summary
.default_options
-> [Coupdoeil::Popover::OptionsSet]
Sets or returns default options for all popover actions. Specific action options will inherit from default options.
class ProjectPopover < ApplicationPopover
default_options placement: :top, offset: "1rem"
end
ProjectPopover.default_options
# => #<Coupdoeil::Popover::OptionsSet:0x0000000127df8db0
# @options={:offset=>"1rem", :placement=>:top, :animation=>"slide-in", :cache=>true, :loading=>:async, :trigger=>"hover"}
# >
.default_options_for(*action_names, **option_values)
-> [Coupdoeil::Popover::OptionsSet]
Sets or returns default options for one or many actions. Options inherit from default options.
class ProjectPopover < ApplicationPopover
default_options_for :summary, placement: :top
default_options_for :tooltip, :summary, loading: :preload, opening_delay: false
end
ProjectPopover.default_options_for :summary
# => #<Coupdoeil::Popover::OptionsSet:0x0000000127df8db0
# @options={:placement=>:top, :loading=>:preload, :offset=>0, :animation=>"slide-in", :cache=>true, :trigger=>"hover"}
# >
ProjectPopover.default_options_for :tooltip
# => #<Coupdoeil::Popover::OptionsSet:0x0000000127df8db0
# @options={:placement=>"auto", :loading=>:preload, :offset=>0, :animation=>"slide-in", :cache=>true, :trigger=>"hover"}
# >
Instance methods
#params
-> [HashWithIndifferentAccess]
Returns deserialized params initially passed to .with
method.
ProjectPopover.with(project: @project).summary
class ProjectPopover < ApplicationPopover
def summary
@project = params[:project]
end
end
#helpers
-> [ActionView::Base]
Returns applications helpers. It is accessible both within action method and template.
#controller
-> [ActionController::Base]
Returns controller that renders the popover, either the current controller when preloading or a Coupdoeil::PopoversController
instance. Can be used to retrieve data about current request for example.
Coupdoeil::ApplicationHelper
Instance methods
#coupdoeil_popover_tag(popover, popover_options = nil, tag_attributes = nil, &block)
-> [ActiveSupport::SafeBuffer]
Returns a
coupdoeil_popover_tag ProjectPopover.with(project: @project).summary
You can pass specific options that will override default options for the popover action.
coupdoeil_popover_tag ProjectPopover.with(project: @project).summary, placement: "top", animation: false
You can also pass attributes for tag.
coupdoeil_popover_tag ProjectPopover.with(project: @project).summary, nil, class: "inline-block"
Passing attributes to tag and options to popover
coupdoeil_popover_tag ProjectPopover.with(project: @project).summary, { placement: "top", animation: false }, class: "inline-block"