8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/lipstick/helpers/sortable_helper.rb', line 8
def sortable_link(name, param_name = nil)
param_name ||= name.parameterize.underscore.downcase
direction = Lipstick::Sortable.direction(params[:direction])
opposite_direction =
Lipstick::Sortable.opposite_direction(params[:direction])
if params[:sort_by] == param_name
sortable_active_link(name, param_name, direction, opposite_direction)
else
link_to name, request.query_parameters
.merge(sort_by: param_name, direction: direction)
end
end
|