module Presenting::FormHelpers
Public Instance Methods
present(field)
click to toggle source
# File lib/presenting/form_helpers.rb, line 2 def present(field) send("present_#{field.type}_input", field) end
present_boolean_input(field)
click to toggle source
# File lib/presenting/form_helpers.rb, line 26 def present_boolean_input(field) check_box field.name end
present_dropdown_input(field)
click to toggle source
# File lib/presenting/form_helpers.rb, line 30 def present_dropdown_input(field) view.select_tag "#{object_name}[#{field.name}]", view.options_for_select(field.type_options, object.send(field.name)) end
Also aliased as: present_select_input
present_multi_select_input(field)
click to toggle source
# File lib/presenting/form_helpers.rb, line 35 def present_multi_select_input(field) view.select_tag "#{object_name}[#{field.name}][]", view.options_for_select(field.type_options, object.send(field.name)), :multiple => true end
present_password_input(field)
click to toggle source
# File lib/presenting/form_helpers.rb, line 22 def present_password_input(field) password_field field.name end
present_radios_input(field)
click to toggle source
# File lib/presenting/form_helpers.rb, line 39 def present_radios_input(field) field.type_options.collect do |(display, value)| label("#{field.name}_#{value}", display) + radio_button(field.name, value) end.join.html_safe end
present_readonly_input(field)
click to toggle source
# File lib/presenting/form_helpers.rb, line 6 def present_readonly_input(field) text_field field.name, :disabled => true, :value => field.value_from(object) end
present_string_input(field)
click to toggle source
# File lib/presenting/form_helpers.rb, line 10 def present_string_input(field) text_field field.name, :value => field.value_from(object) end
present_text_input(field)
click to toggle source
# File lib/presenting/form_helpers.rb, line 18 def present_text_input(field) text_area field.name, :value => field.value_from(object) end
Private Instance Methods
view()
click to toggle source
# File lib/presenting/form_helpers.rb, line 48 def view @template end