[#230] Make loadpath of themes configurable
Based on a987b74ed14 by meineerde
This commit is contained in:
parent
f1878f4a79
commit
8cfe498bd6
|
@ -98,7 +98,19 @@ default:
|
|||
# attachments_storage_path: /var/chiliproject/files
|
||||
# attachments_storage_path: D:/chiliproject/files
|
||||
attachments_storage_path:
|
||||
|
||||
|
||||
# Path to the directories where themes are stored.
|
||||
# Can be an absolute path or one relative to your ChiliProject instance.
|
||||
# You can configure multiple paths.
|
||||
# The default is the 'public/themes' directory in your ChiliProject instance.
|
||||
# Examples:
|
||||
# themes_storage_paths: public/themes
|
||||
# themes_storage_paths:
|
||||
# - public/themes
|
||||
# - /opt/themes
|
||||
# - D:/chiliproject/themes
|
||||
themes_storage_path:
|
||||
|
||||
# Configuration of the autologin cookie.
|
||||
# autologin_cookie_name: the name of the cookie (default: autologin)
|
||||
# autologin_cookie_path: the cookie path (default: /)
|
||||
|
|
|
@ -89,11 +89,22 @@ module Redmine
|
|||
private
|
||||
|
||||
def self.scan_themes
|
||||
dirs = Dir.glob("#{Rails.public_path}/themes/*").select do |f|
|
||||
# A theme should at least override application.css
|
||||
File.directory?(f) && File.exist?("#{f}/stylesheets/application.css")
|
||||
end
|
||||
dirs.collect {|dir| Theme.new(dir)}.sort
|
||||
theme_paths.inject([]) do |themes, path|
|
||||
dirs = Dir.glob(File.join(path, '*')).select do |f|
|
||||
# A theme should at least override application.css
|
||||
File.directory?(f) && File.exist?("#{f}/stylesheets/application.css")
|
||||
end
|
||||
themes += dirs.collect { |dir| Theme.new(dir) }
|
||||
end.sort
|
||||
end
|
||||
|
||||
def self.theme_paths
|
||||
paths = Redmine::Configuration['themes_storage_path']
|
||||
paths = [paths] unless paths.is_a?(Array)
|
||||
paths.flatten!; paths.compact!
|
||||
|
||||
paths = ["#{Rails.public_path}/themes"] if paths.empty?
|
||||
paths.collect { |p| File.expand_path(p, Rails.root) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue