Sha256: 9dc7e39b97a7a7743000d38708530fd6f6dcfd8d0416f113fffb582c058e8ab3

Contents?: true

Size: 1.02 KB

Versions: 68

Compression:

Stored size: 1.02 KB

Contents

require 'pp'

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
        content = ''
        key_classes = ['key']
        key_classes << 'modified' if @setting.value_set?
        content << content_tag(:span, @setting.key.pretty_inspect.strip, class: key_classes.join(' '))
        content << ' = '
        content << content_tag(:span, @setting.value.pretty_inspect.strip, class: 'value')
        if @setting.default && @setting.value_set? && @setting.default != @setting.value
          content << content_tag(:span, class: 'default') do
            "(Default: #{@setting.default.inspect})"
          end
        end

        if @setting.description
          content << content_tag(:p, class: 'description') do
            @setting.description
          end
        end

        content
      end
    end
  end
end

Version data entries

68 entries across 68 versions & 4 rubygems

Version Path
middleman-core-4.5.1 lib/middleman-core/meta_pages/config_setting.rb
middleman-core-4.5.0 lib/middleman-core/meta_pages/config_setting.rb
middleman-core-4.4.3 lib/middleman-core/meta_pages/config_setting.rb
middleman-core-4.4.2 lib/middleman-core/meta_pages/config_setting.rb
middleman-core-4.4.0 lib/middleman-core/meta_pages/config_setting.rb
middleman-core-4.3.11 lib/middleman-core/meta_pages/config_setting.rb
middleman-core-4.3.10 lib/middleman-core/meta_pages/config_setting.rb
middleman-core-4.3.8 lib/middleman-core/meta_pages/config_setting.rb
middleman-core-4.3.7 lib/middleman-core/meta_pages/config_setting.rb
files.com-1.0.55 docs/vendor/bundle/ruby/2.5.0/gems/middleman-core-4.3.3/lib/middleman-core/meta_pages/config_setting.rb
middleman-core-4.3.6 lib/middleman-core/meta_pages/config_setting.rb
middleman-core-4.3.5 lib/middleman-core/meta_pages/config_setting.rb
middleman-core-5.0.0.rc.1 lib/middleman-core/meta_pages/config_setting.rb
middleman-core-4.3.4 lib/middleman-core/meta_pages/config_setting.rb
middleman-core-4.3.3 lib/middleman-core/meta_pages/config_setting.rb
middleman-core-4.3.2 lib/middleman-core/meta_pages/config_setting.rb
middleman-core-4.3.1 lib/middleman-core/meta_pages/config_setting.rb
middleman-core-4.3.0 lib/middleman-core/meta_pages/config_setting.rb
middleman-core-4.3.0.rc.4 lib/middleman-core/meta_pages/config_setting.rb
middleman-core-4.3.0.rc.3 lib/middleman-core/meta_pages/config_setting.rb