2014-03-26 08:12:10 +01:00
|
|
|
require 'pp'
|
|
|
|
|
2013-04-14 02:10:00 +02:00
|
|
|
module Middleman
|
|
|
|
module MetaPages
|
|
|
|
# View class for a config entry
|
|
|
|
class ConfigSetting
|
|
|
|
include Padrino::Helpers::OutputHelpers
|
|
|
|
include Padrino::Helpers::TagHelpers
|
|
|
|
|
|
|
|
def initialize(setting)
|
|
|
|
@setting = setting
|
|
|
|
end
|
|
|
|
|
|
|
|
def render
|
2013-12-28 01:26:31 +01:00
|
|
|
content = ''
|
2013-04-14 02:10:00 +02:00
|
|
|
key_classes = ['key']
|
|
|
|
key_classes << 'modified' if @setting.value_set?
|
2014-03-26 08:12:10 +01:00
|
|
|
content << content_tag(:span, @setting.key.pretty_inspect.strip, :class => key_classes.join(' '))
|
2013-12-28 01:26:31 +01:00
|
|
|
content << ' = '
|
2014-03-26 08:12:10 +01:00
|
|
|
content << content_tag(:span, @setting.value.pretty_inspect.strip, :class => 'value')
|
|
|
|
if @setting.default && @setting.value_set? && @setting.default != @setting.value
|
2013-04-14 02:10:00 +02:00
|
|
|
content << content_tag(:span, :class => 'default') do
|
2014-03-26 08:12:10 +01:00
|
|
|
"(Default: #{@setting.default.inspect})"
|
2013-04-14 02:10:00 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if @setting.description
|
|
|
|
content << content_tag(:p, :class => 'description') do
|
2014-03-26 08:12:10 +01:00
|
|
|
@setting.description
|
2013-04-14 02:10:00 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
content
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|