--- trunk/lib/Frey/Introspect.pm 2008/07/05 15:19:55 53
+++ trunk/lib/Frey/Introspect.pm 2008/07/05 16:50:17 54
@@ -115,7 +115,7 @@
$out .= "\t\t},\n\t\tmeta: Frey.HTML,
classMethods: {
renderHTML: function () {
- return new Joose.SimpleRequest().getText(\"inspect?module=$m;class=$c\")
+ return new Joose.SimpleRequest().getText(\"/~/${m}::${c}\")
},\n";
$out .= "\t\t},\n";
@@ -177,43 +177,69 @@
while (1) {
- my $js = [ map {
- ( script => { type => 'text/javascript', src => $_ } )
- } @javascript ];
- warn "# js = ",dump( $js );
+ my $js = Continuity::Widget::DomNode->create(
+ map {
+ ( script => { type => 'text/javascript', src => $_ } )
+ } @javascript
+ )->to_string;
+
+ $js .= << '__END_OF_JS__';
+
+__END_OF_JS__
+
+ warn "# >>> js\n$js\n";
+
+ my $methods;
my ( $class, $meta, $is_role ) = $self->load_package();
if ( $class->can('meta') ) {
- $o = Continuity::Widget::DomNode->create(
+ $methods = Continuity::Widget::DomNode->create(
ul => [
map { (
- li => [ a => { href => $_ } => [ $_ ] ]
+ li => [ a => { href => '/~/' . $self->package . '/' . $_ } => [ $_ ] ]
) } $self->methods
]
)->to_string;
} else {
- $o = 'not introspectable';
+ $methods = 'not introspectable';
}
- warn "# o = ",dump( $o );
-
+ my $attributes = Continuity::Widget::DomNode->create(
+ ul => [
+ map {
+ my $attr = $class->get_attribute($_);
+ warn "## $_ ", $attr->is_required ? 'required' : 'optional';
+ ( li => [ a => { href => '/~/' . $self->package . '/' . $_ } => [ $_, ( $attr->is_required ? ' required' : '' ) ] ] )
+ } $class->get_attribute_list
+ ],
+ )->to_string;
+
my $doc = Continuity::Widget::DomNode->create(
html => [
head => [
link => { rel=>"stylesheet", href=>"/static/app.css", type=>"text/css", media=>"screen" },
-# $js,
+ $js,
+ title => [ 'Introspect ', $self->package ],
],
body => [
- h1 => [ 'Introspect ', $self->package ],
- $o,
+ h1 => [ $self->package ],
+ h2 => [ 'Methods' ],
+ $methods,
+ h2 => [ 'Atrributes' ],
+ $attributes,
],
]
);
$request->print($doc->to_string);
- warn "# html = ", $doc->to_string;
+ warn "# >>> html\n", $doc->to_string, "\n";
$request->next;
}
warn "# exit html";