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
+4 -2
View File
@@ -1065,14 +1065,16 @@ module ApplicationHelper
super sources, options
end
# Overrides Rails' image_tag with plugins support.
# Overrides Rails' image_tag with themes and plugins support.
# Examples:
# image_tag('image.png') # => picks defaults image.png
# image_tag('image.png') # => picks image.png from the current theme or defaults
# image_tag('image.png', :plugin => 'foo) # => picks image.png from plugin's assets
#
def image_tag(source, options={})
if plugin = options.delete(:plugin)
source = "/plugin_assets/#{plugin}/images/#{source}"
elsif current_theme && current_theme.images.include?(source)
source = current_theme.image_path(source)
end
super source, options
end