Class: CML::Tags::Radios

Inherits:
CML::Tag show all
Defined in:
lib/cml/tags/radios.rb

Constant Summary collapse

Template =
<<-HTML.freeze
{{legend}}
  {% for radio in radios %}
  {{radio}}
  {% endfor %}
HTML

Instance Attribute Summary

Attributes inherited from CML::Tag

#attrs, #cml, #tag

Instance Method Summary collapse

Methods inherited from CML::Tag

#classes, #convert, #gold=, #gold?, #initialize, #instructions, #label, #legend, #name, #prefix, #raw_label, #to_html, #to_liquid, #to_s, #validate?, #validations, #value, #wrapper, #wrapper_classes

Constructor Details

This class inherits a constructor from CML::Tag

Instance Method Details

#childrenObject



15
16
17
18
19
20
21
# File 'lib/cml/tags/radios.rb', line 15

def children
  @cml.xpath("cml:radio").map do |c|
    c["name"] ||= name
    c["validates"] ||= @attrs["validates"].to_s
    Radio.new(c, @opts)
  end
end

#dataObject



11
12
13
# File 'lib/cml/tags/radios.rb', line 11

def data
  super.merge({"radios" => children})
end