Sha256: 7494a81c3ad487f49d7a79118b52f6aaaf612081c847e1c0ee448d1fed3e70e0

Contents?: true

Size: 885 Bytes

Versions: 28

Compression:

Stored size: 885 Bytes

Contents

module Locomotive
  module Liquid
    module Tags
      class InheritedBlock < ::Liquid::InheritedBlock

        def end_tag
          super

          if !self.contains_super?(@nodelist) # then disable all editable_elements coming from the parent block too and not used
            @context[:page].disable_parent_editable_elements(@name) unless @context[:page].nil?
          end
        end

        protected

        def contains_super?(nodelist)
          nodelist.any? do |node|
            if node.is_a?(::Liquid::Variable) && node.name == 'block.super'
              true
            elsif node.respond_to?(:nodelist) && !node.nodelist.nil? && !node.is_a?(Locomotive::Liquid::Tags::InheritedBlock)
              contains_super?(node.nodelist)
            end
          end
        end

      end

      ::Liquid::Template.register_tag('block', InheritedBlock)
    end
  end
end

Version data entries

28 entries across 28 versions & 2 rubygems

Version Path
locomotive_cms-2.5.7 lib/locomotive/liquid/tags/inherited_block.rb
locomotivecms-3.0.0.pre.alpha.2 lib/locomotive/previous_liquid/tags/inherited_block.rb
locomotivecms-3.0.0.pre.alpha lib/locomotive/previous_liquid/tags/inherited_block.rb
locomotive_cms-2.5.6 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-2.5.6.rc2 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-2.5.6.rc1 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-2.5.5 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-2.5.4 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-2.5.3 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-2.5.2 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-2.5.1 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-2.5.0 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-2.5.0.rc3 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-2.5.0.rc2 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-2.5.0.rc1 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-2.4.1 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-2.4.0 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-2.3.1 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-2.3.0 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-2.2.3 lib/locomotive/liquid/tags/inherited_block.rb