Class: FormtasticDateTimePickerInput

Inherits:
Formtastic::Inputs::StringInput
  • Object
show all
Defined in:
lib/generators/files_for_generator/formtastic_date_time_picker_input.rb

Overview

This input file serves as the custom input for any formtastic forms that may or may not exist in the host application.

Instance Method Summary collapse

Instance Method Details

#to_htmlObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/generators/files_for_generator/formtastic_date_time_picker_input.rb', line 5

def to_html
  input_wrapping do

    options[:label] = {:for => input_html_options[:id],
                       :class => "control-label"}

    in_modal = input_html_options["data-in-modal"] ? input_html_options.delete("data-in-modal") : nil
    close_javascript_support = input_html_options["data-close-js-support"] ? input_html_options.delete("data-close-js-support") : nil

    out = '<div class="text control-group">'
    out << (render_label? ? builder.label(input_name, label_text, label_from_options) : "")
    out << '<div class="controls">'
    out << before_dtp_html
    out << builder.text_field(method, input_html_options)
    out << after_dtp_html

    if in_modal || close_javascript_support
      out << js_because_of_jquery_requirements
    end

    out << "</div></div>"
    out.html_safe
  end
end