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

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

revision 120 by dpavlin, Sun Jul 13 19:46:10 2008 UTC revision 133 by dpavlin, Tue Jul 15 13:58:07 2008 UTC
# Line 138  sub html { Line 138  sub html {
138    
139          while (1) {          while (1) {
140    
                 my $js = $self->head_javascript;  
                 $js .= << '__END_OF_JS__';  
 <script type="text/javascript">  
 joose.loadComponents("../lib")  
   
 function $(id) {  
         return document.getElementById(id)  
 }  
   
 </script>  
 __END_OF_JS__  
   
141                  my ( $class, $meta, $is_role ) = $self->load_package;                  my ( $class, $meta, $is_role ) = $self->load_package;
142    
143                  my $package = $self->package;                  my $package = $self->package;
# Line 161  __END_OF_JS__ Line 149  __END_OF_JS__
149                  if ( $class->get_attribute_list ) {                  if ( $class->get_attribute_list ) {
150                  @attributes = map {                  @attributes = map {
151                                  my $attr = $class->get_attribute($_);                                  my $attr = $class->get_attribute($_);
152  #                               warn "## $_ ", $attr->is_required ? 'required' : 'optional';                                  my ( $before, $title, $after ) = ( '', '', '' );
153                                  qq|<td><a href="/~/$package/$_?">$_</a></td><td>| .                                  ( $before, $title, $after ) = ( '<b>', ' title="required"', '</b>' ) if $attr->is_required;
154                                  ( $attr->is_required ? ' <b>required</b>' : '' ) .                                  qq|<td>$before<a href="/~/$package/$_?"$title>$_</a>$after</td>|
                                 qq|</td>|;  
155                          } sort $class->get_attribute_list                          } sort $class->get_attribute_list
156                  }                  }
157    
# Line 179  __END_OF_JS__ Line 166  __END_OF_JS__
166    
167                  my $classes =                  my $classes =
168                          qq|<div class="classes">| .                          qq|<div class="classes">| .
169                          Frey::ClassBrowser->new->html_markup .                          Frey::ClassBrowser->new->markup .
170                          qq|</div>|;                          qq|</div>|;
171    
172                  my $html = dom2html(                  $self->add_css( 'static/introspect.css' );
173                          html => [  
174                                  head => [                  warn "## css = ",dump( $self->css );
175                                          link => { rel=>"stylesheet", href=>"/static/app.css", type=>"text/css", media=>"screen" },  
176                                          $js,                  my $superclasses = 'Role';
177                                          title => [ 'Introspect ', $self->package ],                  $superclasses = 'Superclasses: ' . join(', ',
178                                  ],                          map {
179                                  body => [                                  my $s = $_->meta->name;
180                                          h1 => [ $self->package ],                                  qq|<a href="/~/$s">$s</a>|
181                                          $table,                          }
182                                          $classes,                          #grep { $_ ne 'Moose::Object' }
183                                  ],                          $meta->superclasses
184                          ]                  ) if ! $is_role && $meta->superclasses;
185    
186                    my $pod = Frey::Pod->new( class => $package )->markup;
187    
188                    my $html = $self->page(
189                            title => "Introspect $package",
190                            body => qq|<h1>$package</h1>|
191                                    . ( $pod ? qq|<a href="#___top" title="Skip to POD" style="font-size: 80%; color: #aaa;">&darr;pod&darr</a>  | : '' )
192                                    . qq|$superclasses\n$table\n$pod\n$classes|,
193    
194                  );                  );
195    
196                  $request->print($html);                  $request->print($html);

Legend:
Removed from v.120  
changed lines
  Added in v.133

  ViewVC Help
Powered by ViewVC 1.1.26