Sha256: b3d7873331e8ed2524a7101f5aa442ddda0185f731e101430118625963ab91ff

Contents?: true

Size: 849 Bytes

Versions: 4

Compression:

Stored size: 849 Bytes

Contents

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

4 entries across 4 versions & 2 rubygems

Version Path
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/activeadmin-2.9.0/lib/active_admin/views/components/menu.rb
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/activeadmin-2.9.0/lib/active_admin/views/components/menu.rb
activeadmin-2.9.0 lib/active_admin/views/components/menu.rb
activeadmin-2.8.1 lib/active_admin/views/components/menu.rb