[#6898] Replace SortHelper patch with a plain helper

This commit is contained in:
Eric Davis
2012-05-15 09:09:43 -07:00
parent 00453672c6
commit f42b419bf3
2 changed files with 6 additions and 11 deletions

View File

@@ -1,12 +1,7 @@
module RateSortHelperPatch
def self.included(base) # :nodoc:
base.send(:include, InstanceMethods)
end
module InstanceMethods
module RateHelper
# Allows more parameters than the standard sort_header_tag
def rate_sort_header_tag(column, options = {})
caption = options.delete(:caption) || titleize(Inflector::humanize(column))
caption = options.delete(:caption) || titleize(ActiveSupport::Inflector::humanize(column))
default_order = options.delete(:default_order) || 'asc'
options[:title]= l(:label_sort_by, "\"#{caption}\"") unless options[:title]
content_tag('th',
@@ -80,7 +75,7 @@ module RateSortHelperPatch
icon = nil
order = default_order
end
caption = titleize(Inflector::humanize(column)) unless caption
caption = titleize(ActiveSupport::Inflector::humanize(column)) unless caption
sort_options = { :sort_key => column, :sort_order => order }
# don't reuse params if filters are present
@@ -99,4 +94,3 @@ module RateSortHelperPatch
end
end
end

View File

@@ -6,8 +6,9 @@ require 'dispatcher'
Dispatcher.to_prepare :redmine_rate do
gem 'lockfile'
require_dependency 'sort_helper'
SortHelper.send(:include, RateSortHelperPatch)
require_dependency 'application_controller'
ApplicationController.send(:include, RateHelper)
ApplicationController.send(:helper, :rate)
require_dependency 'time_entry'
TimeEntry.send(:include, RateTimeEntryPatch)