Bugzilla – Attachment 160088 Details for
Bug 35509
Make SQL autocomplete an optional feature
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35509: Add a way to disable SQL autocompletion
Bug-35509-Add-a-way-to-disable-SQL-autocompletion.patch (text/plain), 4.42 KB, created by
Lucas Gass (lukeg)
on 2023-12-19 23:34:14 UTC
(
hide
)
Description:
Bug 35509: Add a way to disable SQL autocompletion
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2023-12-19 23:34:14 UTC
Size:
4.42 KB
patch
obsolete
>From bbbed44cb227460fa665ae83f189f01e0a7e4011 Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Tue, 19 Dec 2023 23:30:56 +0000 >Subject: [PATCH] Bug 35509: Add a way to disable SQL autocompletion > >To test: >1. APPLY PATCH >2. Create or edit a report >3. Notice the "Use SQL autocomplete:" checkbox when creating or editing a report >4. Try checking/unchecking the box and make sure that autocompletion turns off when it is unchecked and is on when it is checked. >--- > .../modules/reports/guided_reports_start.tt | 35 +++++++++++++++---- > 1 file changed, 28 insertions(+), 7 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt >index 74d9315a4e..93461ff577 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt >@@ -796,6 +796,10 @@ > <label for="notes">Notes:</label> > <textarea name="notes" id="notes"></textarea> > </li> >+ <li> >+ <label for="use-autocomplete">Use SQL autocomplete:</label> >+ <input id="use-autocomplete" type="checkbox" /> >+ </li> > </ol> > </fieldset> > <fieldset class="action"><input type="hidden" name="phase" value="Save Report" /> >@@ -1277,6 +1281,10 @@ > <label for="notes">Notes:</label> > <textarea id="notes" name="notes" cols="50" rows="2">[% notes | html %]</textarea> > </li> >+ <li> >+ <label for="use-autocomplete">Use SQL autocomplete:</label> >+ <input id="use-autocomplete" type="checkbox" /> >+ </li> > </ol> > </fieldset> <!-- /.rows --> > >@@ -1391,6 +1399,10 @@ > <label for="notes">Notes:</label> > <textarea id="notes" name="notes" cols="50" rows="2">[% notes | html %]</textarea> > </li> >+ <li> >+ <label for="use-autocomplete">Use SQL autocomplete:</label> >+ <input id="use-autocomplete" type="checkbox" /> >+ </li> > </ol> > </fieldset> <!-- /.rows --> > >@@ -1576,6 +1588,14 @@ > [% END %] > > [% IF ( create || editsql || save ) %] >+ if ( Cookies.get("use-autocomplete") == "true" ) { >+ $('#use-autocomplete').prop('checked' , true ); >+ } >+ >+ $('#use-autocomplete').on( "change", function(){ >+ Cookies.set("use-autocomplete", $(this).is(':checked'), { expires: 365, sameSite: 'Lax' }); >+ location.reload(true); >+ }); > > var editor = CodeMirror.fromTextArea(sql, { > lineNumbers: true, >@@ -1645,13 +1665,14 @@ > "220": "backslash", > "222": "quote" > } >- //Trigger auto-complete on all keys not in dictionary of exclusions above. >- editor.on("keyup", function(cm, e) { >- if (ExcludedTriggerKeys[e.keyCode] == undefined) { >- CodeMirror.commands.autocomplete(editor, null, { completeSingle: false }); >- } >- }) >- >+ if ( Cookies.get("use-autocomplete") == "true" ) { >+ //Trigger auto-complete on all keys not in dictionary of exclusions above. >+ editor.on("keyup", function(cm, e) { >+ if (ExcludedTriggerKeys[e.keyCode] == undefined) { >+ CodeMirror.commands.autocomplete(editor, null, { completeSingle: false }); >+ } >+ }); >+ } > // https://stackoverflow.com/questions/2086287/how-to-clear-jquery-validation-error-messages#answer-16025232 > function clearValidation( formElement ){ > // formElement should be a jQuery object >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 35509
: 160088