From f42b419bf3bf06b23dac9407f013d99f96e34d95 Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Tue, 15 May 2012 09:09:43 -0700 Subject: [PATCH] [#6898] Replace SortHelper patch with a plain helper --- .../helpers/rate_helper.rb | 12 +++--------- init.rb | 5 +++-- 2 files changed, 6 insertions(+), 11 deletions(-) rename lib/rate_sort_helper_patch.rb => app/helpers/rate_helper.rb (92%) diff --git a/lib/rate_sort_helper_patch.rb b/app/helpers/rate_helper.rb similarity index 92% rename from lib/rate_sort_helper_patch.rb rename to app/helpers/rate_helper.rb index ba2ae1f..12c970c 100644 --- a/lib/rate_sort_helper_patch.rb +++ b/app/helpers/rate_helper.rb @@ -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 diff --git a/init.rb b/init.rb index 09dadec..da7bda4 100644 --- a/init.rb +++ b/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)