Class: Merb::Helpers::SexyForm::Builder::Base
- Inherits:
-
Form::Builder::ResourcefulFormWithErrors
- Object
- Form::Builder::ResourcefulFormWithErrors
- Merb::Helpers::SexyForm::Builder::Base
- Defined in:
- lib/merb-sexy-forms/builder.rb
Instance Method Summary collapse
- #add_main_container(content, attrs) ⇒ Object
- #bound_check_box(method, attrs = {}) {|attrs| ... } ⇒ Object
- #bound_radio_button(method, attrs = {}) {|attrs| ... } ⇒ Object
- #bound_radio_group(method, arr, global_attrs = {}) {|attrs| ... } ⇒ Object
- #bound_select(method, attrs = {}) {|attrs| ... } ⇒ Object
- #bound_text_area(method, attrs = {}) {|attrs| ... } ⇒ Object
- #button(contents, attrs = {}) {|attrs| ... } ⇒ Object
- #form(attrs = {}, &blk) ⇒ Object
- #submit(value, attrs = {}) {|attrs| ... } ⇒ Object
- #unbound_check_box(attrs = {}) {|attrs| ... } ⇒ Object
- #unbound_radio_button(attrs = {}) {|attrs| ... } ⇒ Object
- #unbound_radio_group(arr, global_attrs = {}) {|attrs| ... } ⇒ Object
- #unbound_select(attrs = {}) {|attrs| ... } ⇒ Object
- #unbound_text_area(contents, attrs = {}) {|attrs| ... } ⇒ Object
- #wrap_with_container(attrs = {}, content = "") ⇒ Object
Instance Method Details
#add_main_container(content, attrs) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/merb-sexy-forms/builder.rb', line 12 def add_main_container(content, attrs) = attrs.delete(:ul) if Merb::Plugins.config[:merb_sexy_forms][:container_tag] == "li" tag(:ul, content, ) else content end end |
#bound_check_box(method, attrs = {}) {|attrs| ... } ⇒ Object
51 52 53 54 |
# File 'lib/merb-sexy-forms/builder.rb', line 51 def bound_check_box(method, attrs = {}, &blk) yield(attrs) if block_given? super end |
#bound_radio_button(method, attrs = {}) {|attrs| ... } ⇒ Object
63 64 65 66 |
# File 'lib/merb-sexy-forms/builder.rb', line 63 def (method, attrs = {}, &blk) yield(attrs) if block_given? super end |
#bound_radio_group(method, arr, global_attrs = {}) {|attrs| ... } ⇒ Object
68 69 70 71 72 |
# File 'lib/merb-sexy-forms/builder.rb', line 68 def bound_radio_group(method, arr, global_attrs = {}) yield(attrs) if block_given? first = arr.first wrap_with_container(global_attrs.merge(:first => first, :method => method), super(method, arr)) end |
#bound_select(method, attrs = {}) {|attrs| ... } ⇒ Object
84 85 86 87 |
# File 'lib/merb-sexy-forms/builder.rb', line 84 def bound_select(method, attrs = {}, &blk) yield(attrs) if block_given? super end |
#bound_text_area(method, attrs = {}) {|attrs| ... } ⇒ Object
95 96 97 98 |
# File 'lib/merb-sexy-forms/builder.rb', line 95 def bound_text_area(method, attrs = {}, &blk) yield(attrs) if block_given? super end |
#button(contents, attrs = {}) {|attrs| ... } ⇒ Object
100 101 102 103 |
# File 'lib/merb-sexy-forms/builder.rb', line 100 def (contents, attrs = {}) yield(attrs) if block_given? wrap_with_container(attrs, super(contents, clean_args!(attrs))) end |
#form(attrs = {}, &blk) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/merb-sexy-forms/builder.rb', line 4 def form(attrs = {}, &blk) add_css_class(attrs, "sexy") super(attrs) do captured = @origin.capture(&blk) add_main_container(captured, attrs) end end |
#submit(value, attrs = {}) {|attrs| ... } ⇒ Object
105 106 107 108 |
# File 'lib/merb-sexy-forms/builder.rb', line 105 def submit(value, attrs = {}) yield(attrs) if block_given? wrap_with_container(attrs, super(value, clean_args!(attrs))) end |
#unbound_check_box(attrs = {}) {|attrs| ... } ⇒ Object
44 45 46 47 48 49 |
# File 'lib/merb-sexy-forms/builder.rb', line 44 def unbound_check_box(attrs = {}) yield(attrs) if block_given? (attrs, "radio") wrap_with_container(attrs.merge(:label => nil), super(clean_args!(attrs))) end |
#unbound_radio_button(attrs = {}) {|attrs| ... } ⇒ Object
56 57 58 59 60 61 |
# File 'lib/merb-sexy-forms/builder.rb', line 56 def (attrs = {}) yield(attrs) if block_given? (attrs, "radio") wrap_with_container(attrs.merge(:label => nil), super(clean_args!(attrs))) end |
#unbound_radio_group(arr, global_attrs = {}) {|attrs| ... } ⇒ Object
74 75 76 77 |
# File 'lib/merb-sexy-forms/builder.rb', line 74 def unbound_radio_group(arr, global_attrs = {}) yield(attrs) if block_given? wrap_with_container(global_attrs, super(arr)) end |
#unbound_select(attrs = {}) {|attrs| ... } ⇒ Object
79 80 81 82 |
# File 'lib/merb-sexy-forms/builder.rb', line 79 def unbound_select(attrs = {}) yield(attrs) if block_given? wrap_with_container(attrs, super(clean_args!(attrs))) end |
#unbound_text_area(contents, attrs = {}) {|attrs| ... } ⇒ Object
89 90 91 92 93 |
# File 'lib/merb-sexy-forms/builder.rb', line 89 def unbound_text_area(contents, attrs = {}) yield(attrs) if block_given? label = attrs.delete(:label) wrap_with_container(attrs.merge(:label => label), super(clean_args!(attrs))) end |
#wrap_with_container(attrs = {}, content = "") ⇒ Object
21 22 23 24 25 26 |
# File 'lib/merb-sexy-forms/builder.rb', line 21 def wrap_with_container(attrs = {}, content = "") content = add_html_to_field(content, attrs) content = add_field_wrapper(content, attrs) content = add_main_label(content, attrs) content = add_container(content, attrs) end |