Feature #39111 » 0001-Add-asset-path-to-default-to-support-old-style-theme.patch
| config/initializers/30-redmine.rb | ||
|---|---|---|
| 24 | 24 | |
| 25 | 25 |
Rails.application.config.to_prepare do |
| 26 | 26 |
default_paths = [] |
| 27 |
Rails.application.config.assets.redmine_default_asset_path = Redmine::AssetPath.new(Rails.public_path, default_paths) |
|
| 27 |
default_paths << Rails.root.join("app/assets/javascripts")
|
|
| 28 |
default_paths << Rails.root.join("app/assets/images")
|
|
| 29 |
default_paths << Rails.root.join("app/assets/stylesheets")
|
|
| 30 |
Rails.application.config.assets.redmine_default_asset_path = Redmine::AssetPath.new(Rails.root.join('app/assets'), default_paths)
|
|
| 28 | 31 | |
| 29 | 32 |
Redmine::FieldFormat::RecordList.subclasses.each do |klass| |
| 30 | 33 |
klass.instance.reset_target_class |
| test/fixtures/themes/foo_theme/stylesheets/application.css | ||
|---|---|---|
| 1 |
/* load the default Redmine stylesheet */ |
|
| 2 |
@import url(../../../stylesheets/application.css); |
|
| test/integration/lib/redmine/themes_test.rb | ||
|---|---|---|
| 109 | 109 |
assert_response :success |
| 110 | 110 |
assert_select 'body[class~="theme-Foo_bar_baz"]' |
| 111 | 111 |
end |
| 112 | ||
| 113 |
def test_old_theme_compatibility |
|
| 114 |
@theme = Redmine::Themes::Theme.new(Rails.root.join('test/fixtures/themes/foo_theme'))
|
|
| 115 |
Rails.application.config.assets.redmine_extension_paths << @theme.asset_paths |
|
| 116 |
Setting.ui_theme = @theme.id |
|
| 117 |
Rails.application.assets.load_path.clear_cache |
|
| 118 | ||
| 119 |
asset = Rails.application.assets.load_path.find('themes/foo_theme/application.css')
|
|
| 120 |
get "/assets/#{asset.digested_path.to_s}"
|
|
| 121 | ||
| 122 |
assert_response :success |
|
| 123 |
assert_match %r{url\(\"/assets/application-\w+\.css\"\)}, response.body
|
|
| 124 |
end |
|
| 112 | 125 |
end |