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
|
||||
def config(env)
|
||||
global_config = @middleman.inst.config.all_settings.map {|c| ConfigSetting.new(c) }
|
||||
extension_config = Hash[@middleman.inst.extensions.map do |ext_name, extension|
|
||||
opts = if extension.is_a?(::Middleman::Extension)
|
||||
extension.options.all_settings.map {|c| ConfigSetting.new(c) }
|
||||
else
|
||||
nil
|
||||
end
|
||||
[ext_name, opts]
|
||||
end]
|
||||
extension_config = {}
|
||||
|
||||
@middleman.inst.extensions.each do |ext_name, extension|
|
||||
if extension.is_a?(Hash)
|
||||
# Multiple instance extension
|
||||
if extension.size == 1
|
||||
extension_config[ext_name] = extension_options(extension.values.first)
|
||||
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',
|
||||
:global_config => global_config,
|
||||
|
@ -88,6 +98,10 @@ module Middleman
|
|||
def response(content)
|
||||
[ 200, {"Content-Type" => "text/html"}, Array(content) ]
|
||||
end
|
||||
|
||||
def extension_options(extension)
|
||||
extension.options.all_settings.map {|c| ConfigSetting.new(c) }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
<li>
|
||||
<% registered_extensions.delete(ext_name) %>
|
||||
|
||||
<span class="extension active"><%= ext_name.inspect %></span>
|
||||
<span class="extension active">:<%= ext_name %></span>
|
||||
|
||||
|
||||
<% if configs && !configs.empty? %>
|
||||
|
@ -55,5 +55,3 @@
|
|||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue