Class: Clot::SubmitTag
- Inherits:
-
ClotTag
- Object
- Liquid::Tag
- ClotTag
- Clot::SubmitTag
show all
- Defined in:
- lib/clot/no_model_form_tags.rb
Constant Summary
Constants inherited
from ClotTag
ClotTag::Syntax
Instance Method Summary
collapse
Methods inherited from ClotTag
#initialize, #render
Methods included from TagHelper
#resolve_value, #split_params
#set_attributes
Constructor Details
This class inherits a constructor from Clot::ClotTag
Instance Method Details
#personal_attributes(name, value) ⇒ Object
153
154
155
156
157
158
159
160
|
# File 'lib/clot/no_model_form_tags.rb', line 153
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_string ⇒ Object
170
171
172
|
# File 'lib/clot/no_model_form_tags.rb', line 170
def render_string
%{<input #{@class_string}#{@onclick_string}#{@disabled_string}type="submit" #{@commit_name_string}value="#{@value_string}" />}
end
|
#set_primary_attributes(context) ⇒ Object
162
163
164
165
166
167
168
|
# File 'lib/clot/no_model_form_tags.rb', line 162
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
|