Class: ForgeFormBuilder
- Inherits:
-
ActionView::Helpers::FormBuilder
- Object
- ActionView::Helpers::FormBuilder
- ForgeFormBuilder
- Includes:
- ActionView::Helpers::TagHelper, Ckeditor::Helpers::FormBuilder
- Defined in:
- lib/forge/app/form_builders/forge_form_builder.rb
Instance Attribute Summary collapse
-
#output_buffer ⇒ Object
Returns the value of attribute output_buffer.
Instance Method Summary collapse
- #cktext_area(method_name, options = {}) ⇒ Object
- #cktext_area_content(method_name, options = {}, language = nil, language_title = nil) ⇒ Object
- #datetime_widget(method_name, options = {}) ⇒ Object
- #super_cktext_area ⇒ Object
- #super_label ⇒ Object
- #super_text_area ⇒ Object
- #super_text_field ⇒ Object
- #text_area(method_name, options = {}) ⇒ Object
- #text_area_content(method_name, options = {}, language = nil, language_title = nil) ⇒ Object
- #text_field(method_name, options = {}) ⇒ Object
- #text_field_content(method_name, options = {}, language = nil, language_title = nil) ⇒ Object
- #title_field(method_name, options = {}) ⇒ Object
- #title_field_content(method_name, options = {}, language = nil, language_title = nil) ⇒ Object
Instance Attribute Details
#output_buffer ⇒ Object
Returns the value of attribute output_buffer.
4 5 6 |
# File 'lib/forge/app/form_builders/forge_form_builder.rb', line 4 def output_buffer @output_buffer end |
Instance Method Details
#cktext_area(method_name, options = {}) ⇒ Object
20 21 22 |
# File 'lib/forge/app/form_builders/forge_form_builder.rb', line 20 def cktext_area(method_name, = {}) content = build_content(:cktext_area_content, method_name, ) end |
#cktext_area_content(method_name, options = {}, language = nil, language_title = nil) ⇒ Object
24 25 26 27 28 |
# File 'lib/forge/app/form_builders/forge_form_builder.rb', line 24 def cktext_area_content(method_name, = {}, language = nil, language_title = nil) label = label(method_name, [:label], language, language_title) explanation = explanation([:explanation]) label + explanation + super_cktext_area(get_method(method_name, language), ) end |
#datetime_widget(method_name, options = {}) ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/forge/app/form_builders/forge_form_builder.rb', line 52 def (method_name, = {}) label = label(method_name, [:label], nil, nil) explanation = explanation([:explanation]) on = content_tag(:tr) do [ content_tag(:td, "On: "), content_tag(:td, super_text_field("#{method_name}_date", :class => "datepicker", :size => 12, :value => @object.send(method_name) ? @object.send(method_name).strftime('%Y-%m-%d') : ([:default_date] || Time.now.strftime('%Y-%m-%d')))) ].join("\n").html_safe end at = content_tag(:tr) do [ content_tag(:td, "At: "), content_tag(:td, super_text_field("#{method_name}_time", :value => @object.send(method_name) ? @object.send(method_name).strftime('%l:%M%p').strip : ([:default_time] || Time.now.strftime('%l:%M%p').strip), :size => 7)) ].join("\n").html_safe end table = content_tag(:table, on + at, :class => 'datetime_select') content = label(method_name, [:label], nil, nil) content += explanation([:explanation]) content += content_tag(:div, table, :class => 'inset datetime-widget') content += content_tag :hr unless [:last] end |
#super_cktext_area ⇒ Object
19 |
# File 'lib/forge/app/form_builders/forge_form_builder.rb', line 19 alias :super_cktext_area :cktext_area |
#super_label ⇒ Object
5 |
# File 'lib/forge/app/form_builders/forge_form_builder.rb', line 5 alias :super_label :label |
#super_text_area ⇒ Object
41 |
# File 'lib/forge/app/form_builders/forge_form_builder.rb', line 41 alias :super_text_area :text_area |
#super_text_field ⇒ Object
30 |
# File 'lib/forge/app/form_builders/forge_form_builder.rb', line 30 alias :super_text_field :text_field |
#text_area(method_name, options = {}) ⇒ Object
42 43 44 |
# File 'lib/forge/app/form_builders/forge_form_builder.rb', line 42 def text_area(method_name, = {}) content = build_content(:text_area_content, method_name, ) end |
#text_area_content(method_name, options = {}, language = nil, language_title = nil) ⇒ Object
46 47 48 49 50 |
# File 'lib/forge/app/form_builders/forge_form_builder.rb', line 46 def text_area_content(method_name, = {}, language = nil, language_title = nil) label = label(method_name, [:label], language, language_title) explanation = explanation([:explanation]) label + explanation + super_text_area(get_method(method_name, language), ) end |
#text_field(method_name, options = {}) ⇒ Object
31 32 33 |
# File 'lib/forge/app/form_builders/forge_form_builder.rb', line 31 def text_field(method_name, = {}) content = build_content(:text_field_content, method_name, ) end |
#text_field_content(method_name, options = {}, language = nil, language_title = nil) ⇒ Object
35 36 37 38 39 |
# File 'lib/forge/app/form_builders/forge_form_builder.rb', line 35 def text_field_content(method_name, = {}, language = nil, language_title = nil) label = label(method_name, [:label], language, language_title) explanation = explanation([:explanation]) label + explanation + super_text_field(get_method(method_name, language), ) end |
#title_field(method_name, options = {}) ⇒ Object
7 8 9 10 |
# File 'lib/forge/app/form_builders/forge_form_builder.rb', line 7 def title_field(method_name, = {}) [:last] = true content = build_content(:title_field_content, method_name, ) end |
#title_field_content(method_name, options = {}, language = nil, language_title = nil) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/forge/app/form_builders/forge_form_builder.rb', line 12 def title_field_content(method_name, = {}, language = nil, language_title = nil) label = label(method_name, [:label], language, language_title) explanation = explanation([:explanation]) row_label = content_tag(:div, label + explanation, :class => "label") row_label.html_safe + @template.text_field(@object_name, get_method(method_name, language), .merge({:class => "title"})) + content_tag(:div, "", :class => "spacer") end |