Skip to content

Instantly share code, notes, and snippets.

@mitfik
Created April 2, 2012 10:02
Show Gist options
  • Save mitfik/2282301 to your computer and use it in GitHub Desktop.
Save mitfik/2282301 to your computer and use it in GitHub Desktop.
Redmine specify theme per project
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