Redmine 2.x support - Initial work
This commit is contained in:
+1
-1
@@ -18,7 +18,7 @@ class Rate < ActiveRecord::Base
|
|||||||
before_destroy :unlocked?
|
before_destroy :unlocked?
|
||||||
after_destroy :update_time_entry_cost_cache
|
after_destroy :update_time_entry_cost_cache
|
||||||
|
|
||||||
named_scope :history_for_user, lambda { |user, order|
|
scope :history_for_user, lambda { |user, order|
|
||||||
{
|
{
|
||||||
:conditions => { :user_id => user.id },
|
:conditions => { :user_id => user.id },
|
||||||
:order => order,
|
:order => order,
|
||||||
|
|||||||
+4
-4
@@ -1,4 +1,4 @@
|
|||||||
ActionController::Routing::Routes.draw do |map|
|
resources :rates
|
||||||
map.resources :rates
|
|
||||||
map.connect 'rate_caches', :conditions => {:method => :put}, :controller => 'rate_caches', :action => 'update'
|
match 'rate_caches', :to => 'rate_caches#index', :via => "get"
|
||||||
end
|
match 'rate_caches', :to => 'rate_caches#update', :via => "put"
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
require 'redmine'
|
require 'redmine'
|
||||||
|
|
||||||
# Patches to the Redmine core
|
# Patches to the Redmine core
|
||||||
require 'dispatcher'
|
ActionDispatch::Callbacks.to_prepare do
|
||||||
|
|
||||||
Dispatcher.to_prepare :redmine_rate do
|
|
||||||
gem 'lockfile'
|
gem 'lockfile'
|
||||||
|
|
||||||
require_dependency 'application_controller'
|
require_dependency 'application_controller'
|
||||||
|
|||||||
@@ -52,15 +52,7 @@ class RateProjectHook < Redmine::Hook::ViewListener
|
|||||||
:protocol => Setting.protocol,
|
:protocol => Setting.protocol,
|
||||||
:host => Setting.host_name
|
:host => Setting.host_name
|
||||||
}
|
}
|
||||||
# Build a form_remote_tag by hand since this isn't in the scope of a controller
|
form = form_tag(url, :remote => true)
|
||||||
# and url_rewriter doesn't like that fact.
|
|
||||||
form = form_tag(url, :onsubmit => remote_function(:url => url,
|
|
||||||
:host => Setting.host_name,
|
|
||||||
:protocol => Setting.protocol,
|
|
||||||
:form => true,
|
|
||||||
:method => 'post',
|
|
||||||
:return => 'false' )+ '; return false;')
|
|
||||||
|
|
||||||
form << text_field(:rate, :amount)
|
form << text_field(:rate, :amount)
|
||||||
form << hidden_field(:rate,:date_in_effect, :value => Date.today.to_s)
|
form << hidden_field(:rate,:date_in_effect, :value => Date.today.to_s)
|
||||||
form << hidden_field(:rate, :project_id, :value => project.id)
|
form << hidden_field(:rate, :project_id, :value => project.id)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ module RedmineRate
|
|||||||
module Hooks
|
module Hooks
|
||||||
class ViewLayoutsBaseHtmlHeadHook < Redmine::Hook::ViewListener
|
class ViewLayoutsBaseHtmlHeadHook < Redmine::Hook::ViewListener
|
||||||
def view_layouts_base_html_head(context={})
|
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')
|
content_tag(:style, "#admin-menu a.rate-caches { background-image: url('#{image_path('database_refresh.png')}'); }", :type => 'text/css')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user