"Undo" icon in device port sidebar to reset form to defaults

Squashed commit of the following:

commit 204f5627e0
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Fri Sep 20 22:33:32 2013 +0100

    update undo icon link

commit 49399301b9
Merge: 905a192 ce604ca
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Fri Sep 20 21:04:56 2013 +0100

    Merge branch 'master' into og-reset-cookie

commit 905a192426
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Fri Sep 20 21:04:18 2013 +0100

    fix tooltip z-index bug, add undo icon

commit 3377518634
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Fri Sep 13 08:36:16 2013 +0100

    reset params used in query
This commit is contained in:
Oliver Gorwits
2013-09-20 22:34:35 +01:00
parent ce604ca20b
commit 66bf13b714
7 changed files with 52 additions and 23 deletions

View File

@@ -4,7 +4,7 @@
var form = '#' + tab + '_form';
var query = $(form).serialize();
if (show == '1') {
if (show.length) {
$('#nd_csv-download')
.attr('href', '/ajax/content/' + type + '/' + tab + '?' + query)
.attr('download', 'netdisco-' + type + '-' + tab + '.csv')
@@ -81,6 +81,8 @@
copy_navbar_to_sidebar('[% tab.tag %]');
[% IF tab.tag == 'ports' %]
// to be fair I can't remember why we do this in JS and not from the app
// perhaps because selecting form fields to go in the cookie is easier?
var cookie = $('#ports_form').find('input,select')
.not('#nd_port-query,input[name="q"],input[name="tab"]')
.serializeArray();
@@ -88,6 +90,10 @@
cookie.push({'name': 'columns', 'value': $(this).attr('name')});
});
$.cookie('nd_ports-form', $.param(cookie) ,{ expires: 365 });
// form reset icon on ports tab
$('#nd_sidebar-reset-link').attr('href', '/device?tab=ports&reset=on&' +
$('#ports_form').find('input[name="q"],input[name="f"],input[name="partial"]').serialize())
[% END %]
do_search(event, '[% tab.tag %]');