Sha256: d2e4b71243eca077052f61033cdcbdc1fa80ec5e10be2fc1536ff23ca49baf06

Contents?: true

Size: 879 Bytes

Versions: 17

Compression:

Stored size: 879 Bytes

Contents

# frozen_string_literal: true
module ActiveAdmin
  module Views

    # Renders an ActiveAdmin::Menu as a set of unordered list items.
    #
    # This component takes cares of deciding which items should be
    # displayed given the current context and renders them appropriately.
    #
    # The entire component is rendered within one ul element.
    class Menu < Component
      attr_reader :menu
      builder_method :menu

      # @param [ActiveAdmin::Menu] menu the Menu to render
      # @param [Hash] options the options as passed to the underlying ul element.
      #
      def build(menu, options = {})
        @menu = menu
        super(options)

        menu.items.each do |item|
          menu_item(item) if helpers.render_in_context self, item.should_display
        end
        children.sort!
      end

      def tag_name
        "ul"
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
activeadmin-3.2.5 lib/active_admin/views/components/menu.rb
activeadmin-3.2.4 lib/active_admin/views/components/menu.rb
activeadmin-3.2.3 lib/active_admin/views/components/menu.rb
activeadmin-3.2.2 lib/active_admin/views/components/menu.rb
activeadmin-3.2.1 lib/active_admin/views/components/menu.rb
activeadmin-3.2.0 lib/active_admin/views/components/menu.rb
activeadmin-3.1.0 lib/active_admin/views/components/menu.rb
activeadmin-3.0.0 lib/active_admin/views/components/menu.rb
activeadmin-2.14.0 lib/active_admin/views/components/menu.rb
activeadmin-2.13.1 lib/active_admin/views/components/menu.rb
activeadmin-2.13.0 lib/active_admin/views/components/menu.rb
activeadmin-2.12.0 lib/active_admin/views/components/menu.rb
activeadmin-2.11.2 lib/active_admin/views/components/menu.rb
activeadmin-2.11.1 lib/active_admin/views/components/menu.rb
activeadmin-2.11.0 lib/active_admin/views/components/menu.rb
activeadmin-2.10.1 lib/active_admin/views/components/menu.rb
activeadmin-2.10.0 lib/active_admin/views/components/menu.rb