[aur-dev] [PATCH] Go to package when selecting a typeahead suggestion
From: Joris Steyn <jorissteyn@gmail.com> Directly jump to the package details when selecting an entry from the drop-down list. Implements FS#34471. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- web/html/home.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web/html/home.php b/web/html/home.php index ddbb0fd..e80efaa 100644 --- a/web/html/home.php +++ b/web/html/home.php @@ -118,7 +118,11 @@ $(document).ready(function() { matcher: function(item) { return true; }, sorter: function(items) { return items; }, menu: '<ul class="pkgsearch-typeahead"></ul>', - items: 20 + items: 20, + updater: function(item) { + document.location = '/packages/' + item; + return item; + } }).attr('autocomplete', 'off'); }); </script> -- 1.8.5.2
On 01/02/2014 07:52 AM, Lukas Fleischer wrote:
From: Joris Steyn <jorissteyn@gmail.com>
Directly jump to the package details when selecting an entry from the drop-down list.
Implements FS#34471. This is excellent btw thanks everyone!
Just to make sure it's not unintended: the patch is only partially applied. People still have to press enter twice to get the search query submitted, even if they're not using the typeahead dropdown. On Mon, Jan 6, 2014 at 8:32 AM, Callan <callan@zoocar.org> wrote:
On 01/02/2014 07:52 AM, Lukas Fleischer wrote:
From: Joris Steyn <jorissteyn@gmail.com>
Directly jump to the package details when selecting an entry from the drop-down list.
Implements FS#34471.
This is excellent btw thanks everyone!
On Mon, 06 Jan 2014 at 12:40:39, Joris Steyn wrote:
Just to make sure it's not unintended: the patch is only partially applied.
That is intended.
People still have to press enter twice to get the search query submitted, even if they're not using the typeahead dropdown.
This should be fixed with a separate patch. Either in the Bootstrap Typeahead plugin (in case that is the right place to fix this bug) or in the AUR itself.
[...]
From: Joris Steyn <jorissteyn@gmail.com> Currently, one has to press enter twice in order to submit the package search form with typeahead completion. Add a workaround to fix this. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- web/html/home.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/web/html/home.php b/web/html/home.php index e80efaa..62c246a 100644 --- a/web/html/home.php +++ b/web/html/home.php @@ -124,6 +124,15 @@ $(document).ready(function() { return item; } }).attr('autocomplete', 'off'); + + $('#pkgsearch-field').keydown(function(e) { + if (e.keyCode == 13) { + var selectedItem = $('ul.pkgsearch-typeahead li.active'); + if (selectedItem.length == 0) { + $('#pkgsearch-form').submit(); + } + } + }); }); </script> <?php -- 1.8.5.2
participants (3)
-
Callan
-
Joris Steyn
-
Lukas Fleischer