Merge branch 'master' of github.com:railsformers/redmine_rate

This commit is contained in:
Richard Říman
2012-09-12 16:45:37 +02:00
2 changed files with 6 additions and 11 deletions

View File

@@ -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
@@ -99,4 +94,3 @@ module RateSortHelperPatch
end end
end end
end

View File

@@ -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)