fix cookies
This commit is contained in:
@@ -89,7 +89,7 @@ hook 'before' => sub {
|
||||
guard { setting('sidebar_defaults')->{$key} = $defaults };
|
||||
|
||||
# otherwise update defaults to contain the passed url params
|
||||
setting('sidebar_defaults')->{$key}->{$_}->{'default'} = params->{$_}
|
||||
setting('sidebar_defaults')->{$key}->{$_}->{'default'} = param($_)
|
||||
for keys %{ $defaults };
|
||||
};
|
||||
|
||||
@@ -140,8 +140,8 @@ hook 'before_template' => sub {
|
||||
}
|
||||
|
||||
# helper from NetAddr::MAC for the MAC formatting
|
||||
$tokens->{mac_format_call} = 'as_'. lc(params->{'mac_format'})
|
||||
if params->{'mac_format'};
|
||||
$tokens->{mac_format_call} = 'as_'. lc(param('mac_format'))
|
||||
if param('mac_format');
|
||||
|
||||
# allow very long lists of ports
|
||||
$Template::Directive::WHILE_MAX = 10_000;
|
||||
|
||||
@@ -60,11 +60,12 @@ hook 'before' => sub {
|
||||
};
|
||||
|
||||
hook 'before_template' => sub {
|
||||
return unless var('sidebar_key') and (var('sidebar_key') eq 'device_ports');
|
||||
return if param('reset')
|
||||
or not var('sidebar_key') or (var('sidebar_key') ne 'device_ports');
|
||||
|
||||
my $uri = URI->new();
|
||||
foreach my $key (keys %{ setting('sidebar_defaults')->{'device_ports'} }) {
|
||||
$uri->query_param($key => params->{$key}) if params->{$key};
|
||||
$uri->query_param($key => param($key)) if exists params->{$key};
|
||||
}
|
||||
cookie('nd_ports-form' => $uri->query(), expires => '365 days');
|
||||
};
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<i class="nd_sidebar-toggle icon-wrench icon-large" id="nd_sidebar-toggle-img-out"
|
||||
rel="tooltip" data-placement="left" data-offset="5" data-title="Show Sidebar"></i>
|
||||
<div class="container-fluid">
|
||||
<div class="nd_sidebar nd_sidebar-pinned">
|
||||
<div class="nd_sidebar">
|
||||
<div class="well">
|
||||
<i class="nd_sidebar-toggle icon-signout" id="nd_sidebar-toggle-img-in"
|
||||
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"
|
||||
<i class="nd_sidebar-pin icon-pushpin"
|
||||
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"
|
||||
|
||||
@@ -93,14 +93,14 @@
|
||||
|
||||
[% IF tab.tag == 'ports' %]
|
||||
// form reset icon on ports tab
|
||||
$('#nd_sidebar-reset-link').attr('href', uri_base + '/device?tab=[% tab.tag %]&reset=on&' +
|
||||
$('#nd_sidebar-reset-link').attr('href', uri_base + '/device?tab=[% tab.tag %]&reset=on&firstsearch=on&' +
|
||||
$('#ports_form')
|
||||
.find('input[name="q"],input[name="f"],input[name="partial"],input[name="invert"]')
|
||||
.serialize());
|
||||
|
||||
[% ELSIF tab.tag == 'netmap' %]
|
||||
// form reset icon on netmap tab
|
||||
$('#nd_sidebar-reset-link').attr('href', uri_base + '/device?tab=[% tab.tag %]&reset=on&' +
|
||||
$('#nd_sidebar-reset-link').attr('href', uri_base + '/device?tab=[% tab.tag %]&reset=on&firstsearch=on&' +
|
||||
$('#netmap_form').find('input[name="q"]').serialize());
|
||||
[% END %]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user