mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Don't pass block binding to concat
This commit is contained in:
parent
0bdb7d353b
commit
4d4c8e298f
8 changed files with 21 additions and 31 deletions
|
@ -257,7 +257,7 @@ If you are rendering a subtemplate, you must now use controller-like partial syn
|
|||
if partial_layout = options.delete(:layout)
|
||||
if block_given?
|
||||
wrap_content_for_layout capture(&block) do
|
||||
concat(render(options.merge(:partial => partial_layout)), block.binding)
|
||||
concat(render(options.merge(:partial => partial_layout)))
|
||||
end
|
||||
else
|
||||
wrap_content_for_layout render(options) do
|
||||
|
|
|
@ -249,9 +249,9 @@ module ActionView
|
|||
args.unshift object
|
||||
end
|
||||
|
||||
concat(form_tag(options.delete(:url) || {}, options.delete(:html) || {}), proc.binding)
|
||||
concat(form_tag(options.delete(:url) || {}, options.delete(:html) || {}))
|
||||
fields_for(object_name, *(args << options), &proc)
|
||||
concat('</form>', proc.binding)
|
||||
concat('</form>')
|
||||
end
|
||||
|
||||
def apply_form_for_options!(object_or_array, options) #:nodoc:
|
||||
|
|
|
@ -407,10 +407,10 @@ module ActionView
|
|||
# # => <fieldset><legend>Your details</legend><p><input id="name" name="name" type="text" /></p></fieldset>
|
||||
def field_set_tag(legend = nil, &block)
|
||||
content = capture(&block)
|
||||
concat(tag(:fieldset, {}, true), block.binding)
|
||||
concat(content_tag(:legend, legend), block.binding) unless legend.blank?
|
||||
concat(content, block.binding)
|
||||
concat("</fieldset>", block.binding)
|
||||
concat(tag(:fieldset, {}, true))
|
||||
concat(content_tag(:legend, legend)) unless legend.blank?
|
||||
concat(content)
|
||||
concat("</fieldset>")
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -442,9 +442,9 @@ module ActionView
|
|||
|
||||
def form_tag_in_block(html_options, &block)
|
||||
content = capture(&block)
|
||||
concat(form_tag_html(html_options), block.binding)
|
||||
concat(content, block.binding)
|
||||
concat("</form>", block.binding)
|
||||
concat(form_tag_html(html_options))
|
||||
concat(content)
|
||||
concat("</form>")
|
||||
end
|
||||
|
||||
def token_tag
|
||||
|
|
|
@ -179,13 +179,7 @@ module ActionView
|
|||
content = content_or_options_with_block
|
||||
end
|
||||
|
||||
javascript_tag = content_tag("script", javascript_cdata_section(content), html_options.merge(:type => Mime::JS))
|
||||
|
||||
if block_given? && block_is_within_action_view?(block)
|
||||
concat(javascript_tag, block.binding)
|
||||
else
|
||||
javascript_tag
|
||||
end
|
||||
concat(content_tag("script", javascript_cdata_section(content), html_options.merge(:type => Mime::JS)))
|
||||
end
|
||||
|
||||
def javascript_cdata_section(content) #:nodoc:
|
||||
|
|
|
@ -382,9 +382,9 @@ module ActionView
|
|||
args.unshift object
|
||||
end
|
||||
|
||||
concat(form_remote_tag(options), proc.binding)
|
||||
concat(form_remote_tag(options))
|
||||
fields_for(object_name, *(args << options), &proc)
|
||||
concat('</form>', proc.binding)
|
||||
concat('</form>')
|
||||
end
|
||||
alias_method :form_remote_for, :remote_form_for
|
||||
|
||||
|
|
|
@ -51,8 +51,7 @@ module ActionView
|
|||
prefix = args.first.is_a?(Hash) ? nil : args.shift
|
||||
options = args.first.is_a?(Hash) ? args.shift : {}
|
||||
concat content_tag(tag_name, capture(&block),
|
||||
options.merge({ :class => "#{dom_class(record)} #{options[:class]}".strip, :id => dom_id(record, prefix) })),
|
||||
block.binding
|
||||
options.merge({ :class => "#{dom_class(record)} #{options[:class]}".strip, :id => dom_id(record, prefix) }))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -66,12 +66,9 @@ module ActionView
|
|||
def content_tag(name, content_or_options_with_block = nil, options = nil, escape = true, &block)
|
||||
if block_given?
|
||||
options = content_or_options_with_block if content_or_options_with_block.is_a?(Hash)
|
||||
content = capture(&block)
|
||||
content_tag = content_tag_string(name, content, options, escape)
|
||||
block_is_within_action_view?(block) ? concat(content_tag, block.binding) : content_tag
|
||||
concat(content_tag_string(name, capture(&block), options, escape))
|
||||
else
|
||||
content = content_or_options_with_block
|
||||
content_tag_string(name, content, options, escape)
|
||||
content_tag_string(name, content_or_options_with_block, options, escape)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -15,17 +15,17 @@ module ActionView
|
|||
#
|
||||
# ==== Examples
|
||||
# <%
|
||||
# concat "hello", binding
|
||||
# concat "hello"
|
||||
# # is the equivalent of <%= "hello" %>
|
||||
#
|
||||
# if (logged_in == true):
|
||||
# concat "Logged in!", binding
|
||||
# concat "Logged in!"
|
||||
# else
|
||||
# concat link_to('login', :action => login), binding
|
||||
# concat link_to('login', :action => login)
|
||||
# end
|
||||
# # will either display "Logged in!" or a login link
|
||||
# %>
|
||||
def concat(string, binding = nil)
|
||||
def concat(string)
|
||||
if @output_buffer
|
||||
@output_buffer << string
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue