From aa85133ae4463f1b23045fb7543aa1eda606f147 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Wed, 14 Feb 2018 14:02:16 +0100 Subject: [PATCH] =?utf8?q?Controller::Base:=20url=5Ffor=20unterst=C3=BCtzt?= =?utf8?q?=20jetzt=20URI=20fragments.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Controller/Base.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SL/Controller/Base.pm b/SL/Controller/Base.pm index 01da48b01..d10ba805c 100644 --- a/SL/Controller/Base.pm +++ b/SL/Controller/Base.pm @@ -29,6 +29,7 @@ sub url_for { my %params = ref($_[0]) eq 'HASH' ? %{ $_[0] } : @_; my $controller = delete($params{controller}) || $self->controller_name; my $action = $params{action} || 'dispatch'; + my $fragment = delete $params{hash} // delete $params{fragment} // ''; my $script; if ($controller =~ m/\.pl$/) { @@ -41,7 +42,7 @@ sub url_for { my $query = join '&', map { uri_encode($_->[0]) . '=' . uri_encode($_->[1]) } @{ flatten(\%params) }; - return "${script}?${query}"; + return "${script}?${query}" . ($fragment ? "#$fragment" : ''); } sub redirect_to { -- 2.20.1