/[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

revision 144 by dpavlin, Wed Jul 16 16:03:09 2008 UTC revision 418 by dpavlin, Tue Nov 18 16:54:10 2008 UTC
# Line 1  Line 1 
1  package Frey::ClassBrowser;  package Frey::ClassBrowser;
2  use Moose;  use Moose;
3    
4  extends 'Frey';  extends 'Frey::ClassLoader';
5  with 'Frey::Web';  with 'Frey::Web';
6    
7  use Frey::ClassLoader;  use Frey::Run;
8    
9  our $markup;  our $markup;
10    
11  sub markup {  sub markup {
12            my $self = shift;
13          return $markup if $markup;          return $markup if $markup;
         my $f = Frey::ClassLoader->new;  
14          my $html;          my $html;
15          foreach my $package ( $f->classes ) {          foreach my $class ( $self->classes ) {
16                  $html .= qq|<tr><td><a href="/~/$package" title="| . $f->package_path( $package ) . qq|">$package</a></td><td>|;                  $html .= qq|<tr><td><a href="/$class" title="| . $self->class_path( $class ) . qq|">$class</a></td><td>|;
17                  if ( $package->can('meta') ) {                  if ( $class->can('meta') ) {
18                          if ( $package->meta->isa('Moose::Meta::Role') ) {                          if ( $class->meta->isa('Moose::Meta::Role') ) {
19                                  $html .= qq|role|;                                  $html .= qq|role|;
20                          } else {                          } else {
21                                  $html .= qq|<a href="/od/$package">design</a>| if $package->can('collection');                                  $html .= qq|<a href="/Frey-ObjectDesigner?class=$class">design</a>| if $class->can('collection');
22                          }                          }
23                  }                  }
24                  $html .= qq|</td><td>|;                  my @run;
25                  $html .= qq|<a href="/ob/$package">collection</a>| if $package->can('collection_table');                  my @input;
26                  $html .= qq|</td></tr>|;                  push @run, qq|<a href="/Frey-ObjectBrowser?class=$class">collection</a>| if $class->can('collection_table');
27                    my $class_method = $self->class_methods( $class );
28                    foreach my $try ( Frey::Run->runnable ) {
29                            next unless $class->can($try);
30                            if ( $class_method->{ $try } ) {
31                                    push @run, qq|<a href="/$class/$try">$try</a>|;
32                            } else {
33                                    push @input, $try;
34                            }
35                    }
36                    $html .= qq|</td><td>| . join(' ', @run) . qq|</td><td>| .
37                            ( @input ? '&larr; ' . join(' ', @input) : '' ) .
38                            qq|</td></tr>|;
39          }          }
40          $html = "<table>$html</table>" if $html;          $html = "<table>$html</table>" if $html;
41          $markup = $html;          $markup = $html;
42  }  }
43    
 sub html {  
         my ( $self, $req ) = @_;  
         my $html = $self->page( body => qq|<h1>Classes</h1>| . $self->markup );  
         $req->print( $html );  
 }  
   
44  1;  1;

Legend:
Removed from v.144  
changed lines
  Added in v.418

  ViewVC Help
Powered by ViewVC 1.1.26