Commits

Haru Iida committed 2e0c588

refs #1053 Compatible with Redmine 2.0.0

Comments (0)

Files changed (2)

 # Theme Changer plugin for Redmine
-# Copyright (C) 2010-2011  Haruyuki Iida
+# Copyright (C) 2010-2012  Haruyuki Iida
 #rev
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
 require 'theme_changer_user_patch'
 require 'theme_changer_themes_patch'
 
-require 'dispatcher'
-Dispatcher.to_prepare :redmine_theme_changer do
+Rails.configuration.to_prepare do
   # Guards against including the module multiple time (like in tests)
   # and registering multiple callbacks
   require_dependency 'user_preference'
   version '0.0.6'
   url 'http://www.r-labs.org/projects/themechanger'
   author_url 'http://twitter.com/haru_iida'
-  requires_redmine :version_or_higher => '1.3.0'
+  requires_redmine :version_or_higher => '2.0.0'
 end

lib/theme_changer_themes_patch.rb

 # Code Review plugin for Redmine
-# Copyright (C) 2009  Haruyuki Iida
+# Copyright (C) 2009-2012  Haruyuki Iida
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
 
 #require_dependency 'application_controller'
 require_dependency 'redmine/themes'
-require_dependency 'theme_changer_user_setting'
+#require_dependency 'theme_changer_user_setting'
 
 module ApplicationHelper
   def get_theme
     return Setting.ui_theme if setting.theme == ThemeChangerUserSetting::SYSTEM_SETTING
     return setting.theme_name
   end
-
-  def stylesheet_path(source)
-    @current_theme ||= Redmine::Themes.theme(get_theme)
-    super((@current_theme && @current_theme.stylesheets.include?(source)) ?
-      "/themes/#{@current_theme.dir}/stylesheets/#{source}" : source)
+  
+  def current_theme
+    unless instance_variable_defined?(:@current_theme)
+      @current_theme = Redmine::Themes.theme(get_theme)
+    end
+    @current_theme
   end
 
 end