Class: ActiveAdmin::Views::HeaderRenderer
- 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.
Instance Attribute Summary
Attributes inherited from Renderer
Instance Method Summary collapse
-
#active_admin_logout_path ⇒ Object
protected
Returns the logout path from the application settings.
-
#global_navigation ⇒ Object
protected
Renders the global navigation returned by ActiveAdmin::ResourceController#current_menu.
- #link_to_site_title(title_tag) ⇒ Object protected
- #logout_method ⇒ Object protected
-
#title ⇒ Object
protected
Renders the title/branding area for the site.
-
#title_image ⇒ String
protected
The title image url.
-
#title_image_tag ⇒ String
protected
site_title_image is blank.
-
#title_text ⇒ String
protected
The site title.
- #to_html ⇒ Object
- #utility_navigation ⇒ Object protected
Methods inherited from Renderer
#call_method_or_proc_on, #haml, #initialize, #method_missing, #set_ivar_on_view, #to_s
Methods included from Arbre::Builder
#current_dom_context, #helpers, #method_missing
Methods included from ActiveAdmin::ViewHelpers::RendererHelper
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
#active_admin_logout_path ⇒ Object (protected)
Returns the logout path from the application settings
68 69 70 71 72 73 74 |
# File 'lib/active_admin/views/header_renderer.rb', line 68 def active_admin_logout_path if active_admin_namespace.logout_link_path.is_a?(Symbol) send(active_admin_namespace.logout_link_path) else active_admin_namespace.logout_link_path end end |
#global_navigation ⇒ Object (protected)
Renders the global navigation returned by ActiveAdmin::ResourceController#current_menu
It uses the ActiveAdmin.tabs_renderer option
51 52 53 |
# File 'lib/active_admin/views/header_renderer.rb', line 51 def render view_factory., , :class => 'header-item' end |
#link_to_site_title(title_tag) ⇒ Object (protected)
19 20 21 22 23 24 25 |
# File 'lib/active_admin/views/header_renderer.rb', line 19 def link_to_site_title(title_tag) if active_admin_namespace.site_title_link.present? link_to(title_tag, active_admin_namespace.site_title_link) else title_tag end end |
#logout_method ⇒ Object (protected)
76 77 78 |
# File 'lib/active_admin/views/header_renderer.rb', line 76 def logout_method active_admin_namespace.logout_link_method || :get end |
#title ⇒ Object (protected)
Renders the title/branding area for the site
15 16 17 |
# File 'lib/active_admin/views/header_renderer.rb', line 15 def title content_tag('h1', link_to_site_title(title_image_tag || title_text), :id => 'site_title') end |
#title_image ⇒ String (protected)
Returns The title image url.
38 39 40 |
# File 'lib/active_admin/views/header_renderer.rb', line 38 def title_image render_or_call_method_or_proc_on(self, active_admin_namespace.site_title_image) end |
#title_image_tag ⇒ String (protected)
site_title_image is blank.
29 30 31 32 33 34 35 |
# File 'lib/active_admin/views/header_renderer.rb', line 29 def title_image_tag if active_admin_namespace.site_title_image.present? image_tag(title_image, :id => "site_title_image", :alt => active_admin_namespace.site_title) end end |
#title_text ⇒ String (protected)
Returns The site title.
43 44 45 |
# File 'lib/active_admin/views/header_renderer.rb', line 43 def title_text render_or_call_method_or_proc_on(self, active_admin_namespace.site_title) end |
#to_html ⇒ Object
8 9 10 |
# File 'lib/active_admin/views/header_renderer.rb', line 8 def to_html title + + end |
#utility_navigation ⇒ Object (protected)
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/active_admin/views/header_renderer.rb', line 55 def content_tag 'p', :id => "utility_nav", :class => 'header-item' do if current_active_admin_user? html = content_tag(:span, display_name(current_active_admin_user), :class => "current_user") if active_admin_namespace.logout_link_path html << link_to(I18n.t('active_admin.logout'), active_admin_logout_path, :method => logout_method) end end end end |