Class: SurveyorRadioInput

Inherits:
Formtastic::Inputs::RadioInput
  • Object
show all
Includes:
Surveyor::Helpers::FormtasticCustomInput
Defined in:
app/inputs/surveyor_radio_input.rb

Instance Method Summary collapse

Methods included from Surveyor::Helpers::FormtasticCustomInput

#input_html_options_with, #response_class_to_method

Instance Method Details

#choice_html(choice) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/inputs/surveyor_radio_input.rb', line 6

def choice_html(choice)
  output = "" 
  output << template.(:label,
    builder.radio_button(input_name, choice_value(choice), input_html_options.merge(choice_html_options(choice)).merge(:required => false)) << 
    choice_label(choice),
    label_html_options.merge(:for => choice_input_dom_id(choice), :class => nil)
  )
  output << builder.text_field(:response_other, input_html_options_with(choice, :response_other)) if options[:response_class] == "other_and_string"
  output << builder.text_field(response_class_to_method(options[:response_class]), input_html_options_with(choice, options[:response_class])) if %w(date datetime time float integer string other_and_string).include? options[:response_class]
  output << builder.text_area(:text_value, input_html_options_with(choice, :text_value)) if options[:response_class] == "text"
  output.html_safe
end

#to_htmlObject



3
4
5
# File 'app/inputs/surveyor_radio_input.rb', line 3

def to_html
  super
end