Add extensions to meta config page

This commit is contained in:
Ben Hollis 2013-04-12 22:56:07 -07:00
parent 2d4668f524
commit 774361bf89
2 changed files with 45 additions and 5 deletions

View file

@ -45,7 +45,7 @@ module Middleman
# Inspect the sitemap
def sitemap(env)
resources = @middleman.sitemap.resources(true)
resources = @middleman.inst.sitemap.resources(true)
sitemap_tree = SitemapTree.new
@ -58,7 +58,8 @@ module Middleman
# Inspect configuration
def config(env)
template('config.html.erb', :config => @middleman.config)
template('config.html.erb', :config => @middleman.inst.config, :extensions => @middleman.inst.extensions, :registered_extensions => Middleman::Extensions.registered.dup)
end
private

View file

@ -10,10 +10,11 @@
<h1>Middleman Config</h1>
<a href="../">More meta pages</a>
<h2>Core Configuration</h2>
<ul>
<% config.all_settings.each do |setting| %>
<li>
<b><%= setting.key %></b>:
<b><%= setting.key.inspect %></b>:
<%= setting.value.inspect %>
<% if setting.value_set? %>
<br>
@ -26,6 +27,44 @@
</li>
<% end %>
</ul>
<h2>Extensions</h2>
<ul>
<% extensions.each do |ext_name, extension| %>
<li>
<% registered_extensions.delete(ext_name) %>
<b><%= ext_name.inspect %></b> (Active)
<% if extension.is_a?(::Middleman::Extension) && !extension.options.all_settings.empty? %>
<br>
<b>Options:</b>
<br>
<ul>
<% extension.options.all_settings.each do |setting| %>
<li>
<b><%= setting.key.inspect %></b>:
<%= setting.value.inspect %>
<% if setting.value_set? %>
<br>
Default: <%= setting.default.inspect %>
<% else %>
(Default)
<% end %>
<br>
<i><%= setting.description %></i>
</li>
<% end %>
</ul>
<% end %>
</li>
<% end %>
<% registered_extensions.keys.each do |ext_name| %>
<li><b><%= ext_name.inspect %></b> (Inactive)</li>
<% end %>
</ul>
</body>
</html>