Added 'realm' parameter to 'embedded_link_to' helper
Change-Id: I02a2a52e350176361c8420a05cfaa254b8fe2795
diff --git a/lib/Kalamar.pm b/lib/Kalamar.pm
index 322f118..933b79b 100644
--- a/lib/Kalamar.pm
+++ b/lib/Kalamar.pm
@@ -230,7 +230,7 @@
# Set footer value
$self->content_block(footer => {
- inline => '<%= embedded_link_to "V ' . $Kalamar::VERSION . '", "korap", "kalamar" %>',
+ inline => '<%= embedded_link_to "doc", "V ' . $Kalamar::VERSION . '", "korap", "kalamar" %>',
position => 100
});
diff --git a/lib/Kalamar/Plugin/KalamarPages.pm b/lib/Kalamar/Plugin/KalamarPages.pm
index 4c49854..1943542 100644
--- a/lib/Kalamar/Plugin/KalamarPages.pm
+++ b/lib/Kalamar/Plugin/KalamarPages.pm
@@ -19,13 +19,20 @@
$mojo->helper(
embedded_link_to => sub {
my $c = shift;
+
+ # The embedded link now expects at least 3 parameters:
+ # - The realm, which is identical to the named route
+ # - The title of the link
+ # - An optional scope, which is a first level path for navigation
+ # - The page to link to (accepting a fragment)
+ my $realm = shift;
my $title = shift;
my $page = pop;
my $scope = shift;
($page, my $fragment) = split '#', $page;
- my $url = $c->url_with('doc' => page => $page, scope => $scope);
+ my $url = $c->url_with($realm, page => $page, scope => $scope);
$url->fragment($fragment) if $fragment;
$url->path->canonicalize;
@@ -42,7 +49,7 @@
doc_link_to => sub {
my $c = shift;
deprecated 'Deprecated "doc_link_to" in favor of "embedded_link_to"';
- return $c->embedded_link_to(@_)
+ return $c->embedded_link_to('doc', @_)
}
);
@@ -259,9 +266,9 @@
=head2 embedded_link_to
%# In templates
- %= embedded_link_to 'Kalamar', 'korap', 'kalamar'
+ %= embedded_link_to 'doc','Kalamar', 'korap', 'kalamar'
-Create a link to the documentation. Accepts a name, a scope, and a page.
+Create a link to the documentation. Accepts a realm, a title, a scope, and a page.
=head2 ext_link_to