Makes image_tag pick the image from the current theme if it exists.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9560 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2012-04-28 09:47:09 +00:00
parent da43f785be
commit 68f8470d4a
3 changed files with 30 additions and 4 deletions
+14 -2
View File
@@ -67,6 +67,10 @@ module Redmine
@stylesheets ||= assets("stylesheets", "css")
end
def images
@images ||= assets("images")
end
def javascripts
@javascripts ||= assets("javascripts", "js")
end
@@ -75,14 +79,22 @@ module Redmine
"/themes/#{dir}/stylesheets/#{source}"
end
def image_path(source)
"/themes/#{dir}/images/#{source}"
end
def javascript_path(source)
"/themes/#{dir}/javascripts/#{source}"
end
private
def assets(dir, ext)
Dir.glob("#{path}/#{dir}/*.#{ext}").collect {|f| File.basename(f).gsub(/\.#{ext}$/, '')}
def assets(dir, ext=nil)
if ext
Dir.glob("#{path}/#{dir}/*.#{ext}").collect {|f| File.basename(f).gsub(/\.#{ext}$/, '')}
else
Dir.glob("#{path}/#{dir}/*").collect {|f| File.basename(f)}
end
end
end