Class: Clot::SubmitTag

Inherits:
ClotTag
  • Object
show all
Defined in:
lib/clot/no_model_form_tags.rb

Instance Method Summary collapse

Methods inherited from ClotTag

#initialize, #render

Methods included from TagHelper

#resolve_value, #split_params

Methods included from AttributeSetter

#set_attributes

Constructor Details

This class inherits a constructor from Clot::ClotTag

Instance Method Details

#personal_attributes(name, value) ⇒ Object



146
147
148
149
150
151
152
153
# File 'lib/clot/no_model_form_tags.rb', line 146

def personal_attributes(name,value)
  case name
    when "name" then
      if value.nil? then @commit_name_string = '' end
    when "disable_with" then
      @onclick_string = %{onclick="this.disabled=true;this.value='#{value}';this.form.submit();" }
  end
end

#render_stringObject



163
164
165
# File 'lib/clot/no_model_form_tags.rb', line 163

def render_string
  %{<input #{@class_string}#{@onclick_string}#{@disabled_string}type="submit" #{@commit_name_string}value="#{@value_string}" />}
end

#set_primary_attributes(context) ⇒ Object



155
156
157
158
159
160
161
# File 'lib/clot/no_model_form_tags.rb', line 155

def set_primary_attributes(context)
  @value_string = "Save changes"
  @commit_name_string = 'name="commit" '
  if @params[0] && ! @params[0].match(/:/)
    @value_string = resolve_value @params.shift, context
  end
end