API reference
Coupdoeil::Hovercard
Class methods
.with
Allows to set params for an hovercard.
ProjectHovercard.with(project: @project).summary
.default_options
-> [Coupdoeil::Hovercard::OptionsSet]
Sets or returns default options for all hovercard actions. Specific action options will inherit from default options.
class ProjectHovercard < ApplicationHovercard
default_options placement: :top, offset: "1rem"
end
ProjectHovercard.default_options
# => #<Coupdoeil::Hovercard::OptionsSet:0x0000000127df8db0
# @options={:offset=>"1rem", :placement=>:top, :animation=>"slide-in", :cache=>true, :loading=>:async, :trigger=>"hover"}
# >
.default_options_for
-> [Coupdoeil::Hovercard::OptionsSet]
Sets or returns default options for one or many actions. Options inherit from default options.
class ProjectHovercard < ApplicationHovercard
default_options_for :summary, placement: :top
default_options_for :tooltip, :summary, loading: :preload
end
ProjectHovercard.default_options_for :summary
# => #<Coupdoeil::Hovercard::OptionsSet:0x0000000127df8db0
# @options={:placement=>:top, :loading=>:preload, :offset=>0, :animation=>"slide-in", :cache=>true, :trigger=>"hover"}
# >
ProjectHovercard.default_options_for :tooltip
# => #<Coupdoeil::Hovercard::OptionsSet:0x0000000127df8db0
# @options={:placement=>"auto", :loading=>:preload, :offset=>0, :animation=>"slide-in", :cache=>true, :trigger=>"hover"}
# >
Instance methods
#params
-> [HashWithIndifferentAccess]
Returns deserialized params passed to .with
method.
ProjectHovercard.with(project: @project).summary
class ProjectHovercard < ApplicationHovercard
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 hovercard, either the current controller when preloading or a Coupdoeil::HovercardsController
instance. Can be used to retrieve data about current request for example.