Sha256: 5df8b736099044664cd34d4f162a37be5e3c8877f6d0449ad16e5fbd6b027d3f

Contents?: true

Size: 1.15 KB

Versions: 11

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

module Katalyst
  module Content
    module Editor
      class List < Base
        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

        def build(options, &_block)
          tag.ol **default_options(id: container_form_id, **options) do
            yield self
          end
        end

        def items(*items)
          render partial:    "katalyst/content/editor/item",
                 layout:     "katalyst/content/editor/list_item",
                 collection: items,
                 as:         :item
        end

        private

        def default_options(options)
          add_option(options, :data, :controller, LIST_CONTROLLER)
          add_option(options, :data, :action, ACTIONS)
          add_option(options, :data, :"#{CONTAINER_CONTROLLER}_target", "container")

          options
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
katalyst-content-1.1.1 app/helpers/katalyst/content/editor/list.rb
katalyst-content-1.1.0 app/helpers/katalyst/content/editor/list.rb
katalyst-content-1.0.2 app/helpers/katalyst/content/editor/list.rb
katalyst-content-1.0.1 app/helpers/katalyst/content/editor/list.rb
katalyst-content-1.0.0 app/helpers/katalyst/content/editor/list.rb
katalyst-content-0.2.2 app/helpers/katalyst/content/editor/list.rb
katalyst-content-0.2.1 app/helpers/katalyst/content/editor/list.rb
katalyst-content-0.2.0 app/helpers/katalyst/content/editor/list.rb
katalyst-content-0.1.2 app/helpers/katalyst/content/editor/list.rb
katalyst-content-0.1.1 app/helpers/katalyst/content/editor/list.rb
katalyst-content-0.1.0 app/helpers/katalyst/content/editor/list.rb