summaryrefslogtreecommitdiffstats
path: root/app/helpers
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-01-12 09:58:07 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-01-12 09:58:07 +0000
commit1eda38be4ce08fd7d71b9cdc080b5dfa13c1411f (patch)
treeb345b03a07093dd32580ec5d0775cb508aec0422 /app/helpers
parent5df064ed85711ceecdcfbdd66402672cca2b0d58 (diff)
downloadredmine-1eda38be4ce08fd7d71b9cdc080b5dfa13c1411f.tar.gz
redmine-1eda38be4ce08fd7d71b9cdc080b5dfa13c1411f.zip
Adds #favicon_path and #favicon_url helpers.
git-svn-id: http://svn.redmine.org/redmine/trunk@12661 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/application_helper.rb17
1 files changed, 15 insertions, 2 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 617a9029b..200bc1c2c 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1270,8 +1270,21 @@ module ApplicationHelper
end
def favicon
- fav_path = (current_theme && current_theme.favicon?) ? current_theme.favicon_path : '/favicon.ico'
- "<link rel='shortcut icon' href='#{image_path(fav_path)}' />".html_safe
+ "<link rel='shortcut icon' href='#{favicon_path}' />".html_safe
+ end
+
+ # Returns the path to the favicon
+ def favicon_path
+ icon = (current_theme && current_theme.favicon?) ? current_theme.favicon_path : '/favicon.ico'
+ image_path(icon)
+ end
+
+ # Returns the full URL to the favicon
+ def favicon_url
+ # TODO: use #image_url introduced in Rails4
+ path = favicon_path
+ base = url_for(:controller => 'welcome', :action => 'index', :only_path => false)
+ base.sub(%r{/+$},'') + '/' + path.sub(%r{^/+},'')
end
def robot_exclusion_tag