mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Actual form_for stuff... the first was just the tests :p.
git-svn-id: svn://hamptoncatlin.com/haml/trunk@321 7063305b-7217-0410-af8c-cdc13e5119b9
This commit is contained in:
parent
34651f048c
commit
bf011098e4
1 changed files with 18 additions and 1 deletions
|
@ -12,6 +12,8 @@ if action_view_included
|
|||
class ActionView::Base
|
||||
alias_method :old_concat, :concat unless instance_methods.include? "old_concat"
|
||||
alias_method :old_form_tag, :form_tag unless instance_methods.include? "old_form_tag"
|
||||
|
||||
alias_method :old_form_for, :form_for unless instance_methods.include? "old_form_for"
|
||||
end
|
||||
|
||||
module Haml
|
||||
|
@ -49,7 +51,22 @@ if action_view_included
|
|||
tab_down
|
||||
end
|
||||
end
|
||||
old_form_tag(url_for_options, options, *parameters_for_url, &proc)
|
||||
res = old_form_tag(url_for_options, options, *parameters_for_url, &proc) + "\n"
|
||||
concat "\n" if block_given? && is_haml?
|
||||
res
|
||||
end
|
||||
|
||||
def form_for(object_name, *args, &proc)
|
||||
if block_given? && is_haml?
|
||||
oldproc = proc
|
||||
proc = bind_proc do |*args|
|
||||
tab_up
|
||||
oldproc.call(*args)
|
||||
tab_down
|
||||
end
|
||||
end
|
||||
old_form_for(object_name, *args, &proc)
|
||||
concat "\n" if block_given? && is_haml?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue