Created
April 2, 2012 10:02
-
-
Save mitfik/2282301 to your computer and use it in GitHub Desktop.
Redmine specify theme per project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ApplicationHelper | |
def current_theme | |
# path to use diffrent theme for project and subprojects | |
unless instance_variable_defined?(:@current_theme) | |
theme = Setting.ui_theme | |
if not @project.nil? | |
if @project.root? | |
if File.directory?("#{Rails.public_path}/themes/#{@project.identifier}") | |
theme = @project.identifier | |
end | |
else | |
if File.directory?("#{Rails.public_path}/themes/#{@project.ancestors.shift.identifier}") | |
theme = @project.ancestors.shift.identifier | |
end | |
end | |
end | |
@current_theme = Redmine::Themes.theme(theme) | |
end | |
@current_theme | |
# uncomment to use standard theme behavior | |
#unless instance_variable_defined?(:@current_theme) | |
# @current_theme = Redmine::Themes.theme(Setting.ui_theme) | |
#end | |
#@current_theme | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment