NAME

Catalyst::View::Template::Lace::Role::URI - Shortcut to create a URI on the current controller

SYNOPSIS

package  MyApp::View::User;

use Moo;
use Template::Lace::Utils 'mk_component';
extends 'Catalyst::View::Template::Lace';
with 'Template::Lace::ModelRole',
  '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.

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

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.