Fix extension configs meta page to correctly handle multiple instance extensions like blog
This commit is contained in:
parent
5604fa1a8b
commit
fc20a761de
|
@ -60,14 +60,24 @@ module Middleman
|
||||||
# Inspect configuration
|
# Inspect configuration
|
||||||
def config(env)
|
def config(env)
|
||||||
global_config = @middleman.inst.config.all_settings.map {|c| ConfigSetting.new(c) }
|
global_config = @middleman.inst.config.all_settings.map {|c| ConfigSetting.new(c) }
|
||||||
extension_config = Hash[@middleman.inst.extensions.map do |ext_name, extension|
|
extension_config = {}
|
||||||
opts = if extension.is_a?(::Middleman::Extension)
|
|
||||||
extension.options.all_settings.map {|c| ConfigSetting.new(c) }
|
@middleman.inst.extensions.each do |ext_name, extension|
|
||||||
else
|
if extension.is_a?(Hash)
|
||||||
nil
|
# Multiple instance extension
|
||||||
end
|
if extension.size == 1
|
||||||
[ext_name, opts]
|
extension_config[ext_name] = extension_options(extension.values.first)
|
||||||
end]
|
else
|
||||||
|
extension.each do |inst, ext|
|
||||||
|
extension_config["#{ext_name} (#{inst})"] = extension_options(ext)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elsif extension.is_a?(::Middleman::Extension)
|
||||||
|
extension_config[ext_name] = extension_options(extension)
|
||||||
|
else
|
||||||
|
extension_config[ext_name] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
template('config.html.erb',
|
template('config.html.erb',
|
||||||
:global_config => global_config,
|
:global_config => global_config,
|
||||||
|
@ -88,6 +98,10 @@ module Middleman
|
||||||
def response(content)
|
def response(content)
|
||||||
[ 200, {"Content-Type" => "text/html"}, Array(content) ]
|
[ 200, {"Content-Type" => "text/html"}, Array(content) ]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def extension_options(extension)
|
||||||
|
extension.options.all_settings.map {|c| ConfigSetting.new(c) }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
<li>
|
<li>
|
||||||
<% registered_extensions.delete(ext_name) %>
|
<% registered_extensions.delete(ext_name) %>
|
||||||
|
|
||||||
<span class="extension active"><%= ext_name.inspect %></span>
|
<span class="extension active">:<%= ext_name %></span>
|
||||||
|
|
||||||
|
|
||||||
<% if configs && !configs.empty? %>
|
<% if configs && !configs.empty? %>
|
||||||
|
@ -55,5 +55,3 @@
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue