--- trunk/lib/Frey/Web.pm 2008/11/20 13:57:38 477 +++ trunk/lib/Frey/Web.pm 2008/11/25 14:58:59 518 @@ -7,11 +7,12 @@ use Continuity::Widget::DomNode; use Data::Dump qw/dump/; -use Carp qw/confess/; +use Carp qw/confess cluck/; use File::Slurp; use Frey::Bookmarklet; use Frey::ClassBrowser; +use Frey::SVK; has 'head' => ( is => 'rw', @@ -24,8 +25,8 @@ isa => 'ArrayRef[HashRef[Str]]', lazy => 1, default => sub { [ - { 'ClassBrowser' => Frey::ClassBrowser->new( usage_on_top => 0 )->as_markup }, - { 'Bookmarklets' => Frey::Bookmarklet->new->as_markup }, +# { 'ClassBrowser' => Frey::ClassBrowser->new( usage_on_top => 0 )->as_markup }, +# { 'Bookmarklets' => Frey::Bookmarklet->new->as_markup }, ] }, ); @@ -156,11 +157,6 @@ my $status_line = ''; foreach my $part ( @{ $self->status } ) { - if ( ref($part) ne 'HASH' ) { - warn "part not hash ",dump( $part ) ; - #$self->status( $part ); - next; - } foreach my $name ( keys %$part ) { my $content = $part->{$name}; if ( ref($content) ) { @@ -188,10 +184,25 @@ $body = ''; } + my $warn_colors = { + '#' => '#444', + '##' => '#888', + }; + $status_line - .= qq|warn| - . $self->editor_links( join("", $self->warnings ) ) - . qq|| + .= qq|warn| + . $self->editor_links( + join("", map { + warn "# $_"; + my $style = ''; + $style = $warn_colors->{$1} + ? ' style="color:' . $warn_colors->{$1} . '"' + : '' + if m{^(#+)}; + qq|$_
|; # XXX should be but CSS hates me + } $self->warnings ) + ) + . qq|
| if $self->warnings; my ($exit,$description) = ('exit','stop server'); @@ -206,6 +217,10 @@ |; + my $info = Frey::SVK->info; + my $revision = Frey::SVK->info->{Revision} || ''; + $revision = $1 if $info->{'Mirrored From'} =~ m{Rev\.\s+(\d+)}; + my $html = join("\n", qq||, $self->_head_html, @@ -216,7 +231,7 @@ $body
- Frey $Frey::VERSION + Frey $Frey::VERSION $revision $status_line $right
@@ -229,6 +244,31 @@ return $html; } +=head2 editor + +Create HTML editor link with optional line and title + + my $html = $self->editor( $class, $line, $title ); + +=cut + +sub editor { + my ( $self, $class, $line, $title ) = @_; + confess "need class" unless $class; + $line ||= 1; + qq|$class|; +} + +=head2 editor_links + +Create HTML links to editor for perl error message + + my $html = $self->editor_links( $error ) + +=cut + sub editor_links { my ( $self, $error ) = @_; @@ -256,4 +296,14 @@ ; } +sub add_status { + my ( $self, $data ) = @_; + push @{ $self->status }, $data; +} + +sub DEMOLISH { + my ( $self ) = @_; + cluck "## DEMOLISH status ", $#{ $self->status } + 1, " elements ", dump( map { keys %$_ } @{ $self->status } ); +} + 1;