Sha256: 51811ff1ac406636dabf7d72bb082ce3201807b9ae1b7bf081ba26db050b2ee8

Contents?: true

Size: 849 Bytes

Versions: 31

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

31 entries across 31 versions & 4 rubygems

Version Path
activeadmin-rails-1.7.1 lib/active_admin/views/components/menu.rb
activeadmin-rails-1.7.0 lib/active_admin/views/components/menu.rb
activeadmin-rb-1.6.0 lib/active_admin/views/components/menu.rb
activeadmin-rb-1.5.2 lib/active_admin/views/components/menu.rb
activeadmin-2.8.0 lib/active_admin/views/components/menu.rb
activeadmin-rb-1.5.1 lib/active_admin/views/components/menu.rb
activeadmin-2.7.0 lib/active_admin/views/components/menu.rb
activeadmin-2.6.1 lib/active_admin/views/components/menu.rb
activeadmin-2.6.0 lib/active_admin/views/components/menu.rb
activeadmin-2.5.0 lib/active_admin/views/components/menu.rb
activeadmin-2.4.0 lib/active_admin/views/components/menu.rb
activeadmin-2.3.1 lib/active_admin/views/components/menu.rb
activeadmin-2.3.0 lib/active_admin/views/components/menu.rb
activeadmin-2.2.0 lib/active_admin/views/components/menu.rb
activeadmin-2.1.0 lib/active_admin/views/components/menu.rb
activeadmin-2.0.0 lib/active_admin/views/components/menu.rb
activeadmin-rb-1.5.0 lib/active_admin/views/components/menu.rb
activeadmin-2.0.0.rc2 lib/active_admin/views/components/menu.rb
activeadmin_addons-1.7.1 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-f71b375325eb/lib/active_admin/views/components/menu.rb
activeadmin-2.0.0.rc1 lib/active_admin/views/components/menu.rb