diff options
author | Maurício Meneghini Fauth <mauricio@fauth.dev> | 2022-06-19 08:48:06 +0300 |
---|---|---|
committer | Maurício Meneghini Fauth <mauricio@fauth.dev> | 2022-06-19 22:48:10 +0300 |
commit | 8cee1399cc111a47433fa146c68c349068156154 (patch) | |
tree | 54569bd225f7af4adba0155bc150c4f8883ca792 | |
parent | 799bf45f54fd686a7e90f0c61ab68f62aba29b11 (diff) |
Extract inline JS from sql/query template
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
-rw-r--r-- | js/src/sql.js | 5 | ||||
-rw-r--r-- | templates/sql/query.twig | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/js/src/sql.js b/js/src/sql.js index feb63ace46..4185321c29 100644 --- a/js/src/sql.js +++ b/js/src/sql.js @@ -246,6 +246,7 @@ AJAX.registerTeardown('sql.js', function () { $(document).off('click', '#view_as'); $(document).off('click', '#sqlquery'); $(document).off('click', 'input.sqlbutton'); + $('#fieldsSelect').off('dblclick'); }); /** @@ -889,6 +890,10 @@ AJAX.registerOnload('sql.js', function () { handleSimulateQueryButton(); return false; }); + + $('#fieldsSelect').on('dblclick', () => { + Functions.insertValueQuery(); + }); }); /** diff --git a/templates/sql/query.twig b/templates/sql/query.twig index 9a4bea581c..158c1a6518 100644 --- a/templates/sql/query.twig +++ b/templates/sql/query.twig @@ -60,7 +60,7 @@ <div class="col-xl-2 col-lg-3"> <div class="mb-3"> <label class="visually-hidden" for="fieldsSelect">{% trans 'Columns' %}</label> - <select class="form-control resize-vertical" id="fieldsSelect" name="dummy" size="{{ textarea_rows }}" ondblclick="Functions.insertValueQuery()" multiple> + <select class="form-control resize-vertical" id="fieldsSelect" name="dummy" size="{{ textarea_rows }}" multiple> {% for field in columns_list %} <option value="{{ backquote(field['Field']) }}" {{- field['Field'] is not null and field['Comment'] is not null and field['Field']|length > 0 ? ' title="' ~ field['Comment'] ~ '"' }}> |