2 |
use Moose; |
use Moose; |
3 |
|
|
4 |
extends 'Frey'; |
extends 'Frey'; |
|
with 'Frey::Web'; |
|
5 |
|
|
6 |
use Frey::ClassLoader; |
use Frey::ClassLoader; |
7 |
|
|
8 |
our $markup; |
our $markup; |
9 |
|
|
10 |
sub markup { |
sub markup { |
11 |
|
return $markup if $markup; |
12 |
my $f = Frey::ClassLoader->new; |
my $f = Frey::ClassLoader->new; |
13 |
my $classes = dom2html( |
my $html; |
14 |
table => [ |
foreach my $package ( $f->classes ) { |
15 |
map { |
$html .= qq|<tr><td><a href="/~/$package" title="| . $f->package_path( $package ) . qq|">$package</a></td><td>|; |
16 |
my $package = $_; |
if ( $package->can('meta') ) { |
17 |
( tr => [ |
if ( $package->meta->isa('Moose::Meta::Role') ) { |
18 |
td => [ a => { href => '/~/' . $package, title => $f->package_path( $package ) } => [ $package ] ], |
$html .= qq|role|; |
19 |
td => [ |
} else { |
20 |
$package->can('meta') ? |
$html .= qq|<a href="/od/$package">design</a>| if $package->can('collection'); |
21 |
$package->meta->isa('Moose::Meta::Role') ? 'role' : |
} |
22 |
( a => { href => '/od/' . $package } => [ 'design' ] ) : |
} |
23 |
'' |
my @inspect; |
24 |
], |
push @inspect, qq|<a href="/ob/$package">collection</a>| if $package->can('collection_table'); |
25 |
td => [ $package->can('collection_table') ? ( a => { href => '/ob/' . $package } => [ 'collection' ] ) : '' ], |
push @inspect, qq|<a href="/markup/$package">markup</a>| if $package->can('markup'); |
26 |
] ) |
push @inspect, qq|<a href="/request/$package">request</a>| if $package->can('request'); |
27 |
} $f->classes |
$html .= qq|</td><td>| . join(' ', @inspect) . qq|</td></tr>|; |
28 |
], |
} |
29 |
); |
$html = "<table>$html</table>" if $html; |
30 |
$markup = $classes; |
$markup = $html; |
|
} |
|
|
|
|
|
sub html { |
|
|
my ( $self, $req ) = @_; |
|
|
my $html = $self->page( body => qq|<h1>Classes</h1>| . $self->markup ); |
|
|
$req->print( $html ); |
|
31 |
} |
} |
32 |
|
|
33 |
1; |
1; |