Class: Arbre::Rails::Forms::FormForProxy
Instance Attribute Summary
#form_builder
Instance Method Summary
collapse
#label, #respond_to_missing?, #select
Methods inherited from Component
#tag_name
Instance Method Details
#build(resource, form_options = {}, &block) ⇒ Object
46
47
48
49
50
51
52
53
|
# File 'lib/arbre/rails/forms.rb', line 46
def build(resource, form_options = {}, &block)
form_string = helpers.form_for(resource, form_options) do |f|
@form_builder = f
end
@opening_tag, @closing_tag = split_string_on(form_string, "</form>")
super(&block)
end
|
#closing_tag ⇒ Object
69
70
71
|
# File 'lib/arbre/rails/forms.rb', line 69
def closing_tag
@closing_tag || ""
end
|
#fields_for(*args, &block) ⇒ Object
55
56
57
|
# File 'lib/arbre/rails/forms.rb', line 55
def fields_for(*args, &block)
insert_tag FieldsForProxy, form_builder, *args, &block
end
|
#opening_tag ⇒ Object
65
66
67
|
# File 'lib/arbre/rails/forms.rb', line 65
def opening_tag
@opening_tag || ""
end
|
#split_string_on(string, match) ⇒ Object
59
60
61
62
63
|
# File 'lib/arbre/rails/forms.rb', line 59
def split_string_on(string, match)
return "" unless string && match
part_1 = string.split(Regexp.new("#{match}\\z")).first
[part_1, match]
end
|