From 6a6fc38ead8287374d6dc4fb1340191b2e4b8295 Mon Sep 17 00:00:00 2001 From: Ludovic Stephan Date: Mon, 15 May 2017 21:10:39 -0300 Subject: [PATCH] Add selection reset to cancel_opes --- kfet/static/kfet/js/history.js | 7 ++++++- kfet/templates/kfet/account_read.html | 4 ---- kfet/templates/kfet/history.html | 4 ---- kfet/templates/kfet/transfers.html | 4 ---- 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/kfet/static/kfet/js/history.js b/kfet/static/kfet/js/history.js index d161e081..41c2f28f 100644 --- a/kfet/static/kfet/js/history.js +++ b/kfet/static/kfet/js/history.js @@ -76,7 +76,12 @@ class KHistory { } cancel_operations(to_cancel) { - var on_success = () => $(this).trigger("cancel_done"); + var that = this ; + var on_success = function() { + if (that.selection) + that.selection.reset() ; + $(that).trigger("cancel_done"); + } api_with_auth({ url: Urls['kfet.kpsul.cancel_operations'](), diff --git a/kfet/templates/kfet/account_read.html b/kfet/templates/kfet/account_read.html index 0ea0bdaa..58f1f4a9 100644 --- a/kfet/templates/kfet/account_read.html +++ b/kfet/templates/kfet/account_read.html @@ -104,10 +104,6 @@ $(document).ready(function() { var khistory = new KHistory({'no_trigramme': true}); - $(khistory).on("cancel_done", function(e) { - khistory.selection.reset(); - }); - Config.reset(() => khistory.fetch({'accounts': [{{account.pk}}]})); }); diff --git a/kfet/templates/kfet/history.html b/kfet/templates/kfet/history.html index 60e675d2..2075cf30 100644 --- a/kfet/templates/kfet/history.html +++ b/kfet/templates/kfet/history.html @@ -132,10 +132,6 @@ $(document).ready(function() { updateHistory(); }); - $(khistory).on("cancel_done", function(e) { - khistory.selection.reset(); - }); - Config.reset(updateHistory); }); diff --git a/kfet/templates/kfet/transfers.html b/kfet/templates/kfet/transfers.html index 500fcbc6..d94ae73b 100644 --- a/kfet/templates/kfet/transfers.html +++ b/kfet/templates/kfet/transfers.html @@ -53,10 +53,6 @@ $(document).ready(function() { var khistory = new KHistory(); - $(khistory).on("cancel_done", function(e) { - khistory.selection.reset(); - }); - Config.reset(() => khistory.fetch({'transfersonly': true})); });