20 lines
525 B
Ruby
20 lines
525 B
Ruby
module FavoritesHelper
|
|
def sortable(title, column)
|
|
direction = column == sort_column && sort_direction == 'asc' ? 'desc' : 'asc'
|
|
link_to :sort => column, :direction => direction do
|
|
content_tag(:div, title) + sorting_arrow(column)
|
|
end
|
|
end
|
|
|
|
def sorting_arrow(column)
|
|
if sort_column == column
|
|
direction = column == sort_column && sort_direction == 'asc' ? 'desc' : 'asc'
|
|
if direction == 'asc'
|
|
image_tag 'up.png'
|
|
else
|
|
image_tag 'down.png'
|
|
end
|
|
end
|
|
end
|
|
end
|