Module: SortableHelper

Defined in:
app/helpers/sortable_helper.rb

Instance Method Summary collapse

Instance Method Details

#sortable(column, title = nil) ⇒ Object



3
4
5
6
7
8
# File 'app/helpers/sortable_helper.rb', line 3

def sortable(column, title = nil)
  title ||= column.titleize
  css_class = column == sort_column ? "current #{sort_direction}" : nil
  direction = column == sort_column && sort_direction == "asc" ? "desc" : "asc"
  link_to title, {:sort => column, :direction => direction}, {:class => css_class}
end