You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30-redmine.rb 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # frozen_string_literal: true
  2. require 'redmine/configuration'
  3. require 'redmine/plugin_loader'
  4. Rails.application.config.to_prepare do
  5. I18n.backend = Redmine::I18n::Backend.new
  6. # Forces I18n to load available locales from the backend
  7. I18n.config.available_locales = nil
  8. # Use Nokogiri as XML backend instead of Rexml
  9. ActiveSupport::XmlMini.backend = 'Nokogiri'
  10. Redmine::Preparation.prepare
  11. end
  12. # Load the secret token from the Redmine configuration file
  13. secret = Redmine::Configuration['secret_token']
  14. if secret.present?
  15. RedmineApp::Application.config.secret_token = secret
  16. end
  17. Redmine::PluginLoader.load
  18. Rails.application.config.to_prepare do
  19. default_paths = []
  20. default_paths << Rails.public_path.join('javascripts')
  21. default_paths << Rails.public_path.join('stylesheets')
  22. default_paths << Rails.public_path.join('images')
  23. Rails.application.config.assets.redmine_default_asset_path = Redmine::AssetPath.new(Rails.public_path, default_paths)
  24. Redmine::FieldFormat::RecordList.subclasses.each do |klass|
  25. klass.instance.reset_target_class
  26. end
  27. Redmine::Plugin.all.each do |plugin|
  28. paths = plugin.asset_paths
  29. Rails.application.config.assets.redmine_extension_paths << paths if paths.present?
  30. end
  31. Redmine::Themes.themes.each do |theme|
  32. paths = theme.asset_paths
  33. Rails.application.config.assets.redmine_extension_paths << paths if paths.present?
  34. end
  35. end