Class: Clot::CheckBox
- Includes:
- ModelTag
- Defined in:
- lib/clot/model_form_tags.rb
Instance Method Summary collapse
Methods included from ModelTag
Methods inherited from ClotTag
Methods included from TagHelper
Methods included from AttributeSetter
#personal_attributes, #set_attributes
Constructor Details
This class inherits a constructor from Clot::ClotTag
Instance Method Details
#render_string ⇒ Object
197 198 199 200 201 202 |
# File 'lib/clot/model_form_tags.rb', line 197 def render_string if @item[@attribute_name.to_sym] @checked_value = %{checked="checked" } end %{<input name="#{@name_string}" type="hidden" value="#{@false_val}" />} + %{<input #{@disabled_string}#{@class_string}#{@checked_value}id="#{@id_string}" name="#{@name_string}" type="checkbox" value="#{@true_val}" />} end |
#set_primary_attributes(context) ⇒ Object
186 187 188 189 190 191 192 193 194 195 |
# File 'lib/clot/model_form_tags.rb', line 186 def set_primary_attributes(context) super(context) if @params.length > 1 && ! @params[0].match(/:/) && ! @params[1].match(/:/) @true_val = resolve_value(@params.shift,context) @false_val = resolve_value(@params.shift,context) else @true_val = 1 @false_val = 0 end end |