Module: ActionView::Helpers::FormHelper
- Defined in:
- lib/context_help/patches/form_helper_patch.rb
Instance Method Summary collapse
- #check_box_with_context_help_check_box(object_name, method, options = {}, checked_value = "1", unchecked_value = "0") ⇒ Object
- #fields_for_with_context_help_fields_for(record_or_name_or_array, *args, &block) ⇒ Object
- #file_field_with_context_help_file_field(object_name, method, options = {}) ⇒ Object
- #hidden_field_with_context_help_hidden_field(object_name, method, options = {}) ⇒ Object
- #label_with_context_help_label(object_name, method, text = nil, options = {}) ⇒ Object
- #password_field_with_context_help_password_field(object_name, method, options = {}) ⇒ Object
- #radio_button_with_context_help_radio_button(object_name, method, tag_value, options = {}) ⇒ Object
- #text_area_with_context_help_text_area(object_name, method, options = {}) ⇒ Object
- #text_field_with_context_help_text_field(object_name, method, options = {}) ⇒ Object
Instance Method Details
#check_box_with_context_help_check_box(object_name, method, options = {}, checked_value = "1", unchecked_value = "0") ⇒ Object
54 55 56 57 58 |
# File 'lib/context_help/patches/form_helper_patch.rb', line 54 def check_box_with_context_help_check_box(object_name, method, = {}, checked_value = "1", unchecked_value = "0") = ContextHelp::Helpers.({:context_help => {:path => {:model => object_name.to_sym, :attribute=> method.to_sym}}}, ) help = ContextHelp::Base.help_for() check_box_without_context_help_check_box(object_name, method, , checked_value, unchecked_value) + help end |
#fields_for_with_context_help_fields_for(record_or_name_or_array, *args, &block) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/context_help/patches/form_helper_patch.rb', line 4 def fields_for_with_context_help_fields_for(record_or_name_or_array, *args, &block) case record_or_name_or_array when String, Symbol object_name = record_or_name_or_array else object_name = ActionController::RecordIdentifier.singular_class_name(record_or_name_or_array) end = ContextHelp::Helpers.({:context_help => {:path => {:model => object_name.to_sym} } }, args.last.is_a?(::Hash)? args.last : {}) help = ContextHelp::Base.help_for() help + fields_for_without_context_help_fields_for(record_or_name_or_array, *args, &block) end |
#file_field_with_context_help_file_field(object_name, method, options = {}) ⇒ Object
44 45 46 47 48 |
# File 'lib/context_help/patches/form_helper_patch.rb', line 44 def file_field_with_context_help_file_field(object_name, method, = {}) = ContextHelp::Helpers.({:context_help => {:path => {:model => object_name.to_sym, :attribute=> method.to_sym}}}, ) help = ContextHelp::Base.help_for() file_field_without_context_help_file_field(object_name, method, ) + help end |
#hidden_field_with_context_help_hidden_field(object_name, method, options = {}) ⇒ Object
39 40 41 42 43 |
# File 'lib/context_help/patches/form_helper_patch.rb', line 39 def hidden_field_with_context_help_hidden_field(object_name, method, = {}) = ContextHelp::Helpers.({:context_help => {:path => {:model => object_name.to_sym, :attribute=> method.to_sym}}}, ) help = ContextHelp::Base.help_for() hidden_field_without_context_help_hidden_field(object_name, method, ) + help end |
#label_with_context_help_label(object_name, method, text = nil, options = {}) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/context_help/patches/form_helper_patch.rb', line 16 def label_with_context_help_label(object_name, method, text = nil, = {}) = ContextHelp::Helpers.({:context_help => {:path => {:model => object_name.to_sym, :attribute=> method.to_sym}}}, ) ContextHelp::Base.help_for() link_to_help = ContextHelp::Base.link_to_help([:context_help]) text = if text.blank? i18n_label = I18n.t("helpers.label.#{object_name}.#{method}", :default => "") i18n_label if i18n_label.present? else text.to_s end text ||= method.to_s.humanize label_without_context_help_label(object_name, method, text.to_s + link_to_help, ) end |
#password_field_with_context_help_password_field(object_name, method, options = {}) ⇒ Object
34 35 36 37 38 |
# File 'lib/context_help/patches/form_helper_patch.rb', line 34 def password_field_with_context_help_password_field(object_name, method, = {}) = ContextHelp::Helpers.({:context_help => {:path => {:model => object_name.to_sym, :attribute=> method.to_sym}}}, ) help = ContextHelp::Base.help_for() password_field_without_context_help_password_field(object_name, method, ) + help end |
#radio_button_with_context_help_radio_button(object_name, method, tag_value, options = {}) ⇒ Object
59 60 61 62 63 |
# File 'lib/context_help/patches/form_helper_patch.rb', line 59 def (object_name, method, tag_value, = {}) = ContextHelp::Helpers.({:context_help => {:path => {:model => object_name.to_sym, :attribute=> method.to_sym}}}, ) help = ContextHelp::Base.help_for() (object_name, method, tag_value, ) +help end |
#text_area_with_context_help_text_area(object_name, method, options = {}) ⇒ Object
49 50 51 52 53 |
# File 'lib/context_help/patches/form_helper_patch.rb', line 49 def text_area_with_context_help_text_area(object_name, method, = {}) = ContextHelp::Helpers.({:context_help => {:path => {:model => object_name.to_sym, :attribute=> method.to_sym}}}, ) help = ContextHelp::Base.help_for() text_area_without_context_help_text_area(object_name, method, ) + help end |
#text_field_with_context_help_text_field(object_name, method, options = {}) ⇒ Object
29 30 31 32 33 |
# File 'lib/context_help/patches/form_helper_patch.rb', line 29 def text_field_with_context_help_text_field(object_name, method, = {}) = ContextHelp::Helpers.({:context_help => {:path => {:model => object_name.to_sym, :attribute=> method.to_sym}}}, ) help = ContextHelp::Base.help_for() text_field_without_context_help_text_field(object_name, method, ) + help end |