]> source.dussan.org Git - redmine.git/commitdiff
Adds asset path to default to support old style theme (#39111).
authorMarius Balteanu <marius.balteanu@zitec.com>
Thu, 31 Oct 2024 08:15:57 +0000 (08:15 +0000)
committerMarius Balteanu <marius.balteanu@zitec.com>
Thu, 31 Oct 2024 08:15:57 +0000 (08:15 +0000)
Patch by Takashi Kato (user:tohosaku).

git-svn-id: https://svn.redmine.org/redmine/trunk@23173 e93f8b46-1217-0410-a6f0-8f06a7374b81

config/initializers/30-redmine.rb
test/integration/lib/redmine/themes_test.rb

index 4eceaf06dccace5e6a04a05a62a04d9560692683..cf13cab2040f519e68a53906aae04decb966103e 100644 (file)
@@ -24,7 +24,10 @@ Redmine::PluginLoader.load
 
 Rails.application.config.to_prepare do
   default_paths = []
-  Rails.application.config.assets.redmine_default_asset_path = Redmine::AssetPath.new(Rails.public_path, default_paths)
+  default_paths << Rails.root.join("app/assets/javascripts")
+  default_paths << Rails.root.join("app/assets/images")
+  default_paths << Rails.root.join("app/assets/stylesheets")
+  Rails.application.config.assets.redmine_default_asset_path = Redmine::AssetPath.new(Rails.root.join('app/assets'), default_paths)
 
   Redmine::FieldFormat::RecordList.subclasses.each do |klass|
     klass.instance.reset_target_class
index 42cacd172e844c6017ca3d476e8d4ee772d32231..7dc6b8df0c55fe4ec727476a0b766432ac33e094 100644 (file)
@@ -109,4 +109,17 @@ class ThemesTest < Redmine::IntegrationTest
     assert_response :success
     assert_select 'body[class~="theme-Foo_bar_baz"]'
   end
+
+  def test_old_theme_compatibility
+    @theme = Redmine::Themes::Theme.new(Rails.root.join('test/fixtures/themes/foo_theme'))
+    Rails.application.config.assets.redmine_extension_paths << @theme.asset_paths
+    Setting.ui_theme = @theme.id
+    Rails.application.assets.load_path.clear_cache
+
+    asset = Rails.application.assets.load_path.find('themes/foo_theme/application.css')
+    get "/assets/#{asset.digested_path.to_s}"
+
+    assert_response :success
+    assert_match %r{url\(\"/assets/application-\w+\.css\"\)}, response.body
+  end
 end