[#6898] Replace SortHelper patch with a plain helper
This commit is contained in:
@@ -1,12 +1,7 @@
|
|||||||
module RateSortHelperPatch
|
module RateHelper
|
||||||
def self.included(base) # :nodoc:
|
|
||||||
base.send(:include, InstanceMethods)
|
|
||||||
end
|
|
||||||
|
|
||||||
module InstanceMethods
|
|
||||||
# Allows more parameters than the standard sort_header_tag
|
# Allows more parameters than the standard sort_header_tag
|
||||||
def rate_sort_header_tag(column, options = {})
|
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'
|
default_order = options.delete(:default_order) || 'asc'
|
||||||
options[:title]= l(:label_sort_by, "\"#{caption}\"") unless options[:title]
|
options[:title]= l(:label_sort_by, "\"#{caption}\"") unless options[:title]
|
||||||
content_tag('th',
|
content_tag('th',
|
||||||
@@ -80,7 +75,7 @@ module RateSortHelperPatch
|
|||||||
icon = nil
|
icon = nil
|
||||||
order = default_order
|
order = default_order
|
||||||
end
|
end
|
||||||
caption = titleize(Inflector::humanize(column)) unless caption
|
caption = titleize(ActiveSupport::Inflector::humanize(column)) unless caption
|
||||||
|
|
||||||
sort_options = { :sort_key => column, :sort_order => order }
|
sort_options = { :sort_key => column, :sort_order => order }
|
||||||
# don't reuse params if filters are present
|
# don't reuse params if filters are present
|
||||||
@@ -98,5 +93,4 @@ module RateSortHelperPatch
|
|||||||
(icon ? nbsp(2) + image_tag(icon) : '')
|
(icon ? nbsp(2) + image_tag(icon) : '')
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
5
init.rb
5
init.rb
@@ -6,8 +6,9 @@ require 'dispatcher'
|
|||||||
Dispatcher.to_prepare :redmine_rate do
|
Dispatcher.to_prepare :redmine_rate do
|
||||||
gem 'lockfile'
|
gem 'lockfile'
|
||||||
|
|
||||||
require_dependency 'sort_helper'
|
require_dependency 'application_controller'
|
||||||
SortHelper.send(:include, RateSortHelperPatch)
|
ApplicationController.send(:include, RateHelper)
|
||||||
|
ApplicationController.send(:helper, :rate)
|
||||||
|
|
||||||
require_dependency 'time_entry'
|
require_dependency 'time_entry'
|
||||||
TimeEntry.send(:include, RateTimeEntryPatch)
|
TimeEntry.send(:include, RateTimeEntryPatch)
|
||||||
|
|||||||
Reference in New Issue
Block a user