From 13a98fde05438f513ce50358d1183eb99b37e752 Mon Sep 17 00:00:00 2001 From: jaden <noreply@example.com> Date: Thu, 8 Jun 2017 11:34:06 +0200 Subject: [PATCH] stop using chosen.js for dialog, fixes beat/beat.web#465 --- .../static/experiments/js/utils.js | 45 ++++++------------- 1 file changed, 13 insertions(+), 32 deletions(-) diff --git a/beat/web/experiments/static/experiments/js/utils.js b/beat/web/experiments/static/experiments/js/utils.js index 31a944b11..eee1b7264 100644 --- a/beat/web/experiments/static/experiments/js/utils.js +++ b/beat/web/experiments/static/experiments/js/utils.js @@ -1802,38 +1802,19 @@ beat.experiments.utils.modal_add_to_report = function(names, report_list_url) { first_option.attr('selected', true); first_option.text('Select a report...'); - select.chosen({ - disable_search_threshold: 5, - search_contains: true, - allow_single_deselect: true, - }); - - select.on('chosen:showing_dropdown', function(e, params) { - select.find('option:gt(0)').remove(); - select.find('option:eq(0)').attr('selected', true); - data.forEach(function(i) { - var opt = $(document.createElement('option')); - select.append(opt); - opt.val(i.add_url); - var div = $(document.createElement('div')); - opt.append(div); - opt.data('name', i.name); - div.text(i.name); - if (i.short_description) { - var help = $(document.createElement('span')).addClass('help'); - help.text(' (' + i.short_description + ')'); - div.append(help); - } - }); - select.trigger('chosen:updated'); - select.trigger('chosen:open'); - }); - - //fix options when selected - select.on('change', function(e, params) { - var selected = $(this).find('option:selected'); - selected.text(selected.data('name')); - select.trigger('chosen:updated'); + data.forEach(function(i) { + const opt = $(document.createElement('option')); + select.append(opt); + opt.val(i.add_url); + const div = $(document.createElement('div')); + opt.append(div); + opt.data('name', i.name); + div.text(i.name); + if (i.short_description) { + const help = $(document.createElement('span')).addClass('help'); + help.text(' (' + i.short_description + ')'); + div.append(help); + } }); BootstrapDialog.show({ -- GitLab