progress on redmine 2.0 porting

This commit is contained in:
Richard Říman
2012-06-12 15:05:44 +02:00
parent 8e12d37cc6
commit 75437c43bb
5 changed files with 37 additions and 16 deletions
+1 -1
View File
@@ -1 +1 @@
0.2.1
0.3.0
+3
View File
@@ -0,0 +1,3 @@
#admin-menu a.rate-caches {
background-image: url('../images/database_refresh.png');
}
+11 -2
View File
@@ -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
+21 -12
View File
@@ -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 => {
@@ -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