Class: CML::Tags::Checkboxes
- Defined in:
- lib/cml/tags/checkboxes.rb
Constant Summary collapse
- Template =
<<-HTML.freeze {{legend}} {{content}} HTML
Constants included from CML::TagLogic
CML::TagLogic::And, CML::TagLogic::AndPhraseExp, CML::TagLogic::CombinatorDefault, CML::TagLogic::CombinatorDict, CML::TagLogic::CombinatorExp, CML::TagLogic::GroupExp, CML::TagLogic::Or, CML::TagLogic::OrCombinatorExp, CML::TagLogic::PrecedenceRegexp, CML::TagLogic::TokenExp, CML::TagLogic::TokenRegexp
Instance Attribute Summary
Attributes inherited from CML::Tag
Attributes included from CML::TagLogic
#errors, #has_grouped_logic, #has_liquid_logic, #logic_tree
Instance Method Summary collapse
Methods inherited from CML::Tag
#cacheable?, #classes, #convert, #ensure_resolved, #gold=, #gold?, #gold_class, #gold_reason, #initialize, #instructions, #iterating?, #label, #legend, memoize, #multi_type, #name, #parent_multiples, #prefix, #preloaded_data, #raw_label, #to_html, #to_liquid, #to_s, #validate?, #validations, #validators, #value, #wrapper, #wrapper_classes
Methods included from CML::TagLogic
#dependencies_on_fields, #dependencies_through_cml_group, #depends_on_fields, #describe_logic_token, #detect_grouped_logic, #detect_liquid_logic, #each_logic_token_in, #expand_logic, #expand_parsed_expression, #in_logic_graph?, #keep_merge!, #only_if, parse_expression, resolve_combinator
Constructor Details
This class inherits a constructor from CML::Tag
Instance Method Details
#children ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/cml/tags/checkboxes.rb', line 32 def children @cml.xpath(".//cml:checkbox").map do |c| c["name"] ||= name(false) c["validates"] ||= @attrs["validates"].to_s Checkbox.new(c, @opts) end end |
#content(*args) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/cml/tags/checkboxes.rb', line 18 def content(*args) cloned= @cml.dup c = children cloned.xpath(".//cml:*[not(self::cml:checkbox)]").remove #re-merge opts to get iterations... cloned.xpath(".//cml:checkbox").each_with_index do |r,i| r.namespace = nil r.replace(c[i].convert(@opts)) end #Removal of the root tag html = cloned.to_xhtml.gsub(/<\/?cml:checkboxes[^>]*?>|<\/?>/,'') end |
#data ⇒ Object
13 14 15 16 |
# File 'lib/cml/tags/checkboxes.rb', line 13 def data #Don't memoize individual checkboxes if we are normalizing super.merge({"content" => content(@opts[:normalize] ? @opts[:iteration] : nil) }) end |
#finite_value? ⇒ Boolean
9 10 11 |
# File 'lib/cml/tags/checkboxes.rb', line 9 def finite_value? true end |