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' - "".html_safe + "".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 diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index 82d55702a..00a157757 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -1264,4 +1264,26 @@ RAW assert_equal '