--- trunk/lib/Frey/ClassBrowser.pm 2008/07/13 18:51:29 119
+++ trunk/lib/Frey/ClassBrowser.pm 2008/11/26 05:14:27 531
@@ -1,34 +1,86 @@
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 = '';
+ if ( $self->can('icon_path') ) {
+ $icon = $self->icon_path( $class );
+ $icon = qq|| if $icon;
+ } else {
+ warn "## $self doesn't know how to return icon_path";
+ }
+
+ my $html
+ = qq|