lib/active_admin/views/pages/base.rb in yousty-activeadmin-1.0.4.pre vs lib/active_admin/views/pages/base.rb in yousty-activeadmin-1.0.5.pre
- old
+ new
@@ -12,83 +12,87 @@
private
def add_classes_to_body
@body.add_class(params[:action])
- @body.add_class(params[:controller].gsub('/', '_'))
+ @body.add_class(params[:controller].tr('/', '_'))
@body.add_class("active_admin")
@body.add_class("logged_in")
@body.add_class(active_admin_namespace.name.to_s + "_namespace")
end
def build_active_admin_head
within @head do
- insert_tag Arbre::HTML::Title, [title, render_or_call_method_or_proc_on(self, active_admin_application.site_title)].join(" | ")
+ insert_tag Arbre::HTML::Title, [title, render_or_call_method_or_proc_on(self, active_admin_namespace.site_title)].compact.join(" | ")
active_admin_application.stylesheets.each do |style, options|
text_node stylesheet_link_tag(style, options).html_safe
end
active_admin_application.javascripts.each do |path|
text_node(javascript_include_tag(path))
end
-
- if active_admin_application.favicon
- text_node(favicon_link_tag(active_admin_application.favicon))
+
+ if active_admin_namespace.favicon
+ text_node(favicon_link_tag(active_admin_namespace.favicon))
end
-
+
text_node csrf_meta_tag
end
end
def build_page
within @body do
- div :id => "wrapper" do
+ div id: "wrapper" do
+ build_unsupported_browser
build_header
build_title_bar
build_page_content
build_footer
end
end
end
+ def build_unsupported_browser
+ if active_admin_namespace.unsupported_browser_matcher =~ env["HTTP_USER_AGENT"]
+ insert_tag view_factory.unsupported_browser
+ end
+ end
+
def build_header
insert_tag view_factory.header, active_admin_namespace, current_menu
end
def build_title_bar
insert_tag view_factory.title_bar, title, action_items_for_action
end
-
def build_page_content
build_flash_messages
- div :id => "active_admin_content", :class => (skip_sidebar? ? "without_sidebar" : "with_sidebar") do
+ div id: "active_admin_content", class: (skip_sidebar? ? "without_sidebar" : "with_sidebar") do
build_main_content_wrapper
build_sidebar unless skip_sidebar?
end
end
def build_flash_messages
- if active_admin_flash_messages.any?
- div :class => 'flashes' do
- active_admin_flash_messages.each do |type, message|
- div message, :class => "flash flash_#{type}"
- end
+ div class: 'flashes' do
+ flash_messages.each do |type, message|
+ div message, class: "flash flash_#{type}"
end
end
end
def build_main_content_wrapper
- div :id => "main_content_wrapper" do
- div :id => "main_content" do
+ div id: "main_content_wrapper" do
+ div id: "main_content" do
main_content
end
end
end
def main_content
- I18n.t('active_admin.main_content', :model => self.class.name).html_safe
+ I18n.t('active_admin.main_content', model: title).html_safe
end
def title
self.class.name
end
@@ -115,10 +119,10 @@
end
end
# Renders the sidebar
def build_sidebar
- div :id => "sidebar" do
+ div id: "sidebar" do
sidebar_sections_for_action.collect do |section|
sidebar_section(section)
end
end
end