Skip to content

Commit

Permalink
fixed asset compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
arBmind committed Feb 22, 2023
1 parent 90a9f85 commit e129a6d
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Upgraded Gems to support Rails 6
- Fixed Swagger API documentation for mass update and create

### Fixed
- Asset compilation for Redmine images

## [1.2.0] - 2023-02-21

Non-Beta Release after proving that everything works.
Expand Down
File renamed without changes
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion config/initializers/assets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
Hourglass::Assets.precompile += %w(
application.js application.css
global.js global.css
swagger.js swagger.css swagger-print.css swagger-ui/images/*
jqplot.js jqplot/jquery.jqplot.css
icons/*.png
)
27 changes: 24 additions & 3 deletions lib/hourglass/assets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ def assets_directory_path
File.join 'plugin_assets', Hourglass::PLUGIN_NAME.to_s
end

def redmine_base_path
(Redmine::Utils.relative_url_root || '/')
end
def plugin_base_path
File.join(redmine_base_path, assets_directory_path)
end

def asset_directory_map
{
javascript: 'javascripts',
Expand All @@ -59,11 +66,25 @@ def asset_directory_map
end

def path(path, options = {})
if options[:type].present?
Rails.env.production? ? instance.find_asset(path).digest_path : File.join('/', assets_directory_path, asset_directory_map[options[:type]] || '', path)
resolved = instance.find_asset(path, options)
if resolved.nil?
if path.starts_with? plugin_base_path
path
else
redmine_path path, options
end
else
path
return File.join(plugin_base_path, resolved.digest_path) if Rails.env.production?
plugin_path path, options
end
end

def plugin_path(path, options = {})
File.join(plugin_base_path, asset_directory_map[options[:type]] || '', path)
end

def redmine_path(path, options = {})
File.join(redmine_base_path, asset_directory_map[options[:type]] || '', path)
end
end
end
3 changes: 0 additions & 3 deletions vendor/assets/javascripts/swagger-ui-standalone-preset.js

This file was deleted.

0 comments on commit e129a6d

Please sign in to comment.