Module: Clot::AttributeSetter
- Included in:
- ClotTag
- Defined in:
- lib/clot/no_model_form_tags.rb
Instance Method Summary collapse
- #personal_attributes(name, value) ⇒ Object
- #set_attributes(context) ⇒ Object
- #set_primary_attributes(context) ⇒ Object
Instance Method Details
#personal_attributes(name, value) ⇒ Object
12 13 14 |
# File 'lib/clot/no_model_form_tags.rb', line 12 def personal_attributes(name,value) end |
#set_attributes(context) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/clot/no_model_form_tags.rb', line 17 def set_attributes(context) set_primary_attributes(context) @params.each do |pair| pair.match /([^:]*):(.*)/ pair = [$1, $2] value = resolve_value(pair[1],context) if personal_attributes(pair[0], value) next end case pair[0] when "value" then @value_string = value when "type" then @type = value when "accept" then @accept_string = %{accept="#{CGI::unescape value}" } when "class" then @class_string = %{class="#{value}" } when "onchange" then @onchange_string = %{onchange="#{value}" } when "maxlength" then @max_length_string = %{maxlength="#{value}" } when "disabled" then @disabled_string = %{disabled="#{if (value == true || value == "disabled") then 'disabled' end}" } end end end |
#set_primary_attributes(context) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/clot/no_model_form_tags.rb', line 5 def set_primary_attributes(context) @id_string = @name_string = resolve_value(@params.shift,context) if @params[0] && ! @params[0].match(/:/) @value_string = resolve_value(@params.shift,context) end end |