From c49234bd78af8261ab687392f1fb7d69ec4963b9 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak <alec@alec.pl> Date: Wed, 09 Sep 2015 04:37:01 -0400 Subject: [PATCH] Fix bug where clicking date column with 'arrival' sorting would switch to sorting by 'date' (#1490126) --- program/js/app.js | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) diff --git a/program/js/app.js b/program/js/app.js index 4b9f5d6..e2e3233 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -2175,10 +2175,16 @@ this.set_list_sorting = function(sort_col, sort_order) { + var sort_old = this.env.sort_col == 'arrival' ? 'date' : this.env.sort_col, + sort_new = sort_col == 'arrival' ? 'date' : sort_col; + // set table header class - $('#rcm'+this.env.sort_col).removeClass('sorted'+(this.env.sort_order.toUpperCase())); - if (sort_col) - $('#rcm'+sort_col).addClass('sorted'+sort_order); + $('#rcm' + sort_old).removeClass('sorted' + this.env.sort_order.toUpperCase()); + if (sort_new) + $('#rcm' + sort_new).addClass('sorted' + sort_order); + + // if sorting by 'arrival' is selected, click on date column should not switch to 'date' + $('#rcmdate > a').prop('rel', sort_col == 'arrival' ? 'arrival' : 'date'); this.env.sort_col = sort_col; this.env.sort_order = sort_order; -- Gitblit v1.9.1