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

Annotation of /trunk/lib/Frey/ClassBrowser.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 427 - (hide annotations)
Tue Nov 18 23:42:40 2008 UTC (15 years, 5 months ago) by dpavlin
File size: 1186 byte(s)
don't cache markup, reformat html into new quite readable form
1 dpavlin 119 package Frey::ClassBrowser;
2     use Moose;
3    
4 dpavlin 308 extends 'Frey::ClassLoader';
5 dpavlin 418 with 'Frey::Web';
6 dpavlin 119
7 dpavlin 223 use Frey::Run;
8 dpavlin 119
9 dpavlin 121 sub markup {
10 dpavlin 308 my $self = shift;
11 dpavlin 427 my @rows;
12 dpavlin 308 foreach my $class ( $self->classes ) {
13 dpavlin 427 my $html
14     = qq|<tr><td><a href="/$class" title="|
15     . $self->class_path( $class )
16     . qq|">$class</a></td><td>|
17     ;
18 dpavlin 308 if ( $class->can('meta') ) {
19     if ( $class->meta->isa('Moose::Meta::Role') ) {
20 dpavlin 144 $html .= qq|role|;
21     } else {
22 dpavlin 308 $html .= qq|<a href="/Frey-ObjectDesigner?class=$class">design</a>| if $class->can('collection');
23 dpavlin 144 }
24     }
25 dpavlin 408 my @run;
26     my @input;
27     push @run, qq|<a href="/Frey-ObjectBrowser?class=$class">collection</a>| if $class->can('collection_table');
28 dpavlin 409 my $class_method = $self->class_methods( $class );
29 dpavlin 314 foreach my $try ( Frey::Run->runnable ) {
30 dpavlin 408 next unless $class->can($try);
31 dpavlin 409 if ( $class_method->{ $try } ) {
32 dpavlin 408 push @run, qq|<a href="/$class/$try">$try</a>|;
33     } else {
34     push @input, $try;
35     }
36 dpavlin 223 }
37 dpavlin 427 $html
38     .= qq|</td><td>|
39     . join(' ', @run)
40     . qq|</td><td>|
41     . ( @input ? '&larr; ' . join(' ', @input) : '' )
42     . qq|</td></tr>|
43     ;
44     push @rows, $html if $html;
45 dpavlin 144 }
46 dpavlin 427 return qq|<table>| . join("\n", @rows) . qq|</table>| if @rows;
47 dpavlin 119 }
48    
49     1;

  ViewVC Help
Powered by ViewVC 1.1.26