Class: ActiveAdmin::Views::HeaderRenderer

Inherits:
Renderer show all
Defined in:
lib/active_admin/views/header_renderer.rb

Overview

Renderer for the header of the application. Includes the page title, global navigation and utility navigation.

Constant Summary

Constants included from Arbre::HTML

Arbre::HTML::AUTO_BUILD_ELEMENTS, Arbre::HTML::HTML5_ELEMENTS

Instance Attribute Summary

Attributes inherited from Renderer

#assigns, #view

Instance Method Summary collapse

Methods inherited from Renderer

#call_method_or_proc_on, #haml, #initialize, #method_missing, #set_ivar_on_view, #to_s

Methods included from Arbre::HTML

#current_dom_context, #helpers, #method_missing

Methods included from ActiveAdmin::ViewHelpers::RendererHelper

#render

Constructor Details

This class inherits a constructor from ActiveAdmin::Renderer

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ActiveAdmin::Renderer

Instance Method Details

Renders the global navigation returned by ActiveAdmin::ResourceController#current_menu

It uses the ActiveAdmin.tabs_renderer option



22
23
24
# File 'lib/active_admin/views/header_renderer.rb', line 22

def global_navigation
  render view_factory.global_navigation, current_menu
end

#logout_methodObject (protected)



47
48
49
# File 'lib/active_admin/views/header_renderer.rb', line 47

def logout_method
  active_admin_application.logout_link_method || :get
end

#logout_pathObject (protected)

Returns the logout path from the application settings



39
40
41
42
43
44
45
# File 'lib/active_admin/views/header_renderer.rb', line 39

def logout_path
  if active_admin_application.logout_link_path.is_a?(Symbol)
    send(active_admin_application.logout_link_path)
  else
    active_admin_application.logout_link_path
  end
end

#titleObject (protected)



14
15
16
# File 'lib/active_admin/views/header_renderer.rb', line 14

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

#to_htmlObject



8
9
10
# File 'lib/active_admin/views/header_renderer.rb', line 8

def to_html
  title + global_navigation + utility_navigation
end

#utility_navigationObject (protected)



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/active_admin/views/header_renderer.rb', line 26

def utility_navigation
   'p', :id => "utility_nav" do
    if current_active_admin_user?
      html = (:span, display_name(current_active_admin_user), :class => "current_user")

      if active_admin_application.logout_link_path
        html << link_to(I18n.t('active_admin.logout'), logout_path, :method => logout_method)
      end
    end
  end
end