Changeset - 6b7a0cd02857
[Not reviewed]
stable
0 1 0
Mads Kiilerich - 7 years ago 2019-04-30 19:05:16
mads@kiilerich.com
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.
1 file changed with 1 insertions and 0 deletions:
0 comments (0 inline, 0 general)
kallithea/templates/files/files.html
Show inline comments
 
@@ -163,6 +163,7 @@ var post_load_state = function(state) {
 

	
 
    // 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,
0 comments (0 inline, 0 general)