Sha256: 3c63447ac0666dd07b485212b77301f8e3a07cb5381e2e4286c8cd90ff69b000

Contents?: true

Size: 826 Bytes

Versions: 17

Compression:

Stored size: 826 Bytes

Contents

module Locomotive
  module Steam
    module Liquid

      class Template < ::Liquid::Template

        # When we render a Locomotive template, we need to know what are
        # the default content of all the editable elements.
        # Without this, developers are unable to use statements like
        # the following: {{ page.editable_elements.content.header.title }}
        def render(*args)
          if args.first && args.first.is_a?(::Liquid::Context)
            content = @options[:default_editable_content]
            args.first.registers[:default_editable_content] = content
          end

          super
        end

        class << self

          def parse(source, options = {})
            template = new
            template.parse(source, options)
          end

        end

      end

    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
locomotivecms_steam-1.1.2 lib/locomotive/steam/liquid/template.rb
locomotivecms_steam-1.2.1 lib/locomotive/steam/liquid/template.rb
locomotivecms_steam-1.2.0 lib/locomotive/steam/liquid/template.rb
locomotivecms_steam-1.2.0.rc3 lib/locomotive/steam/liquid/template.rb
locomotivecms_steam-1.2.0.rc2 lib/locomotive/steam/liquid/template.rb
locomotivecms_steam-1.2.0.rc1 lib/locomotive/steam/liquid/template.rb
locomotivecms_steam-1.2.0.beta1 lib/locomotive/steam/liquid/template.rb
locomotivecms_steam-1.1.1 lib/locomotive/steam/liquid/template.rb
locomotivecms_steam-1.1.0 lib/locomotive/steam/liquid/template.rb
locomotivecms_steam-1.1.0.rc3 lib/locomotive/steam/liquid/template.rb
locomotivecms_steam-1.1.0.rc2 lib/locomotive/steam/liquid/template.rb
locomotivecms_steam-1.1.0.rc1 lib/locomotive/steam/liquid/template.rb
locomotivecms_steam-1.0.1 lib/locomotive/steam/liquid/template.rb
locomotivecms_steam-1.0.0 lib/locomotive/steam/liquid/template.rb
locomotivecms_steam-1.0.0.rc10 lib/locomotive/steam/liquid/template.rb
locomotivecms_steam-1.0.0.rc9 lib/locomotive/steam/liquid/template.rb
locomotivecms_steam-1.0.0.rc8 lib/locomotive/steam/liquid/template.rb