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 extend Forwardable
def_delegator :@app, :logger def_delegator :@app, :logger
def_delegators :@activated, :[] def_delegators :@activated, :[], :each
def initialize(app) def initialize(app)
@app = app @app = app
@activated = {} @activated = {}
manager = self manager = self
{ {
before_sitemap: :before_sitemap, before_sitemap: :before_sitemap,
initialized: :before_configuration initialized: :before_configuration

View file

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

View file

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

View file

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