Reload themes so that new themes can be used without restarting Redmine (#5712).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4432 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2010-11-27 14:06:11 +00:00
parent 4faca3cd4a
commit 620c48fbbb
3 changed files with 73 additions and 3 deletions
+12 -3
View File
@@ -29,8 +29,13 @@ module Redmine
end
# Return theme for given id, or nil if it's not found
def self.theme(id)
themes.find {|t| t.id == id}
def self.theme(id, options={})
found = themes.find {|t| t.id == id}
if found.nil? && options[:rescan] != false
rescan
found = theme(id, :rescan => false)
end
found
end
# Class used to represent a theme
@@ -45,7 +50,11 @@ module Redmine
# Directory name used as the theme id
def id; dir end
def ==(theme)
theme.is_a?(Theme) && theme.dir == dir
end
def <=>(theme)
name <=> theme.name
end