Module: Coupdoeil::ApplicationHelper

Defined in:
app/helpers/coupdoeil/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#coupdoeil_popover_dataset(popover, popover_options = nil, format: Coupdoeil.config.default_dataset_format) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/helpers/coupdoeil/application_helper.rb', line 9

def coupdoeil_popover_dataset(popover, popover_options = nil, format: Coupdoeil.config.default_dataset_format)
  coupdoeil_tag = Coupdoeil::Tag.new(popover:, popover_options:, attributes: nil)
  case format
  when :html then tag.attributes(data: coupdoeil_tag.popover_attributes)
  when :nested then { data: coupdoeil_tag.popover_attributes }
  when :prefixed then coupdoeil_tag.popover_attributes(prefixed: true)
  when :raw then coupdoeil_tag.popover_attributes
  else
    raise ArgumentError, "unknown format '#{format}' (#{format.class}). \
Expected :html, :nested, :prefixed or :raw."
  end
end

#coupdoeil_popover_tag(popover, popover_options = nil, tag_attributes = nil) ⇒ Object



5
6
7
# File 'app/helpers/coupdoeil/application_helper.rb', line 5

def coupdoeil_popover_tag(popover, popover_options = nil, tag_attributes = nil, &)
  render(Coupdoeil::Tag.new(popover:, popover_options:, attributes: tag_attributes), &)
end