Sha256: 44beb476f331f75f04c316b66ca518e9fe9f758c53c492a6e0644d5691e7946a

Contents?: true

Size: 987 Bytes

Versions: 8

Compression:

Stored size: 987 Bytes

Contents

module Locomotive
  module Steam
    module Liquid
      module Drops

        # Section block drop
        class SectionBlock < ::Liquid::Drop

          def initialize(section, block, index)
            @section    = section
            @block      = block || { 'settings' => {} }
            @index      = index
            @definition = section.definition['blocks'].find do |block|
              block['type'] == type
            end || {}
          end

          def id
            @block['id'] || @index
          end

          def type
            @block['type']
          end

          def settings
            @content_proxy ||= SectionContentProxy.new(
              @block['settings'] || {},
              @definition['settings'] || []
            )
          end

          def locomotive_attributes
            value = "section-#{@context['section'].id}-block-#{id}"
            %(data-locomotive-block="#{value}")
          end

        end

      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
locomotivecms_steam-1.5.3 lib/locomotive/steam/liquid/drops/section_block.rb
locomotivecms_steam-1.5.2 lib/locomotive/steam/liquid/drops/section_block.rb
locomotivecms_steam-1.5.1 lib/locomotive/steam/liquid/drops/section_block.rb
locomotivecms_steam-1.5.0 lib/locomotive/steam/liquid/drops/section_block.rb
locomotivecms_steam-1.5.0.rc1 lib/locomotive/steam/liquid/drops/section_block.rb
locomotivecms_steam-1.5.0.rc0 lib/locomotive/steam/liquid/drops/section_block.rb
locomotivecms_steam-1.5.0.beta3 lib/locomotive/steam/liquid/drops/section_block.rb
locomotivecms_steam-1.5.0.beta2 lib/locomotive/steam/liquid/drops/section_block.rb