From 34cd116b85dd514e18bb266aa23f1546e3a8efaf Mon Sep 17 00:00:00 2001 From: tanraya Date: Tue, 28 Feb 2012 17:26:41 +0600 Subject: [PATCH] It seems it's a good idea to register built-in active_admin/print.css stylesheet in active_admin.rb initializer. I moved it out from ActiveAdmin::Views::Pages::Base#build_active_admin_head method. --- Gemfile | 1 + lib/active_admin/views/pages/base.rb | 2 +- .../active_admin/install/templates/active_admin.rb.erb | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index b0cad217deb..5568db8a552 100644 --- a/Gemfile +++ b/Gemfile @@ -26,6 +26,7 @@ group :development, :test do gem 'yard' gem 'rdiscount' # For yard gem 'rails-i18n' # Gives us default i18n for many languages + gem 'therubyracer' end group :test do diff --git a/lib/active_admin/views/pages/base.rb b/lib/active_admin/views/pages/base.rb index 0218580dc78..10d0f8b8748 100644 --- a/lib/active_admin/views/pages/base.rb +++ b/lib/active_admin/views/pages/base.rb @@ -25,7 +25,7 @@ def build_active_admin_head active_admin_application.stylesheets.each do |style| text_node(stylesheet_link_tag(style.path, style.options).html_safe) end - link :href => stylesheet_path('active_admin/print.css'), :media => "print", :rel => "stylesheet", :type => "text/css" + active_admin_application.javascripts.each do |path| script :src => javascript_path(path), :type => "text/javascript" end diff --git a/lib/generators/active_admin/install/templates/active_admin.rb.erb b/lib/generators/active_admin/install/templates/active_admin.rb.erb index abeaf0eedf7..060cc32f31d 100644 --- a/lib/generators/active_admin/install/templates/active_admin.rb.erb +++ b/lib/generators/active_admin/install/templates/active_admin.rb.erb @@ -120,7 +120,8 @@ ActiveAdmin.setup do |config| # # To load a stylesheet: # config.register_stylesheet 'my_stylesheet.css' - # + config.register_stylesheet 'active_admin/print.css', :media => :print + # You can provide an options hash for more control, which is passed along to stylesheet_link_tag(): # config.register_stylesheet 'my_print_stylesheet.css', :media => :print #