Sha256: 5519c041bebc505a3184e1c040ea3916092dbafd4001003ca5ceb8cc06e0c03d

Contents?: true

Size: 896 Bytes

Versions: 17

Compression:

Stored size: 896 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

17 entries across 17 versions & 2 rubygems

Version Path
locomotive_cms-2.0.3 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-2.0.2 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-2.0.1 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-2.0.0 lib/locomotive/liquid/tags/inherited_block.rb
tribeca_cms-0.1.1 lib/locomotive/liquid/tags/inherited_block.rb
tribeca_cms-2.0.0.rc12 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-2.0.0.rc12 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-2.0.0.rc11 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-2.0.0.rc10 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-2.0.0.rc9 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-2.0.0.rc8 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-2.0.0.rc7 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-2.0.0.rc6 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-2.0.0.rc5 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-2.0.0.rc4 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-2.0.0.rc2 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-2.0.0.rc1 lib/locomotive/liquid/tags/inherited_block.rb