Removed wrap_layout
This commit is contained in:
parent
4ab88e6577
commit
f89a76747e
|
@ -1,6 +1,7 @@
|
|||
master
|
||||
===
|
||||
|
||||
* Removed `with_layout`. Use loops of `page` instead.
|
||||
* Removed Queryable Sitemap API
|
||||
* Removed `css_compressor` setting, use `activate :minify_css, :compressor =>` instead.
|
||||
* Removed `js_compressor` setting, use `activate :minify_javascript, :compressor =>` instead.
|
||||
|
|
|
@ -7,18 +7,6 @@ Feature: Custom layouts
|
|||
When I go to "/custom-layout.html"
|
||||
Then I should see "Custom Layout"
|
||||
|
||||
Scenario: Using with_layout block
|
||||
Given "/custom-layout.html" with_layout block has layout "custom"
|
||||
And the Server is running at "custom-layout-app2"
|
||||
When I go to "/custom-layout.html"
|
||||
Then I should see "Custom Layout"
|
||||
|
||||
Scenario: Using with_layout block with globs
|
||||
Given "/custom-*" with_layout block has layout "custom"
|
||||
And the Server is running at "custom-layout-app2"
|
||||
When I go to "/custom-layout.html"
|
||||
Then I should see "Custom Layout"
|
||||
|
||||
Scenario: Using custom :layout attribute with folders
|
||||
Given page "/custom-layout-dir/" has layout "custom"
|
||||
And the Server is running at "custom-layout-app2"
|
||||
|
|
|
@ -4,12 +4,3 @@ Given /^page "([^\"]*)" has layout "([^\"]*)"$/ do |url, layout|
|
|||
page(url, :layout => layout.to_sym)
|
||||
}
|
||||
end
|
||||
|
||||
Given /^"([^\"]*)" with_layout block has layout "([^\"]*)"$/ do |url, layout|
|
||||
@initialize_commands ||= []
|
||||
@initialize_commands << lambda {
|
||||
with_layout(layout.to_sym) do
|
||||
page(url)
|
||||
end
|
||||
}
|
||||
end
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
with_layout false do
|
||||
%w{
|
||||
/auto-css.html
|
||||
/auto-css
|
||||
/auto-css/
|
||||
/auto-css/auto-css.html
|
||||
/auto-css/sub/auto-css.html
|
||||
}.each do |path|
|
||||
page path
|
||||
end
|
||||
%w{
|
||||
/auto-css.html
|
||||
/auto-css
|
||||
/auto-css/
|
||||
/auto-css/auto-css.html
|
||||
/auto-css/sub/auto-css.html
|
||||
}.each do |path|
|
||||
page path, layout: false
|
||||
end
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
with_layout false do
|
||||
%w{
|
||||
/auto-js.html
|
||||
/auto-js
|
||||
/auto-js/
|
||||
/auto-js/auto-js.html
|
||||
/auto-js/sub/auto-js.html
|
||||
}.each do |path|
|
||||
page path
|
||||
end
|
||||
%w{
|
||||
/auto-js.html
|
||||
/auto-js
|
||||
/auto-js/
|
||||
/auto-js/auto-js.html
|
||||
/auto-js/sub/auto-js.html
|
||||
}.each do |path|
|
||||
page path, layout: false
|
||||
end
|
||||
|
|
|
@ -1,4 +1,2 @@
|
|||
with_layout false do
|
||||
page "/data.html"
|
||||
page "/data3.html"
|
||||
end
|
||||
page "/data.html", layout: false
|
||||
page "/data3.html", layout: false
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
require "slim"
|
||||
|
||||
with_layout :capture_html do
|
||||
page "/capture_html_erb.html"
|
||||
page "/capture_html_haml.html"
|
||||
page "/capture_html_slim.html"
|
||||
end
|
||||
page "/capture_html_erb.html", layout: :capture_html
|
||||
page "/capture_html_haml.html", layout: :capture_html
|
||||
page "/capture_html_slim.html", layout: :capture_html
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
require "slim"
|
||||
|
||||
with_layout :content_for do
|
||||
page "/content_for_erb.html"
|
||||
page "/content_for_haml.html"
|
||||
page "/content_for_slim.html"
|
||||
end
|
||||
page "/content_for_erb.html", layout: :content_for
|
||||
page "/content_for_haml.html", layout: :content_for
|
||||
page "/content_for_slim.html", layout: :content_for
|
||||
|
|
|
@ -22,11 +22,6 @@
|
|||
#
|
||||
# With alternative layout
|
||||
# page "/path/to/file.html", :layout => :otherlayout
|
||||
#
|
||||
# A path which all have the same layout
|
||||
# with_layout :admin do
|
||||
# page "/admin/*"
|
||||
# end
|
||||
|
||||
# Proxy (fake) files
|
||||
# page "/this-page-has-no-template.html", :proxy => "/template-file.html" do
|
||||
|
|
|
@ -1,3 +1 @@
|
|||
with_layout false do
|
||||
page "/spaces in file.html"
|
||||
end
|
||||
page "/spaces in file.html", layout: false
|
||||
|
|
|
@ -1,4 +1,2 @@
|
|||
with_layout false do
|
||||
page "/sub1/page-classes.html"
|
||||
page "/sub1/sub2/page-classes.html"
|
||||
end
|
||||
page "/sub1/page-classes.html", layout: false
|
||||
page "/sub1/sub2/page-classes.html", layout: false
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module Middleman
|
||||
class ConfigContext
|
||||
# with_layout and page routing
|
||||
# page routing
|
||||
include Middleman::CoreExtensions::Routing
|
||||
|
||||
attr_reader :app
|
||||
|
|
|
@ -2,36 +2,6 @@
|
|||
module Middleman
|
||||
module CoreExtensions
|
||||
module Routing
|
||||
# Sandboxed layout to implement temporary overriding of layout.
|
||||
class LayoutBlock
|
||||
attr_reader :scope
|
||||
|
||||
def initialize(scope, layout_name)
|
||||
@scope = scope
|
||||
@layout_name = layout_name
|
||||
end
|
||||
|
||||
def page(url, opts={})
|
||||
opts[:layout] ||= @layout_name
|
||||
@scope.page(url, opts)
|
||||
end
|
||||
|
||||
delegate :proxy, to: :scope
|
||||
end
|
||||
|
||||
# Takes a block which allows many pages to have the same layout
|
||||
#
|
||||
# with_layout :admin do
|
||||
# page "/admin/"
|
||||
# page "/admin/login.html"
|
||||
# end
|
||||
#
|
||||
# @param [String, Symbol] layout_name
|
||||
# @return [void]
|
||||
def with_layout(layout_name, &block)
|
||||
LayoutBlock.new(self, layout_name).instance_eval(&block)
|
||||
end
|
||||
|
||||
# The page method allows the layout to be set on a specific path
|
||||
#
|
||||
# page "/about.html", :layout => false
|
||||
|
|
|
@ -20,11 +20,6 @@ page '/*.txt', layout: false
|
|||
#
|
||||
# With alternative layout
|
||||
# page "/path/to/file.html", :layout => :otherlayout
|
||||
#
|
||||
# A path which all have the same layout
|
||||
# with_layout :admin do
|
||||
# page "/admin/*"
|
||||
# end
|
||||
|
||||
# Proxy pages (http://middlemanapp.com/basics/dynamic-pages/)
|
||||
# proxy "/this-page-has-no-template.html", "/template-file.html", :locals => {
|
||||
|
|
Loading…
Reference in a new issue