Class: ContextHelp::SemanticFormBuilder
- Inherits:
-
Formtastic::SemanticFormBuilder
- Object
- Formtastic::SemanticFormBuilder
- ContextHelp::SemanticFormBuilder
- Defined in:
- lib/context_help/patches/formtastic_patch.rb
Instance Method Summary collapse
- #input(method, options = {}) ⇒ Object
- #inputs(*args, &block) ⇒ Object
- #legend_tag(method, options = {}) ⇒ Object
- #radio_input(method, options) ⇒ Object
Instance Method Details
#input(method, options = {}) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/context_help/patches/formtastic_patch.rb', line 13 def input(method, = {}) = ContextHelp::Helpers.({:context_help => {:path => {:model => model_name.to_sym, :attribute=> method.to_sym}}}, || {}) [:label_html] ||= {} [:label_html][:context_help] = [:context_help].dup [:input_html] ||= {} [:input_html][:context_help] = [:context_help].dup super method, end |
#inputs(*args, &block) ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/context_help/patches/formtastic_patch.rb', line 3 def inputs(*args, &block) title = field_set_title_from_args(*args) = args. = ContextHelp::Helpers.({:context_help => {:path => {:tag => 'fieldset', :tag_options => }}}, ) [:context_help][:title] = title if [:context_help][:path][:tag] help = ContextHelp::Base.help_for() super *(args<<), &block end |
#legend_tag(method, options = {}) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/context_help/patches/formtastic_patch.rb', line 26 def legend_tag(method, = {}) if [:label] == false Formtastic::Util.html_safe("") else text = localized_string(method, [:label], :label) || humanized_attribute_name(method) text += required_or_optional_string(.delete(:required)) text = Formtastic::Util.html_safe(text) template.content_tag :legend, template.label_tag(nil, text, ), :class => :label end end |
#radio_input(method, options) ⇒ Object
21 22 23 24 25 |
# File 'lib/context_help/patches/formtastic_patch.rb', line 21 def radio_input(method, ) [:label] = localized_string(method, [:label], :label) || humanized_attribute_name(method) ContextHelp::Base.help_for() super method, end |