Class: Nitro::FloatControl
- Inherits:
-
AttributeControl
- Object
- Element
- Control
- AttributeControl
- Nitro::FloatControl
- Defined in:
- lib/nitro/control/attribute/float.rb
Overview
Controls a Float attribute.
Instance Attribute Summary
Attributes inherited from AttributeControl
Attributes included from ElementMixin
#_children, #_parent, #_text, #_view, #id
Instance Method Summary collapse
Methods inherited from AttributeControl
Methods included from XhtmlHelper
#date_select, #datetime_select, #hidden, #href_of, #js_popup, #link_to, #objects_to_options, #onclick_popup, #options, #popup, #submit, #time_select
Methods inherited from Element
Methods included from ElementMixin
#add_child, #close, #content, #initialize, #open, #render_children
Constructor Details
This class inherits a constructor from Nitro::AttributeControl
Instance Method Details
#render ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/nitro/control/attribute/float.rb', line 10 def render style = @anno.control_style || self.class.style %{ #{emit_label} <input type="text" id="#{@attribute}_ctl" name="#{@attribute}" value="#{value}"#{emit_style}#{emit_disabled} /> <a href="#" onclick="el=document.getElementById('#{@attribute}_ctl'); el.value=(parseInt(el.value) || 0)+#{step}; return false;">+</a> <a href="#" onclick="el=document.getElementById('#{@attribute}_ctl'); el.value=(parseInt(el.value) || 0)-#{step}; return false;">-</a> } end |
#step ⇒ Object
20 21 22 |
# File 'lib/nitro/control/attribute/float.rb', line 20 def step 0.5 end |