--- trunk/lib/Frey/ClassBrowser.pm 2008/07/13 18:51:29 119 +++ trunk/lib/Frey/ClassBrowser.pm 2008/11/26 04:27:00 530 @@ -1,34 +1,81 @@ package Frey::ClassBrowser; use Moose; +extends 'Frey::ClassLoader'; with 'Frey::Web'; +with 'Frey::Session'; -use Frey::ClassLoader; +use Frey::Run; +use Data::Dump qw/dump/; -our $markup; +has 'usage_on_top' => ( + is => 'rw', + isa => 'Bool', + default => 1, + documentation => 'Show usage on top of list', +); -sub html_markup { +sub as_markup { my $self = shift; - return $markup if $markup; - my $f = Frey::ClassLoader->new; - my $classes = dom2html( - table => [ - map { - my $package = $_; - ( tr => [ - td => [ a => { href => '/~/' . $package, title => $f->package_path( $package ) } => [ $package ] ], - td => [ - $package->can('meta') ? - $package->meta->isa('Moose::Meta::Role') ? 'role' : - ( a => { href => '/od/' . $package } => [ 'design' ] ) : - '' - ], - td => [ $package->can('collection_table') ? ( a => { href => '/ob/' . $package } => [ 'collection' ] ) : '' ], - ] ) - } $f->classes - ], - ); - $markup = $classes; + my $row; + + my $usage = $self->session_dump( $self->usage ); + #warn "# usage ",dump( $usage ); + foreach my $class ( $self->classes ) { + my $icon_path; + eval { $icon_path = $self->icon_path( $class ); }; + my $html + = qq|