[#6898] Replace SortHelper patch with a plain helper
This commit is contained in:
@@ -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
|
||||
@@ -98,5 +93,4 @@ module RateSortHelperPatch
|
||||
(icon ? nbsp(2) + image_tag(icon) : '')
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
5
init.rb
5
init.rb
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user