Sha256: 8544f5a88265ca254de536c29f07b729be241c94d3f48c13764a27068c56c2db

Contents?: true

Size: 1007 Bytes

Versions: 5

Compression:

Stored size: 1007 Bytes

Contents

# frozen_string_literal: true

module Katalyst
  module Content
    module Editor
      class TableComponent < BaseComponent
        ACTIONS = <<~ACTIONS.gsub(/\s+/, " ").freeze
          dragstart->#{LIST_CONTROLLER}#dragstart
          dragover->#{LIST_CONTROLLER}#dragover
          dragenter->#{LIST_CONTROLLER}#dragenter
          dragleave->#{LIST_CONTROLLER}#dragleave
          drop->#{LIST_CONTROLLER}#drop
          dragend->#{LIST_CONTROLLER}#dragend
        ACTIONS

        renders_many :items, ->(item) do
          row = RowComponent.new(item:, container:)
          row.with_content(render(ItemComponent.new(item:, container:)))
          row
        end

        private

        def default_html_attributes
          {
            data: {
              controller:                       LIST_CONTROLLER,
              action:                           ACTIONS,
              "#{CONTAINER_CONTROLLER}_target": "container",
            },
          }
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
katalyst-content-2.1.2 app/components/katalyst/content/editor/table_component.rb
katalyst-content-2.1.1 app/components/katalyst/content/editor/table_component.rb
katalyst-content-2.1.0 app/components/katalyst/content/editor/table_component.rb
katalyst-content-2.0.1 app/components/katalyst/content/editor/table_component.rb
katalyst-content-2.0.0 app/components/katalyst/content/editor/table_component.rb