/[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 187 by dpavlin, Sat Sep 13 15:31:54 2008 UTC revision 427 by dpavlin, Tue Nov 18 23:42:40 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;
   
 our $markup;  
8    
9  sub markup {  sub markup {
10          return $markup if $markup;          my $self = shift;
11          my $f = Frey::ClassLoader->new;          my @rows;
12          my $html;          foreach my $class ( $self->classes ) {
13          foreach my $package ( $f->classes ) {                  my $html
14                  $html .= qq|<tr><td><a href="/~/$package" title="| . $f->package_path( $package ) . qq|">$package</a></td><td>|;                          = qq|<tr><td><a href="/$class" title="|
15                  if ( $package->can('meta') ) {                          . $self->class_path( $class )
16                          if ( $package->meta->isa('Moose::Meta::Role') ) {                          . qq|">$class</a></td><td>|
17                            ;
18                    if ( $class->can('meta') ) {
19                            if ( $class->meta->isa('Moose::Meta::Role') ) {
20                                  $html .= qq|role|;                                  $html .= qq|role|;
21                          } else {                          } else {
22                                  $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');
23                            }
24                    }
25                    my @run;
26                    my @input;
27                    push @run, qq|<a href="/Frey-ObjectBrowser?class=$class">collection</a>| if $class->can('collection_table');
28                    my $class_method = $self->class_methods( $class );
29                    foreach my $try ( Frey::Run->runnable ) {
30                            next unless $class->can($try);
31                            if ( $class_method->{ $try } ) {
32                                    push @run, qq|<a href="/$class/$try">$try</a>|;
33                            } else {
34                                    push @input, $try;
35                          }                          }
36                  }                  }
37                  my @inspect;                  $html
38                  push @inspect, qq|<a href="/ob/$package">collection</a>| if $package->can('collection_table');                          .= qq|</td><td>|
39                  push @inspect, qq|<a href="/markup/$package">markup</a>| if $package->can('markup');                          . join(' ', @run)
40                  push @inspect, qq|<a href="/html/$package">html</a>| if $package->can('html');                          . qq|</td><td>|
41                  $html .= qq|</td><td>| . join('&nbsp;', @inspect) . qq|</td></tr>|;                          . ( @input ? '&larr; ' . join(' ', @input) : '' )
42                            . qq|</td></tr>|
43                            ;
44                    push @rows, $html if $html;
45          }          }
46          $html = "<table>$html</table>" if $html;          return qq|<table>| . join("\n", @rows) . qq|</table>| if @rows;
         $markup = $html;  
 }  
   
 sub html {  
         my ( $self, $req ) = @_;  
         my $html = $self->page( body => qq|<h1>Classes</h1>| . $self->markup );  
         $req->print( $html );  
47  }  }
48    
49  1;  1;

Legend:
Removed from v.187  
changed lines
  Added in v.427

  ViewVC Help
Powered by ViewVC 1.1.26