get rid of device_ports and self_options template vars

This commit is contained in:
Oliver Gorwits
2014-11-03 19:59:01 +00:00
parent 8277763c80
commit 799358f86c
22 changed files with 31 additions and 57 deletions

View File

@@ -370,11 +370,6 @@ together with the correct default search options set.
A path and query string which links to the Device tab of the Search page,
together with the correct default search options set.
=item C<device_ports>
A path and query sting which links to the Ports tab of the Device page,
together with the correct default column view options set.
=item C<uri_base>
Used for linking to static content within App::Netdisco safely if the base of
@@ -389,13 +384,6 @@ template safely if the base of the app is relocated:
<a href="[% uri_for('/search') %]" ...>
=item C<self_options>
Available in the Device tabs, use this if you need to refer back to the
current page with some additional parameters, for example:
<a href="[% uri_for('/device/ports', self_options) %]&foo=bar" ...>
=back
=head1 Javascript and Stylesheets

View File

@@ -82,7 +82,7 @@ hook 'before_template' => sub {
# fix Plugin Template Variables to be only path+query
$tokens->{$_} = $tokens->{$_}->path_query
for qw/search_node search_device device_ports/;
for qw/search_node search_device/;
# shorthand access to section and tabname
my @parts = split m{/}, request->path;

View File

@@ -5,20 +5,6 @@ use Dancer::Plugin::Ajax;
use Dancer::Plugin::DBIC;
use Dancer::Plugin::Auth::Extensible;
hook 'before_template' => sub {
my $tokens = shift;
# new searches will use these defaults in their sidebars
$tokens->{device_ports} = uri_for('/device/ports');
# for templates to link to same page with modified query but same options
my $self_uri = uri_for(request->path, scalar params);
$self_uri->query_param_delete('q');
$self_uri->query_param_delete('f');
$self_uri->query_param_delete('prefer');
$tokens->{self_options} = $self_uri->query_form_hash;
};
my $handler = sub {
my $q = param('q');
my ($tab) = splat;