Module: JqueryUiForm::Helpers::InputHelper
- Included in:
- FormBuilder
- Defined in:
- lib/jquery_ui_form/helpers/input_helper.rb
Instance Method Summary collapse
-
#basic_input_helper(form_helper_method, type, method, options) ⇒ Object
:nodoc:.
- #inline_hint(hint, type = nil) ⇒ Object
- #input(method, options = {}) ⇒ Object
Instance Method Details
#basic_input_helper(form_helper_method, type, method, options) ⇒ Object
:nodoc:
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/jquery_ui_form/helpers/input_helper.rb', line 31 def basic_input_helper(form_helper_method, type, method, ) #:nodoc: = .delete(:html_label) || {} [:required] = [:required] [:label] = .delete(:label) hint = [:placeholder] = .delete(:hint) if .delete(:no_label) "".html_safe else label(method, ) end << send(respond_to?(form_helper_method) ? form_helper_method : :text_field, method, ) << inline_hint(hint, type) << inline_error(method) end |
#inline_hint(hint, type = nil) ⇒ Object
46 47 48 49 50 51 52 53 |
# File 'lib/jquery_ui_form/helpers/input_helper.rb', line 46 def inline_hint(hint, type = nil) return "" if hint.blank? if use_i18n hint = I18n.t(hint,:scope => [:helpers, :hints]) end return "" if html5_inputs && placeholder_elements.include?(type.to_s) template.content_tag(:div, hint, :class => "ui-input-hint") end |
#input(method, options = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/jquery_ui_form/helpers/input_helper.rb', line 5 def input(method, ={}) = .delete(:html_row) || {} [:as] ||= default_input_type(method, ) [:class] ||= "" [:class] << " ui-#{[:as]}-input" [:class] ||= "" [:class] << " ui-#{[:as]}-input" if [:as] == :hidden return send(:"#{.delete(:as)}_input", method, ) end [:required] = method_required?(method) if [:required].nil? [:class] << " ui-input-error" if has_errors?(method) if (@template.autofocus) && [:as] != :hidden [:autofocus] = true @template.autofocus = false end column() do send(:"#{.delete(:as)}_input", method, ) end end |