Sha256: eb91ba74d7f2e83903505bc091812c8af5d9ee1ba56c2a9d2a7862a00fcbff2f

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

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', active_admin_application.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(I18n.t('active_admin.logout'), "/#{active_admin_application.default_namespace}/logout")
          end
        end
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
saulolso-activeadmin-0.2.2.1 lib/active_admin/views/header_renderer.rb
saulolso-activeadmin-0.2.2 lib/active_admin/views/header_renderer.rb