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