From 52468b0ac0818c4ce7e332a229801bda5c9dec49 Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Mon, 27 Aug 2012 20:50:45 +0100 Subject: [PATCH] Set focus to navbar search on initial login or when changing to home (closes #24) --- Changes | 1 + Netdisco/public/javascripts/netdisco.js | 9 +++++++++ Netdisco/views/index.tt | 2 ++ Netdisco/views/js/common.js | 9 --------- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Changes b/Changes index f28a2ebb..77535ac2 100644 --- a/Changes +++ b/Changes @@ -5,6 +5,7 @@ * Icon to copy Navbar search text to Device Search Options field (closes #11) * Typeahead on the main navbar search (for devices only) * Support for have_nodeip_dns_col setting (closes #14) + * Set focus to navbar search on initial login or when changing to home (closes #24) [ENHANCEMENTS] diff --git a/Netdisco/public/javascripts/netdisco.js b/Netdisco/public/javascripts/netdisco.js index f20d23d2..9b191f27 100644 --- a/Netdisco/public/javascripts/netdisco.js +++ b/Netdisco/public/javascripts/netdisco.js @@ -121,6 +121,15 @@ if (window.History && window.History.enabled) { } $(document).ready(function() { + // activate typeahead on the main search box, for device names only + $('#nq').typeahead({ + source: function (query, process) { + return $.get('/ajax/data/device/typeahead', { query: query }, function (data) { + return process(data); + }); + } + }); + // activate tooltips $("[rel=tooltip]").tooltip({live: true}); diff --git a/Netdisco/views/index.tt b/Netdisco/views/index.tt index 4f5ca4c5..6726810b 100644 --- a/Netdisco/views/index.tt +++ b/Netdisco/views/index.tt @@ -46,6 +46,8 @@ [% END %] + [% ELSE %] + [% END %] diff --git a/Netdisco/views/js/common.js b/Netdisco/views/js/common.js index 2761c91e..7c6b6541 100644 --- a/Netdisco/views/js/common.js +++ b/Netdisco/views/js/common.js @@ -8,13 +8,4 @@ [% IF params.tab %] $('#[% params.tab %]_form').trigger("submit"); [% END %] - - // enable typeahead on the main search box, for device names only - $('#nq').typeahead({ - source: function (query, process) { - return $.get('/ajax/data/device/typeahead', { query: query }, function (data) { - return process(data); - }); - } - }); });