Sha256: 362a332030723a0662bf4e2c7487a87f5906b90687e11f4d42230843a4a02f43

Contents?: true

Size: 594 Bytes

Versions: 1

Compression:

Stored size: 594 Bytes

Contents

# frozen_string_literal: true

module Katalyst
  module Navigation
    module HasNavigation
      extend ActiveSupport::Concern

      module NavigationHelper
        def navigation_menu_for(slug)
          @navigation_menus[slug.to_s]
        end
      end

      included do
        helper Katalyst::Navigation::FrontendHelper
        helper NavigationHelper

        before_action :set_navigation_menus
      end

      protected

      def set_navigation_menus
        @navigation_menus = Katalyst::Navigation::Menu.includes(:published_version).index_by(&:slug)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
katalyst-navigation-1.0.3 app/controllers/concerns/katalyst/navigation/has_navigation.rb