Class: Ramaze::ClassForm

Inherits:
Form show all
Defined in:
lib/ramaze/helper/form.rb

Overview

Form for the model class itself, very similar to an empty instance.

Constant Summary

Constants inherited from Form

Form::DATE_GENERIC, Form::TIME_GENERIC

Instance Attribute Summary

Attributes inherited from Form

#object, #options

Instance Method Summary collapse

Methods inherited from Form

#field_for, #initialize, pick, #to_s

Constructor Details

This class inherits a constructor from Ramaze::Form

Instance Method Details

#args_for(hash) ⇒ Object

picks the :name



210
211
212
# File 'lib/ramaze/helper/form.rb', line 210

def args_for(hash)
  [ hash[:name] ]
end

#field_boolean(name) ⇒ Object

<input type=“checkbox” name=“name” />



187
188
189
# File 'lib/ramaze/helper/form.rb', line 187

def field_boolean(name)
  checkbox :name => name
end

#field_date(name) ⇒ Object

<select> with lots of <option>s



192
193
194
195
196
197
198
# File 'lib/ramaze/helper/form.rb', line 192

def field_date(name)
  field_date_generic{|sel, range|
    [ "<select name='#{name}[#{sel}]'>",
      range.map{|d| option(d, :value => d) },
      "</select>" ]
  }
end

#field_input(name) ⇒ Object

<input name=“name” />



172
173
174
# File 'lib/ramaze/helper/form.rb', line 172

def field_input(name)
  input :name => name
end

#field_integer(name) ⇒ Object

<input name=“name” />



182
183
184
# File 'lib/ramaze/helper/form.rb', line 182

def field_integer(name)
  input :name => name
end

#field_textarea(name) ⇒ Object

<textarea name=“name”></textarea>



177
178
179
# File 'lib/ramaze/helper/form.rb', line 177

def field_textarea(name)
  textarea '', :name => name
end

#field_time(name) ⇒ Object

<select> with lots of <option>s



201
202
203
204
205
206
207
# File 'lib/ramaze/helper/form.rb', line 201

def field_time(name)
  field_time_generic{|sel, range|
    [ "<select name='#{name}[#{sel}]'>",
      range.map{|d| option(d, :value => d) },
      "</select>" ]
  }
end

#object_classObject

Should be that way, at least for Sequel



215
216
217
# File 'lib/ramaze/helper/form.rb', line 215

def object_class
  @object
end