Module: Opalla::ComponentHelper

Defined in:
lib/opalla/component_helper.rb

Instance Method Summary collapse

Instance Method Details

#component(name, id: nil, model: nil, collection: nil) ⇒ Object



3
4
5
6
7
8
# File 'lib/opalla/component_helper.rb', line 3

def component(name, id: nil, model: nil, collection: nil)
  comp_id = (id || "#{name}-#{cidn_and_increment}")
  html    = component_html(name, id: id, model: model, collection: collection)
  output  = Nokogiri::HTML.fragment(html).children.attr(id: comp_id).to_s
  output.html_safe
end