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.
- #logout_method ⇒ Object protected
-
#title ⇒ Object
protected
Renders the title/branding area for the site.
-
#title_image ⇒ Object
protected
Renders an image for the site’s header/branding area.
-
#title_text ⇒ Object
protected
Renders a the site’s header/branding area as a string.
- #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
62 63 64 65 66 67 68 |
# File 'lib/active_admin/views/header_renderer.rb', line 62 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
45 46 47 |
# File 'lib/active_admin/views/header_renderer.rb', line 45 def render view_factory., , :class => 'header-item' end |
#logout_method ⇒ Object (protected)
70 71 72 |
# File 'lib/active_admin/views/header_renderer.rb', line 70 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 18 19 20 21 |
# File 'lib/active_admin/views/header_renderer.rb', line 15 def title if active_admin_namespace.site_title_image.blank? title_text else title_image end end |
#title_image ⇒ Object (protected)
Renders an image for the site’s header/branding area
24 25 26 27 28 29 30 |
# File 'lib/active_admin/views/header_renderer.rb', line 24 def title_image if !active_admin_namespace.site_title_link.blank? content_tag 'h1', link_to( image_tag(active_admin_namespace.site_title_image, :id => "site_title_image", :alt => active_admin_namespace.site_title), active_admin_namespace.site_title_link ), :id => "site_title" else content_tag 'h1', image_tag( active_admin_namespace.site_title_image, :id => "site_title_image", :alt => active_admin_namespace.site_title ), :id => "site_title" end end |
#title_text ⇒ Object (protected)
Renders a the site’s header/branding area as a string
33 34 35 36 37 38 39 |
# File 'lib/active_admin/views/header_renderer.rb', line 33 def title_text if !active_admin_namespace.site_title_link || active_admin_namespace.site_title_link == "" content_tag 'h1', active_admin_namespace.site_title, :id => 'site_title' else content_tag 'h1', link_to(active_admin_namespace.site_title, active_admin_namespace.site_title_link), :id => 'site_title' end 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)
49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/active_admin/views/header_renderer.rb', line 49 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 |