changeset 7641:6b7a0cd02857 stable

files: avoid duplicated "Select changeset" select2 controls on file source pages (Issue #343) Sometimes, when reusing cached data, the DOM part of select2 activation would be reused, but not the actual activation. Repeated select2 activation would thus give duplicated DOM entries. Select2 doeesn't seem to have a good way to unload or redo, so instead just try to remove the old DOM parts.
author Mads Kiilerich <mads@kiilerich.com>
date Tue, 30 Apr 2019 19:05:16 +0200
parents fa2f02020cc8
children b1e2ae0dd6e1
files kallithea/templates/files/files.html
diffstat 1 files changed, 1 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/templates/files/files.html	Tue Apr 30 19:03:27 2019 +0200
+++ b/kallithea/templates/files/files.html	Tue Apr 30 19:05:16 2019 +0200
@@ -163,6 +163,7 @@
 
     // history select field
     var cache = {};
+    $('#diff1').prev('.select2-container').remove(); // Hack to handle repeated JS initialization on reused DOM
     $("#diff1").select2({
         placeholder: _TM['Select changeset'],
         dropdownAutoWidth: true,