NAME
Catalyst::View::Template::Lace::Role::URI - Shortcut to create a URI on the current controller
SYNOPSIS
package MyApp::View::User;
use Moo;
extends 'Catalyst::View::Template::Lace';
with 'Catalyst::View::Template::Lace::Role::URI';
sub template {q[
<html>
<head>
<title>Link Example</title>
</head>
<body>
<a>Link</a>
</body>
</html>
]}
sub process_dom {
my ($self, $dom) = @_;
$dom->at('a')
->href($self->uri('../display'));
}
DESCRIPTION
A role that gives your model object a uri
method. This method works similarly to "$c->uri_for" except that it only takes an action object or a string that is an absolute or relative (to the current controller) private name.
NOTE Since this role uses "$c->controller" to determine the 'last controller executed' you must take care to use "$c->go" rather than "$c->detach", since the latter will leave "$c->controller" to the value of the controller detached from rather then the actual last controller executed.
METHOD
This role defines the following methods
uri
$self->uri($action);
$self->uri('/user/display');
$self->uri('display');
$self->uri('../list');
First argument is an action object or a string. If a string it must be either an absolute private name to an action or a relative one
If you want to build a URI from the current action you can just pass undef
.
SEE ALSO
Catalyst::View::Template::Lace.
AUTHOR
Please See Catalyst::View::Template::Lace for authorship and contributor information.
COPYRIGHT & LICENSE
Please see Catalyst::View::Template::Lace for copyright and license information.