update undo icon link

This commit is contained in:
Oliver Gorwits
2013-09-20 22:33:32 +01:00
parent 49399301b9
commit 204f5627e0
3 changed files with 12 additions and 4 deletions

View File

@@ -59,7 +59,7 @@ hook 'before' => sub {
my $cookie = cookie('nd_ports-form');
my $cdata = url_params_mixed($cookie);
if ($cdata and ref {} eq ref $cdata) {
if ($cdata and ref {} eq ref $cdata and not param('reset')) {
foreach my $item (@{ var('port_columns') }) {
my $key = $item->{name};
next unless defined $cdata->{$key}

View File

@@ -18,8 +18,10 @@
rel="tooltip" data-placement="left" data-offset="5" data-title="Hide Sidebar" data-container="body"></i>
<i class="nd_sidebar-pin icon-pushpin nd_sidebar-pin-clicked"
rel="tooltip" data-placement="left" data-offset="5" data-title="Unpin Sidebar" data-container="body"></i>
<a id="nd_sidebar-reset-link" href="#">
<i class="nd_sidebar-reset icon-undo"
rel="tooltip" data-placement="left" data-offset="5" data-title="Reset to Defaults" data-container="body"></i>
</a>
<div class="tab-content">
[% FOREACH tab IN settings._device_tabs %]
<div id="[% tab.tag %]_search" class="tab-pane [% 'active' IF params.tab == tab.tag %]">

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 %]');