Sha256: 443faf7d0e9831f81fb7339f01c3f92092dea6e188bf15b2a1cc5a97255457e7

Contents?: true

Size: 1021 Bytes

Versions: 3

Compression:

Stored size: 1021 Bytes

Contents

module ActiveAdmin
  module Views

    # Renderer for the header of the application. Includes the page
    # title, global navigation and utility navigation.
    class HeaderRenderer < ::ActiveAdmin::Renderer

      def to_html
        title + global_navigation + utility_navigation
      end

      protected

      def title
        content_tag 'h1', ActiveAdmin.site_title, :id => 'site_title'
      end

      # Renders the global navigation returned by 
      # ActiveAdmin::ResourceController#current_menu
      #
      # It uses the ActiveAdmin.tabs_renderer option
      def global_navigation
        render view_factory.global_navigation, current_menu
      end

      def utility_navigation
        content_tag 'p', :id => "utility_nav" do
          if current_active_admin_user?
            content_tag(:span, display_name(current_active_admin_user), :class => "current_user") +
              link_to("Logout", "/#{ActiveAdmin.default_namespace}/logout")
          end
        end
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
activeadmin-0.2.2 lib/active_admin/views/header_renderer.rb
activeadmin-0.2.1 lib/active_admin/views/header_renderer.rb
activeadmin-0.2.0 lib/active_admin/views/header_renderer.rb