Class: Nitro::Form::FixnumControl

Inherits:
Control
  • Object
show all
Defined in:
lib/nitro/helper/form/controls.rb

Overview

Fixnum

Direct Known Subclasses

FloatControl

Instance Attribute Summary

Attributes inherited from Control

#obj, #prop, #value

Instance Method Summary collapse

Methods inherited from Control

fetch, #initialize, #label, #on_populate

Methods included from XhtmlHelper

#date_select, #datetime_select, #hidden, #href_of, #js_popup, #link_to, #onclick_popup, #options, #popup, #submit, #time_select

Constructor Details

This class inherits a constructor from Nitro::Form::Control

Instance Method Details

#renderObject



98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/nitro/helper/form/controls.rb', line 98

def render
  style = prop.control_style ||self.class.style 
  %{
    <div class="numeric_ctl_container">
      <span class="numeric_ctl_input">
        <input type="text" id="#{prop.symbol}_ctl" name="#{prop.symbol}" value="#{value}"#{emit_style}#{emit_disabled} />
      </span>
      <span class="numeric_ctl_buttons">
        <a href="#" onclick="el=document.getElementById('#{prop.symbol}_ctl'); el.value=(parseInt(el.value) || 0)+#{step}; return false;">+</a>
        <a href="#" onclick="el=document.getElementById('#{prop.symbol}_ctl'); el.value=(parseInt(el.value) || 0)-#{step}; return false;">-</a>
      </span>
    </div>
  }
end

#stepObject



113
114
115
# File 'lib/nitro/helper/form/controls.rb', line 113

def step
  1
end