3 Commits

Author SHA1 Message Date
Richard Říman
e57c81ff21 Merge branch 'master' into redmine-2.0 2012-09-12 16:46:31 +02:00
Richard Říman
75437c43bb progress on redmine 2.0 porting 2012-06-12 15:05:44 +02:00
Richard Říman
8e12d37cc6 preparing for redmine 2.0 (first steps) 2012-06-12 14:06:45 +02:00
5 changed files with 37 additions and 19 deletions

View File

@@ -1 +1 @@
0.2.1
0.3.0

View File

@@ -0,0 +1,3 @@
#admin-menu a.rate-caches {
background-image: url('../images/database_refresh.png');
}

View File

@@ -1,4 +1,11 @@
ActionController::Routing::Routes.draw do |map|
map.resources :rates
map.connect 'rate_caches', :conditions => {:method => :put}, :controller => 'rate_caches', :action => 'update'
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

36
init.rb
View File

@@ -1,20 +1,28 @@
require 'redmine'
# Patches to the Redmine core
require 'dispatcher'
Rails.logger.info 'Starting Rate plugin for Redmine'
Dispatcher.to_prepare :redmine_rate 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
@@ -27,7 +35,7 @@ Redmine::Plugin.register :redmine_rate do
url 'https://projects.littlestreamsoftware.com/projects/redmine-rate'
author_url 'http://www.littlestreamsoftware.com'
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.2.1'
version '0.3.0'
requires_redmine :version_or_higher => '1.0.0'

View File

@@ -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