/[Frey]/trunk/lib/Frey/Class/Browser.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

Diff of /trunk/lib/Frey/Class/Browser.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/lib/Frey/ClassBrowser.pm revision 555 by dpavlin, Thu Nov 27 17:39:00 2008 UTC trunk/lib/Frey/Class/Browser.pm revision 794 by dpavlin, Wed Dec 10 17:51:32 2008 UTC
# Line 1  Line 1 
1  package Frey::ClassBrowser;  package Frey::Class::Browser;
2  use Moose;  use Moose;
3    
4  extends 'Frey::ClassLoader';  extends 'Frey::ClassLoader';
# Line 16  has 'usage_on_top' => ( Line 16  has 'usage_on_top' => (
16          documentation => 'Show usage on top of list',          documentation => 'Show usage on top of list',
17  );  );
18    
19    our $usage;
20    
21  sub as_markup {  sub as_markup {
22          my $self = shift;          my $self = shift;
23          my $row;          my $row;
24          my @icons;          my @icons;
25    
26          my $usage = $self->session_dump( $self->usage );          $usage ||= $self->session_dump( $self->usage );
27          #warn "# usage ",dump( $usage );          #warn "# usage ",dump( $usage );
28    
29            if ( ! $self->can('icon_path') ) {
30                    $self->TODO( "re-apply Frey::Web on $self" );
31                    Frey::Web->meta->apply( $self );
32            }
33    
34          foreach my $class ( $self->classes ) {          foreach my $class ( $self->classes ) {
35    
36                  my $icon = '';                  my $icon = $self->icon_path( $class );
                 if ( ! $self->can('icon_path') ) {  
                         warn "FIXME: re-apply Frey::Web on $self";  
                         Frey::Web->meta->apply( $self );  
                 }  
                 $icon = $self->icon_path( $class );  
37                  if ($icon) {                  if ($icon) {
38                          push @icons, $icon;                          push @icons, $icon;
39                          $icon = qq|<!-- icon:$icon -->|;                          $icon = qq|<!-- icon:$icon -->|;
40                    } else {
41                            $icon = '';
42                  }                  }
43    
44                  my $html                  my $html
# Line 50  sub as_markup { Line 55  sub as_markup {
55                  }                  }
56    
57                  my @run = map {                  my @run = map {
58                            my $invoke = $_;
59                          s{^as_}{};                          s{^as_}{};
60                          qq|<a target="$class" href="/$class/as_$_" title="$class->as_$_">$_</a>|;                          s{_as_\w+}{};
61                            qq|<a target="$class" href="/$class/$invoke" title="$class->$invoke">$_</a>|;
62                  } $self->class_runnable( $class );                  } $self->class_runnable( $class );
63                  push @run, qq|<a target="$class" href="/Frey-ObjectBrowser?class=$class">collection</a>| if $class->can('collection_table');                  push @run, qq|<a target="$class" href="/Frey-ObjectBrowser?class=$class">collection</a>| if $class->can('collection_table');
64    
# Line 72  sub as_markup { Line 79  sub as_markup {
79    
80          my $icons_html = $self->combine_images( @icons );          my $icons_html = $self->combine_images( @icons );
81          sub icon {          sub icon {
82                  my $path = shift;                  my ($icons_html,$path) = @_;
                 warn "# icon $path";  
83                  $icons_html->{ $path } || die "can't find $path in ",dump($icons_html);                  $icons_html->{ $path } || die "can't find $path in ",dump($icons_html);
84          };          };
85    
86            $self->title('Frey');
87    
88          return          return
89                  qq|<table>| . join("\n",                  qq|<table>| . join("\n",
90                          map {                          map {
91                                  my $html = $row->{$_};                                  my $html = $row->{$_};
92                                  $html =~ s{<!-- icon:(\S+) -->}{icon($1)}gse;                                  $html =~ s{<!-- icon:(\S+) -->}{icon($icons_html,$1)}gse;
93                                  $html;                                  $html;
94                          }                          }
95                          sort {                          sort {

Legend:
Removed from v.555  
changed lines
  Added in v.794

  ViewVC Help
Powered by ViewVC 1.1.26