diff --git a/VERSION b/VERSION index 0c62199..0d91a54 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.2.1 +0.3.0 diff --git a/assets/stylesheets/rate.css b/assets/stylesheets/rate.css new file mode 100644 index 0000000..163996f --- /dev/null +++ b/assets/stylesheets/rate.css @@ -0,0 +1,3 @@ +#admin-menu a.rate-caches { + background-image: url('../images/database_refresh.png'); +} diff --git a/config/routes.rb b/config/routes.rb index ba1ed0b..b3ab9d6 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,2 +1,11 @@ -resources :rates -match 'rate_caches', :to => 'rate_caches#update', :method => :put +if Gem::Version.new("3.0") > Gem::Version.new(Rails.version) then + ActionController::Routing::Routes.draw do |map| + map.resources :rates + map.connect "rate_caches", :conditions => { :method => :put }, :controller => "rate_caches", :action => "update" + end +else + RedmineApp::Application.routes.draw do + resources :rates + match :rate_caches, :to => "rate_caches#update", :method => :put + end +end diff --git a/init.rb b/init.rb index 591be54..ce13849 100644 --- a/init.rb +++ b/init.rb @@ -2,18 +2,27 @@ require 'redmine' Rails.logger.info 'Starting Rate plugin for Redmine' -ActionDispatch::Callbacks.to_prepare do - gem 'lockfile' +require_dependency 'application_controller' +require_dependency 'time_entry' +require_dependency 'users_helper' - require_dependency 'application_controller' - ApplicationController.send(:include, RateHelper) - ApplicationController.send(:helper, :rate) - - require_dependency 'time_entry' - TimeEntry.send(:include, RateTimeEntryPatch) - - require_dependency 'users_helper' - UsersHelper.send(:include, RateUsersHelperPatch) unless UsersHelper.included_modules.include?(RateUsersHelperPatch) +if Gem::Version.new("3.0") > Gem::Version.new(Rails.version) then + require 'dispatcher' + Distpatcher.to_prepare :redmine_rate do + gem 'lockfile' + ApplicationController.send(:include, RateHelper) + ApplicationController.send(:helper, :rate) + TimeEntry.send(:include, RateTimeEntryPatch) + UsersHelper.send(:include, RateUsersHelperPatch) unless UsersHelper.included_modules.include?(RateUsersHelperPatch) + end +else + ActionDispatch::Callbacks.to_prepare do + gem 'lockfile' + ApplicationController.send(:include, RateHelper) + ApplicationController.send(:helper, :rate) + TimeEntry.send(:include, RateTimeEntryPatch) + UsersHelper.send(:include, RateUsersHelperPatch) unless UsersHelper.included_modules.include?(RateUsersHelperPatch) + end end # Hooks @@ -28,7 +37,7 @@ Redmine::Plugin.register :redmine_rate do description "The Rate plugin provides an API that can be used to find the rate for a Member of a Project at a specific date. It also stores historical rate data so calculations will remain correct in the future." version '0.3.0' - requires_redmine :version_or_higher => '2.0.0' + requires_redmine :version_or_higher => '1.0.0' # These settings are set automatically when caching settings(:default => { diff --git a/lib/redmine_rate/hooks/view_layouts_base_html_head_hook.rb b/lib/redmine_rate/hooks/view_layouts_base_html_head_hook.rb index 8361aec..705f58b 100644 --- a/lib/redmine_rate/hooks/view_layouts_base_html_head_hook.rb +++ b/lib/redmine_rate/hooks/view_layouts_base_html_head_hook.rb @@ -2,7 +2,7 @@ module RedmineRate module Hooks class ViewLayoutsBaseHtmlHeadHook < Redmine::Hook::ViewListener def view_layouts_base_html_head(context={}) - return content_tag(:style, "#admin-menu a.rate-caches { background-image: url('#{image_path('database_refresh.png', :plugin => 'redmine_rate')}'); }", :type => 'text/css') + stylesheet_link_tag "rate.css", :plugin => "redmine_rate" end end end