From 052f3ed29a7a47159c061cb6455868642598756e Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Sun, 22 Sep 2013 13:32:31 +0100 Subject: [PATCH] must update sidebar form fields before serializing them --- Netdisco/share/views/js/common.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Netdisco/share/views/js/common.js b/Netdisco/share/views/js/common.js index 61d246f0..a75f0e7c 100644 --- a/Netdisco/share/views/js/common.js +++ b/Netdisco/share/views/js/common.js @@ -44,14 +44,14 @@ } // each sidebar search form has a hidden copy of the main navbar search - // query. when the tab query takes place, copy the navbar locally, then - // replicate to all other tabs. function copy_navbar_to_sidebar (tab) { var form = '#' + tab + '_form'; + // copy navbar value to currently active sidebar form if ($('#nq').val()) { $(form).find("input[name=q]").val( $('#nq').val() ); } + // then copy to all other inactive tab sidebars $('form').find("input[name=q]").each( function() { $(this).val( $(form).find("input[name=q]").val() ); }); @@ -63,9 +63,9 @@ [% FOREACH tab IN settings._search_tabs %] $('[% "#${tab.tag}_form" %]').submit(function (event) { var pgtitle = update_page_title('[% tab.tag %]'); - update_csv_download_link('search', '[% tab.tag %]', '[% tab.provides_csv %]'); - update_browser_history('[% tab.tag %]', pgtitle); copy_navbar_to_sidebar('[% tab.tag %]'); + update_browser_history('[% tab.tag %]', pgtitle); + update_csv_download_link('search', '[% tab.tag %]', '[% tab.provides_csv %]'); do_search(event, '[% tab.tag %]'); }); [% END %] @@ -76,9 +76,9 @@ [% FOREACH tab IN settings._device_tabs %] $('[% "#${tab.tag}_form" %]').submit(function (event) { var pgtitle = update_page_title('[% tab.tag %]'); - update_csv_download_link('device', '[% tab.tag %]', '[% tab.provides_csv %]'); - update_browser_history('[% tab.tag %]', pgtitle); copy_navbar_to_sidebar('[% tab.tag %]'); + update_browser_history('[% tab.tag %]', pgtitle); + update_csv_download_link('device', '[% tab.tag %]', '[% tab.provides_csv %]'); [% IF tab.tag == 'ports' %] // to be fair I can't remember why we do this in JS and not from the app