Sha256: d03aad9e4f8505556ea05607c9e7f4017a1e462c3b07411e28300394a930b3fe

Contents?: true

Size: 1.24 KB

Versions: 10

Compression:

Stored size: 1.24 KB

Contents

# frozen_string_literal: true

module Katalyst
  module Content
    class EditorComponent < Editor::BaseComponent
      ACTIONS = <<~ACTIONS.gsub(/\s+/, " ").freeze
        submit->#{CONTAINER_CONTROLLER}#reindex
        content:drop->#{CONTAINER_CONTROLLER}#drop
        content:reindex->#{CONTAINER_CONTROLLER}#reindex
        content:reset->#{CONTAINER_CONTROLLER}#reset
      ACTIONS

      attr_reader :url, :scope

      def initialize(container:, url: [:admin, container], scope: :container, **)
        super(container:, **)

        @url   = url
        @scope = scope
      end

      def status_bar
        Editor::StatusBarComponent.new(container:)
      end

      def new_items
        Editor::NewItemsComponent.new(container:)
      end

      def item_editor(item:)
        Editor::ItemEditorComponent.new(container:, item:)
      end

      def item(item:)
        Editor::ItemComponent.new(container:, item:)
      end

      def errors
        Katalyst::Content.config.errors_component.constantize.new(container:)
      end

      def default_html_attributes
        {
          id:   container_form_id,
          data: {
            controller: CONTAINER_CONTROLLER,
            action:     ACTIONS,
          },
        }
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
katalyst-content-2.4.1 app/components/katalyst/content/editor_component.rb
katalyst-content-2.3.2 app/components/katalyst/content/editor_component.rb
katalyst-content-2.3.1 app/components/katalyst/content/editor_component.rb
katalyst-content-2.3.0 app/components/katalyst/content/editor_component.rb
katalyst-content-2.2.0 app/components/katalyst/content/editor_component.rb
katalyst-content-2.1.4 app/components/katalyst/content/editor_component.rb
katalyst-content-2.1.3 app/components/katalyst/content/editor_component.rb
katalyst-content-2.1.2 app/components/katalyst/content/editor_component.rb
katalyst-content-2.1.1 app/components/katalyst/content/editor_component.rb
katalyst-content-2.1.0 app/components/katalyst/content/editor_component.rb