Module: ActiveAdmin::LayoutHelper
- Defined in:
- app/helpers/active_admin/layout_helper.rb
Instance Method Summary collapse
- #action_items_for_action ⇒ Object
-
#active_admin_application ⇒ Object
Returns the current Active Admin application instance.
- #flash_messages ⇒ Object
- #html_head_site_title(separator: "-") ⇒ Object
- #set_page_title(title) ⇒ Object
- #sidebar_sections_for_action ⇒ Object
- #site_title ⇒ Object
- #skip_sidebar! ⇒ Object
- #skip_sidebar? ⇒ Boolean
- #url_for_comments(*args) ⇒ Object
Instance Method Details
#action_items_for_action ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'app/helpers/active_admin/layout_helper.rb', line 23 def action_items_for_action @action_items_for_action ||= begin if active_admin_config&.action_items? active_admin_config.action_items_for(params[:action], self) else [] end end end |
#active_admin_application ⇒ Object
Returns the current Active Admin application instance
5 6 7 |
# File 'app/helpers/active_admin/layout_helper.rb', line 5 def active_admin_application ActiveAdmin.application end |
#flash_messages ⇒ Object
51 52 53 |
# File 'app/helpers/active_admin/layout_helper.rb', line 51 def @flash_messages ||= flash.to_hash.except(*active_admin_application.flash_keys_to_except) end |
#html_head_site_title(separator: "-") ⇒ Object
19 20 21 |
# File 'app/helpers/active_admin/layout_helper.rb', line 19 def html_head_site_title(separator: "-") "#{@page_title || page_title} #{separator} #{site_title}" end |
#set_page_title(title) ⇒ Object
9 10 11 |
# File 'app/helpers/active_admin/layout_helper.rb', line 9 def set_page_title(title) @page_title = title end |
#sidebar_sections_for_action ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'app/helpers/active_admin/layout_helper.rb', line 33 def @sidebar_sections_for_action ||= begin if active_admin_config&. active_admin_config.(params[:action], self) else [] end end end |
#site_title ⇒ Object
13 14 15 16 17 |
# File 'app/helpers/active_admin/layout_helper.rb', line 13 def site_title # Prioritize namespace and account for Devise views where namespace is not available namespace = active_admin_namespace if respond_to?(:active_admin_namespace) (namespace || active_admin_application).site_title(self) end |
#skip_sidebar! ⇒ Object
43 44 45 |
# File 'app/helpers/active_admin/layout_helper.rb', line 43 def @skip_sidebar = true end |
#skip_sidebar? ⇒ Boolean
47 48 49 |
# File 'app/helpers/active_admin/layout_helper.rb', line 47 def @skip_sidebar == true end |
#url_for_comments(*args) ⇒ Object
55 56 57 58 59 60 61 |
# File 'app/helpers/active_admin/layout_helper.rb', line 55 def url_for_comments(*args) parts = [] parts << active_admin_namespace.name unless active_admin_namespace.root? parts << active_admin_namespace.comments_registration_name.underscore parts << "path" send parts.join("_"), *args end |