commit
223cf09c8f
|
@ -28,3 +28,8 @@ Feature: Provide Sane Defaults for Partial Behavior
|
||||||
Given the Server is running at "partials-app"
|
Given the Server is running at "partials-app"
|
||||||
When I go to "/sub/index.html"
|
When I go to "/sub/index.html"
|
||||||
Then I should see "Local Partial"
|
Then I should see "Local Partial"
|
||||||
|
|
||||||
|
Scenario: Partials can be passed locals
|
||||||
|
Given the Server is running at "partials-app"
|
||||||
|
When I go to "/locals.html"
|
||||||
|
Then I should see "Local var is bar"
|
1
fixtures/partials-app/source/_locals.erb
Normal file
1
fixtures/partials-app/source/_locals.erb
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Local var is <%= foo %>
|
1
fixtures/partials-app/source/locals.html.erb
Normal file
1
fixtures/partials-app/source/locals.html.erb
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<%= partial 'locals', :locals => { :foo => 'bar' } %>
|
|
@ -57,9 +57,11 @@ module Middleman::CoreExtensions::Rendering
|
||||||
end
|
end
|
||||||
|
|
||||||
# Sinatra/Padrino render method signature.
|
# Sinatra/Padrino render method signature.
|
||||||
def render(engine, data, options={}, locals={}, &block)
|
def render(engine, data, options={}, &block)
|
||||||
data = data.to_s
|
data = data.to_s
|
||||||
|
|
||||||
|
locals = options[:locals]
|
||||||
|
|
||||||
found_partial = false
|
found_partial = false
|
||||||
engine = nil
|
engine = nil
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue