Sha256: f19329c26a22a78470ff59bce5ef52884bf2fe79489b5c03ae02ed1839c1b4b7

Contents?: true

Size: 1.15 KB

Versions: 8

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

module Katalyst
  module Content
    module Editor
      class Base
        CONTAINER_CONTROLLER  = "content--editor--container"
        LIST_CONTROLLER       = "content--editor--list"
        ITEM_CONTROLLER       = "content--editor--item"
        STATUS_BAR_CONTROLLER = "content--editor--status-bar"
        NEW_ITEM_CONTROLLER   = "content--editor--new-item"

        TURBO_FRAME = "content--editor--item-frame"

        attr_accessor :template, :container

        delegate :config, to: ::Katalyst::Content
        delegate_missing_to :template

        def initialize(template, container)
          self.template  = template
          self.container = container
        end

        def container_form_id
          dom_id(container, :items)
        end

        def attributes_scope
          "#{container.model_name.param_key}[items_attributes][]"
        end

        private

        def add_option(options, key, *path)
          if path.length > 1
            add_option(options[key] ||= {}, *path)
          else
            options[key] = [options[key], *path].compact.join(" ")
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
katalyst-content-1.1.1 app/helpers/katalyst/content/editor/base.rb
katalyst-content-1.1.0 app/helpers/katalyst/content/editor/base.rb
katalyst-content-1.0.2 app/helpers/katalyst/content/editor/base.rb
katalyst-content-1.0.1 app/helpers/katalyst/content/editor/base.rb
katalyst-content-1.0.0 app/helpers/katalyst/content/editor/base.rb
katalyst-content-0.2.2 app/helpers/katalyst/content/editor/base.rb
katalyst-content-0.2.1 app/helpers/katalyst/content/editor/base.rb
katalyst-content-0.2.0 app/helpers/katalyst/content/editor/base.rb