Class: CML::Tags::Text

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

Constant Summary collapse

Template =
<<-HTML.freeze
{{label}}
<input name="{{name}}" type="text" value="{{value}}" class="{{classes}}"/>
HTML

Instance Attribute Summary

Attributes inherited from CML::Tag

#attrs, #cml, #data, #tag

Instance Method Summary collapse

Methods inherited from CML::Tag

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

Constructor Details

This class inherits a constructor from CML::Tag

Instance Method Details

#classesObject



9
10
11
# File 'lib/cml/tags/text.rb', line 9

def classes
  super + (@attrs["default"] ? " default" : "")
end

#valueObject



13
14
15
# File 'lib/cml/tags/text.rb', line 13

def value
  (@attrs["value"] || @attrs["default"]).to_s
end