Module: RateSortHelperPatch::InstanceMethods

Defined in:
lib/rate_sort_helper_patch.rb

Instance Method Summary collapse

Instance Method Details

#rate_sort_header_tag(column, options = {}) ⇒ Object

Allows more parameters than the standard sort_header_tag



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/rate_sort_helper_patch.rb', line 8

def rate_sort_header_tag(column, options = {})
  caption = options.delete(:caption) || titleize(Inflector::humanize(column))
  default_order = options.delete(:default_order) || 'asc'
  options[:title]= l(:label_sort_by, "\"#{caption}\"") unless options[:title]
  ('th',
              rate_sort_link(column,
                             caption,
                             default_order,
                             { :method => options[:method], :update => options[:update], :user_id => options[:user_id] }),
              options)
end

Allows more parameters than the standard sort_link and is hard coded to use the RatesController and to have an :method and :update options



22
23
24
25
26
27
28
29
# File 'lib/rate_sort_helper_patch.rb', line 22

def rate_sort_link(column, caption, default_order, options = { })
  # 0.8.x compatibility
  if SortHelper.const_defined? 'SortCriteria'
    rate_sort_link_trunk_version(column, caption, default_order, options)
  else
    rate_sort_link_08_version(column, caption, default_order, options)
  end
end