Module: ExtForm::Helpers::FormTagHelper
- Extended by:
- ActiveSupport::Concern
- Included in:
- FormHelper
- Defined in:
- lib/ext_form/helpers/form_tag_helper.rb
Instance Method Summary collapse
-
#auto_complete_tag(name, value, options = {}) ⇒ Object
JS auto complete feature using twitter typeahead.js, pass options through data.
-
#dt_picker_tag(name, value, options = {}) ⇒ Object
Datetime picker tag helper, based on bootstrap-datetimepicker.
Instance Method Details
#auto_complete_tag(name, value, options = {}) ⇒ Object
JS auto complete feature using twitter typeahead.js, pass options through data. see: ExtForm::Helpers::FormHelper#auto_complete TODO: this feature needs to be tested.
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/ext_form/helpers/form_tag_helper.rb', line 46 def auto_complete_tag(name, value, ={}) id = sanitize_to_id(name) = {id: id} .reverse_merge!() output = text_field_tag(name, value, ) output << javascript_tag do "$('##{[:id]}').trigger('auto_complete_load');".html_safe end output.html_safe end |
#dt_picker_tag(name, value, options = {}) ⇒ Object
Datetime picker tag helper, based on bootstrap-datetimepicker
object_name - the object name of form builder method - method of object options - all options are as same as text field.
data -
format - yyyy-mm-dd, yyyy/mm/dd.....
week_start - 0-6
start_date - can't pick the date before the start_date.
end_date - can't pick the date after the end_date.
view_mode - 0..month,1..year,2..10 years
min_view_mode - not be tested....
language - default pt-BR, see bootstrap-datetimepicker API
mask_input - true, false disables the text input mask
pick_date - true, false disables the date picker
pick_time - true, false disables de time picker
pick_12_hour_format - false, true enables the 12-hour format time picker
pick_seconds - true
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/ext_form/helpers/form_tag_helper.rb', line 24 def dt_picker_tag(name, value, ={}) id = sanitize_to_id(name) = {id: id} .reverse_merge!() output = content_tag(:div, nil, class: 'input-append') do [text_field_tag(name, value, ), content_tag(:span, nil, class: 'add-on') do content_tag(:i, nil, data: {date_icon: 'icon-calendar', time_icon: 'icon-time'}) end ].join.html_safe end output << javascript_tag do "$('##{[:id]}').trigger('dt_picker_load');".html_safe end output.html_safe end |