Adding current route to allow open in the browser more easily.
This commit is contained in:
parent
e3f50b2c33
commit
64083df353
@ -19,12 +19,13 @@ sub startup ($self) {
|
|||||||
);
|
);
|
||||||
$self->hook(
|
$self->hook(
|
||||||
before_render => sub($c, $args) {
|
before_render => sub($c, $args) {
|
||||||
|
my $current_route = $c->url_for;
|
||||||
|
$c->stash(current_route => $current_route);
|
||||||
my $onion_base_url = $self->config->{onion_base_url};
|
my $onion_base_url = $self->config->{onion_base_url};
|
||||||
my $base_url = $self->config->{base_url};
|
my $base_url = $self->config->{base_url};
|
||||||
if (!defined $onion_base_url) {
|
if (!defined $onion_base_url) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
my $current_route = $c->url_for;
|
|
||||||
$current_route =~ s/^$base_url//;
|
$current_route =~ s/^$base_url//;
|
||||||
$c->res->headers->header('Onion-Location' => $onion_base_url.$current_route);
|
$c->res->headers->header('Onion-Location' => $onion_base_url.$current_route);
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
%= include 'page/_desktop_menu', categories => $categories, current_category_slug => $current_category_slug
|
%= include 'page/_desktop_menu', categories => $categories, current_category_slug => $current_category_slug
|
||||||
%= include 'page/_mobile_foldable', categories => $categories
|
%= include 'page/_mobile_foldable', categories => $categories
|
||||||
<div class="description android open-browser-container">
|
<div class="description android open-browser-container">
|
||||||
<a href="#" class="open-in-browser">
|
<a href="<%= $current_route %>" class="open-in-browser">
|
||||||
<img alt="" src="/img/firefox.svg"/>
|
<img alt="" src="/img/firefox.svg"/>
|
||||||
<span>Abrir en el navegador.</span>
|
<span>Abrir en el navegador.</span>
|
||||||
</a>
|
</a>
|
||||||
|
Loading…
Reference in New Issue
Block a user