/[Frey]/trunk/lib/Frey/Web/Links.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/lib/Frey/Web/Links.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 111 - (show annotations)
Sun Jul 13 16:17:34 2008 UTC (14 years, 4 months ago) by dpavlin
File size: 797 byte(s)
implemented pager for collection [0.10]
1 package Frey::Web::Links;
2 use Moose;
3
4 =head1 NAME
5
6 Frey::Web::Links - simple links to current page with one param
7
8 =cut
9
10 has 'name' => (
11 'is' => 'rw',
12 isa => 'Str',
13 required => 1,
14 );
15
16 has 'current' => (
17 is => 'rw',
18 isa => 'Str',
19 required => 1,
20 );
21
22 has 'values' => (
23 is => 'rw',
24 isa => 'ArrayRef[Str]',
25 required => 1,
26 );
27
28 has 'current_tag' => (
29 is => 'rw',
30 isa => 'Str',
31 default => 'em',
32 );
33
34 has 'delimiter' => (
35 is => 'rw',
36 isa => 'Str',
37 default => ' ',
38 );
39
40 sub links {
41 my $self = shift;
42 my @out =
43 map {
44 if ( $self->current eq $_ ) {
45 '<' . $self->current_tag . '>' . $_ . '</' . $self->current_tag . '>'
46 } else {
47 qq|<a href="?| . $self->name . qq|=$_">$_</a>|
48 }
49 } ( @{ $self->values } );
50 return @out if wantarray;
51 return join($self->delimiter, @out);
52 }
53
54 1;

  ViewVC Help
Powered by ViewVC 1.1.26