summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2010-11-27 14:06:11 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2010-11-27 14:06:11 +0000
commit620c48fbbb8e418819e61e68d8488869fe7e2780 (patch)
tree7c5c60b37329a6d64f906bc620187efffe857a88 /lib
parent4faca3cd4a7d8c7d39c7e73784ccaae076471e7b (diff)
downloadredmine-620c48fbbb8e418819e61e68d8488869fe7e2780.tar.gz
redmine-620c48fbbb8e418819e61e68d8488869fe7e2780.zip
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
Diffstat (limited to 'lib')
-rw-r--r--lib/redmine/themes.rb15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/redmine/themes.rb b/lib/redmine/themes.rb
index 57cdecb10..f932f9563 100644
--- a/lib/redmine/themes.rb
+++ b/lib/redmine/themes.rb
@@ -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