Sha256: f00d00b23bbcc95dd5610a38a5951b2ae0dfbd5f15efaa8e64f7dc4c9bbe67d0

Contents?: true

Size: 601 Bytes

Versions: 24

Compression:

Stored size: 601 Bytes

Contents

# frozen_string_literal: true

module Maglev
  module Content
    class CollectionItem < Base
      def exists?
        item.present?
      end

      def to_s
        item.inspect
      end

      def item
        (content || {})[:item]
      end

      def tag(view_context, options = {}, &block)
        return unless item && block_given?

        view_context.tag.public_send(
          options.delete(:html_tag)&.to_sym || :div,
          view_context.capture(item, &block),
          **{ data: (options.delete(:data) || {}).merge(tag_data) }.merge(options)
        )
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
maglevcms-1.7.3 app/components/maglev/content/collection_item.rb
maglevcms-1.7.2 app/components/maglev/content/collection_item.rb
maglevcms-1.7.1 app/components/maglev/content/collection_item.rb
maglevcms-1.7.0 app/components/maglev/content/collection_item.rb
maglevcms-1.6.1 app/components/maglev/content/collection_item.rb
maglevcms-1.6.0 app/components/maglev/content/collection_item.rb
maglevcms-1.5.1 app/components/maglev/content/collection_item.rb
maglevcms-1.4.0 app/components/maglev/content/collection_item.rb
maglevcms-1.3.0 app/components/maglev/content/collection_item.rb
maglevcms-1.2.2 app/components/maglev/content/collection_item.rb
maglevcms-1.2.1 app/components/maglev/content/collection_item.rb
maglevcms-1.2.0 app/components/maglev/content/collection_item.rb
maglevcms-1.1.7 app/components/maglev/content/collection_item.rb
maglevcms-1.1.6 app/components/maglev/content/collection_item.rb
maglevcms-1.1.5 app/components/maglev/content/collection_item.rb
maglevcms-1.1.4 app/components/maglev/content/collection_item.rb
maglevcms-1.1.3 app/components/maglev/content/collection_item.rb
maglevcms-1.1.2 app/components/maglev/content/collection_item.rb
maglevcms-1.1.1 app/components/maglev/content/collection_item.rb
maglevcms-1.1.0 app/components/maglev/content/collection_item.rb