From 070fba3455ad0cfcdbd6b51cb193522f98bf103f Mon Sep 17 00:00:00 2001 From: jpl Date: Wed, 15 Mar 2017 17:35:51 +0100 Subject: Refs #2754: fixing direction param switch, on sorting table columns --- app/helpers/newapplication_helper.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'app/helpers/newapplication_helper.rb') diff --git a/app/helpers/newapplication_helper.rb b/app/helpers/newapplication_helper.rb index e52f0320f..dc16166e1 100644 --- a/app/helpers/newapplication_helper.rb +++ b/app/helpers/newapplication_helper.rb @@ -164,7 +164,8 @@ module NewapplicationHelper end def sortable_columns collection, key - direction = (key == params[:sort] && params[:direction] == 'desc') ? 'asc' : 'desc' + direction = (key.to_s == params[:sort] && params[:direction] == 'desc') ? 'asc' : 'desc' + link_to(params.merge({direction: direction, sort: key})) do pic1 = content_tag :span, '', class: "fa fa-sort-asc #{(direction == 'desc') ? 'active' : ''}" pic2 = content_tag :span, '', class: "fa fa-sort-desc #{(direction == 'asc') ? 'active' : ''}" -- cgit v1.2.3