[Jifty-commit] r4916 - in jifty/trunk: . lib/Jifty/Plugin
share/web/static/js
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Wed Jan 23 20:11:33 EST 2008
Author: sartak
Date: Wed Jan 23 20:11:27 2008
New Revision: 4916
Modified:
jifty/trunk/ (props changed)
jifty/trunk/Makefile.PL
jifty/trunk/lib/Jifty/Plugin/Halo.pm
jifty/trunk/share/web/static/css/halos.css
jifty/trunk/share/web/static/js/halo.js
Log:
r50702 at onn: sartak | 2008-01-23 20:11:08 -0500
Add some support for dumping the Perl code of templates. For now, only for TD. And DDS is currently giving us a lot of extraneous bits (oh well)
Modified: jifty/trunk/Makefile.PL
==============================================================================
--- jifty/trunk/Makefile.PL (original)
+++ jifty/trunk/Makefile.PL Wed Jan 23 20:11:27 2008
@@ -180,7 +180,12 @@
'CAS Plugin' => [
-default => 0,
recommends('Authen::CAS::Client')
- ]
+ ],
+ 'Improved halos' => [
+ -default => 0,
+ recommends('Template::Declare' => '0.28'),
+ recommends('Data::Dump::Streamer'),
+ ],
);
Modified: jifty/trunk/lib/Jifty/Plugin/Halo.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/Halo.pm (original)
+++ jifty/trunk/lib/Jifty/Plugin/Halo.pm Wed Jan 23 20:11:27 2008
@@ -39,7 +39,7 @@
# parts of why this is.. weird is because we want to play nicely with Mason
# halos
sub around_template {
- my ($self, $orig, $path, $args) = @_;
+ my ($self, $orig, $path, $args, $code) = @_;
my $ID = Jifty->web->serial;
my $STACK = Jifty->handler->stash->{'_halo_stack'} ||= [];
@@ -49,6 +49,11 @@
$path =~ m{.*/(.+)};
my $name = $1 || $path;
+ my $deparsed = eval {
+ require Data::Dump::Streamer;
+ Data::Dump::Streamer::Dump($code)->Out;
+ };
+
my $frame = {
id => $ID,
args => [ %{ Jifty->web->request->arguments } ], # ugh :)
@@ -58,6 +63,7 @@
name => $name,
proscribed => 0,
depth => $DEPTH,
+ perl => $deparsed,
};
# if this is the first frame, discard anything from the previous queries
@@ -83,6 +89,15 @@
my $self = shift;
my $frame = shift;
my $id = $frame->{id};
+ my $perl = $frame->{perl} || '';
+ my $name = $frame->{name};
+
+ for ($perl, $name) {
+ $_ = Jifty->web->escape($_);
+ }
+
+ my $perl_link = $perl ? qq{ | <a id="halo-button-perl-$id" onclick="halo_perl('$id'); return false" href="#">P</a> } : '';
+ my $perl_div = $perl ? qq{<div id="halo-perl-$id" class="halo_perl"><pre>$perl</pre></div>} : '';
return << " HEADER";
<div id="halo-$id" class="halo">
@@ -90,19 +105,19 @@
<span class="halo_rendermode">
[
<a style="font-weight: bold"
- id="halo-render-$id"
+ id="halo-button-render-$id"
onclick="halo_render('$id'); return false"
href="#">R</a>
|
- <a id="halo-source-$id"
+ <a id="halo-button-source-$id"
onclick="halo_source('$id'); return false"
href="#">S</a>
+ $perl_link
]
</span>
- <div class="halo_name">
- $frame->{name}
- </div>
+ <div class="halo_name">$name</div>
</div>
+ $perl_div
<div id="halo-inner-$id">
HEADER
}
Modified: jifty/trunk/share/web/static/css/halos.css
==============================================================================
--- jifty/trunk/share/web/static/css/halos.css (original)
+++ jifty/trunk/share/web/static/css/halos.css Wed Jan 23 20:11:27 2008
@@ -15,10 +15,14 @@
float: right;
}
-.halo_source {
+.halo_source, .halo_perl {
font-family: monospace;
}
+.halo_perl {
+ display: none;
+}
+
.halo_actions {
position: fixed;
border: 1px solid black;
Modified: jifty/trunk/share/web/static/js/halo.js
==============================================================================
--- jifty/trunk/share/web/static/js/halo.js (original)
+++ jifty/trunk/share/web/static/js/halo.js Wed Jan 23 20:11:27 2008
@@ -96,8 +96,8 @@
}
function halo_render(id) {
- $('halo-render-'+id).style.fontWeight = 'bold';
- $('halo-source-'+id).style.fontWeight = 'normal';
+ halo_reset(id);
+ $('halo-button-render-'+id).style.fontWeight = 'bold';
var e = $('halo-inner-'+id);
if (e.halo_rendered) {
@@ -107,8 +107,8 @@
}
function halo_source(id) {
- $('halo-source-'+id).style.fontWeight = 'bold';
- $('halo-render-'+id).style.fontWeight = 'normal';
+ halo_reset(id);
+ $('halo-button-source-'+id).style.fontWeight = 'bold';
var e = $('halo-inner-'+id);
if (!e.halo_rendered) {
@@ -117,3 +117,20 @@
}
}
+function halo_perl(id) {
+ halo_reset(id);
+ $('halo-button-perl-'+id).style.fontWeight = 'bold';
+ $('halo-inner-'+id).style.display = 'none';
+ $('halo-perl-'+id).style.display = 'block';
+
+}
+
+function halo_reset(id) {
+ $('halo-button-perl-'+id).style.fontWeight = 'normal';
+ $('halo-button-source-'+id).style.fontWeight = 'normal';
+ $('halo-button-render-'+id).style.fontWeight = 'normal';
+
+ $('halo-inner-'+id).style.display = 'block';
+ $('halo-perl-'+id).style.display = 'none';
+}
+
More information about the Jifty-commit
mailing list