Sha256: 4bf520756f33584f127d76dd912e4be50b2e8b106d071249d440de6f131beea6

Contents?: true

Size: 1.17 KB

Versions: 5

Compression:

Stored size: 1.17 KB

Contents

# frozen_string_literal: true

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

      def status_bar
        @status_bar ||= Editor::StatusBarComponent.new(menu:)
      end

      def new_items
        @new_items ||= Editor::NewItemsComponent.new(menu:)
      end

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

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

      def errors
        @errors ||= Katalyst::Navigation.config.errors_component.constantize.new(menu:)
      end

      private

      def default_html_attributes
        {
          id:   menu_form_id,
          data: {
            controller:                           MENU_CONTROLLER,
            action:                               ACTIONS,
            "#{MENU_CONTROLLER}-max-depth-value": menu.depth,
          },
        }
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
katalyst-navigation-1.8.0 app/components/katalyst/navigation/editor_component.rb
katalyst-navigation-1.6.0 app/components/katalyst/navigation/editor_component.rb
katalyst-navigation-1.5.2 app/components/katalyst/navigation/editor_component.rb
katalyst-navigation-1.5.1 app/components/katalyst/navigation/editor_component.rb
katalyst-navigation-1.5.0 app/components/katalyst/navigation/editor_component.rb