Fix config meta page

This commit is contained in:
Thomas Reynolds 2015-08-05 13:37:03 -07:00
parent 1efe6a27c5
commit 0fba2ae2f6
4 changed files with 21 additions and 15 deletions

View file

@ -3,13 +3,14 @@ module Middleman
extend Forwardable
def_delegator :@app, :logger
def_delegators :@activated, :[]
def_delegators :@activated, :[], :each
def initialize(app)
@app = app
@activated = {}
manager = self
{
before_sitemap: :before_sitemap,
initialized: :before_configuration

View file

@ -106,7 +106,7 @@ module Middleman
# A flattened list of all extensions which are automatically activated
# @return [Array<Symbol>] A list of extension names which are automatically activated.
def auto_activated
@auto_activate.values.flat_map(&:name)
@auto_activate.values.map(&:to_a).flatten.map(&:name)
end
# @api private

View file

@ -61,9 +61,13 @@ module Middleman
def config(_)
global_config = @middleman.config.all_settings.map { |c| ConfigSetting.new(c) }
extension_config = {}
auto_activated_config = {}
@middleman.extensions.each do |ext_name, extension|
next if ::Middleman::Extension.auto_activated.include? ext_name
if ::Middleman::Extensions.auto_activated.include? ext_name
auto_activated_config[ext_name] = extension_options(extension)
next
end
if extension.is_a?(Hash)
# Multiple instance extension
@ -82,6 +86,7 @@ module Middleman
template('config.html.erb',
global_config: global_config,
extension_config: extension_config,
auto_activated_config: auto_activated_config,
registered_extensions: Middleman::Extensions.registered.dup)
end

View file

@ -29,22 +29,22 @@
<h2 id="extensions">Extensions</h2>
<ul class="extensions">
<% extension_config.each do |ext_name, configs| %>
<li>
<% registered_extensions.delete(ext_name) %>
<% [extension_config, auto_activated_config].each do |extensions| %>
<% extensions.each do |ext_name, configs| %>
<li>
<% registered_extensions.delete(ext_name) %>
<span class="extension active">:<%= ext_name %></span>
<span class="extension active">:<%= ext_name %></span>
<% if configs && !configs.empty? %>
<ul class="settings">
<% configs.each do |setting| %>
<li class="setting"><%= setting.render %></li>
<% if configs && !configs.empty? %>
<ul class="settings">
<% configs.each do |setting| %>
<li class="setting"><%= setting.render %></li>
<% end %>
</ul>
<% end %>
</ul>
</li>
<% end %>
</li>
<% end %>
<% registered_extensions.keys.each do |ext_name| %>