From ba5dc6ab0269c06613cd9e8ee6387b50f2793f20 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 12 Sep 2013 06:51:00 -0700 Subject: [PATCH] Added some autocomplete Javascript magic. Not sure how this got missed the first time around. --- tailbone/static/js/tailbone.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tailbone/static/js/tailbone.js b/tailbone/static/js/tailbone.js index 5ac3c049..eac2ebd1 100644 --- a/tailbone/static/js/tailbone.js +++ b/tailbone/static/js/tailbone.js @@ -248,6 +248,24 @@ $(function() { }); + /* + * Whenever the "change" button is clicked within the context of an + * autocomplete field, hide the static display and show the autocomplete + * textbox. + */ + $('div.autocomplete-container button.autocomplete-change').click(function() { + var container = $(this).parents('div.autocomplete-container'); + var textbox = container.find('input.autocomplete-textbox'); + + container.find('input[type="hidden"]').val(''); + container.find('div.autocomplete-display').hide(); + + textbox.val(''); + textbox.show(); + textbox.select(); + textbox.focus(); + }); + /* * Add "check all" functionality to tables with checkboxes. */