115 |
$out .= "\t\t},\n\t\tmeta: Frey.HTML, |
$out .= "\t\t},\n\t\tmeta: Frey.HTML, |
116 |
classMethods: { |
classMethods: { |
117 |
renderHTML: function () { |
renderHTML: function () { |
118 |
return new Joose.SimpleRequest().getText(\"inspect?module=$m;class=$c\") |
return new Joose.SimpleRequest().getText(\"/~/${m}::${c}\") |
119 |
},\n"; |
},\n"; |
120 |
|
|
121 |
$out .= "\t\t},\n"; |
$out .= "\t\t},\n"; |
177 |
|
|
178 |
while (1) { |
while (1) { |
179 |
|
|
180 |
my $js = [ map { |
my $js = Continuity::Widget::DomNode->create( |
181 |
( script => { type => 'text/javascript', src => $_ } ) |
map { |
182 |
} @javascript ]; |
( script => { type => 'text/javascript', src => $_ } ) |
183 |
warn "# js = ",dump( $js ); |
} @javascript |
184 |
|
)->to_string; |
185 |
|
|
186 |
|
$js .= << '__END_OF_JS__'; |
187 |
|
<script type="text/javascript"> |
188 |
|
joose.loadComponents("../lib") |
189 |
|
|
190 |
my $o; |
function $(id) { |
191 |
|
return document.getElementById(id) |
192 |
|
} |
193 |
|
|
194 |
|
</script> |
195 |
|
__END_OF_JS__ |
196 |
|
|
197 |
|
warn "# >>> js\n$js\n"; |
198 |
|
|
199 |
|
my $methods; |
200 |
|
|
201 |
my ( $class, $meta, $is_role ) = $self->load_package(); |
my ( $class, $meta, $is_role ) = $self->load_package(); |
202 |
if ( $class->can('meta') ) { |
if ( $class->can('meta') ) { |
203 |
$o = Continuity::Widget::DomNode->create( |
$methods = Continuity::Widget::DomNode->create( |
204 |
ul => [ |
ul => [ |
205 |
map { ( |
map { ( |
206 |
li => [ a => { href => $_ } => [ $_ ] ] |
li => [ a => { href => '/~/' . $self->package . '/' . $_ } => [ $_ ] ] |
207 |
) } $self->methods |
) } $self->methods |
208 |
] |
] |
209 |
)->to_string; |
)->to_string; |
210 |
} else { |
} else { |
211 |
$o = '<b>not introspectable</b>'; |
$methods = '<b>not introspectable</b>'; |
212 |
} |
} |
213 |
|
|
214 |
warn "# o = ",dump( $o ); |
my $attributes = Continuity::Widget::DomNode->create( |
215 |
|
ul => [ |
216 |
|
map { |
217 |
|
my $attr = $class->get_attribute($_); |
218 |
|
warn "## $_ ", $attr->is_required ? 'required' : 'optional'; |
219 |
|
( li => [ a => { href => '/~/' . $self->package . '/' . $_ } => [ $_, ( $attr->is_required ? ' <b>required</b>' : '' ) ] ] ) |
220 |
|
} $class->get_attribute_list |
221 |
|
], |
222 |
|
)->to_string; |
223 |
|
|
224 |
my $doc = Continuity::Widget::DomNode->create( |
my $doc = Continuity::Widget::DomNode->create( |
225 |
html => [ |
html => [ |
226 |
head => [ |
head => [ |
227 |
link => { rel=>"stylesheet", href=>"/static/app.css", type=>"text/css", media=>"screen" }, |
link => { rel=>"stylesheet", href=>"/static/app.css", type=>"text/css", media=>"screen" }, |
228 |
# $js, |
$js, |
229 |
|
title => [ 'Introspect ', $self->package ], |
230 |
], |
], |
231 |
body => [ |
body => [ |
232 |
h1 => [ 'Introspect ', $self->package ], |
h1 => [ $self->package ], |
233 |
$o, |
h2 => [ 'Methods' ], |
234 |
|
$methods, |
235 |
|
h2 => [ 'Atrributes' ], |
236 |
|
$attributes, |
237 |
], |
], |
238 |
] |
] |
239 |
); |
); |
240 |
|
|
241 |
$request->print($doc->to_string); |
$request->print($doc->to_string); |
242 |
warn "# html = ", $doc->to_string; |
warn "# >>> html\n", $doc->to_string, "\n"; |
243 |
$request->next; |
$request->next; |
244 |
} |
} |
245 |
warn "# exit html"; |
warn "# exit html"; |