Sha256: 7ae4e827329d801333f786a9b85decd3461bd70f35e1449842068348a274023c

Contents?: true

Size: 868 Bytes

Versions: 14

Compression:

Stored size: 868 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)
          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

14 entries across 14 versions & 1 rubygems

Version Path
locomotive_cms-1.0.0.beta.2 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-1.0.0.beta lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-0.0.4.beta12 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-0.0.4.beta11 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-0.0.4.beta10 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-0.0.4.beta9 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-0.0.4.beta8 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-0.0.4.beta7 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-0.0.4.beta5 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-0.0.4.beta4 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-0.0.4.beta3 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-0.0.4.beta2 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-0.0.4.beta1 lib/locomotive/liquid/tags/inherited_block.rb
locomotive_cms-0.0.4 lib/locomotive/liquid/tags/inherited_block.rb