commit 7e8669dee5335b3c44d1b81c3184f4657e6d7ba3 Author: Felix Schäfer Date: Thu Dec 12 16:09:47 2013 +0100 Themes are able to provide a favicon #15689 diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 357a7e0..951ce67 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1254,7 +1254,8 @@ module ApplicationHelper end def favicon - "".html_safe + fav_path = (current_theme && current_theme.favicon?) ? current_theme.favicon_path : '/favicon.ico' + "".html_safe end def robot_exclusion_tag diff --git a/lib/redmine/themes.rb b/lib/redmine/themes.rb index eb2ba91..9efc24f 100644 --- a/lib/redmine/themes.rb +++ b/lib/redmine/themes.rb @@ -75,6 +75,15 @@ module Redmine @javascripts ||= assets("javascripts", "js") end + def favicon + # we need to cache the array as [].first is nil and wouldn't be cached + (@favicons ||= assets("favicon")).first + end + + def favicon? + favicon.present? + end + def stylesheet_path(source) "/themes/#{dir}/stylesheets/#{source}" end @@ -87,6 +96,10 @@ module Redmine "/themes/#{dir}/javascripts/#{source}" end + def favicon_path + "/themes/#{dir}/favicon/#{favicon}" + end + private def assets(dir, ext=nil)