[Jifty-commit] r4976 - in jifty/trunk: . lib/Jifty/Plugin share/web/static/js

Jifty commits jifty-commit at lists.jifty.org
Fri Feb 1 15:56:46 EST 2008


Author: sartak
Date: Fri Feb  1 15:56:45 2008
New Revision: 4976

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/Plugin/Halo.pm
   jifty/trunk/share/web/static/css/halos.css
   jifty/trunk/share/web/static/js/halo.js

Log:
 r51320 at onn:  sartak | 2008-02-01 14:46:57 -0500
 Some style changes and minor fixes (that damn quote in onclick.. !)


Modified: jifty/trunk/lib/Jifty/Plugin/Halo.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/Halo.pm	(original)
+++ jifty/trunk/lib/Jifty/Plugin/Halo.pm	Fri Feb  1 15:56:45 2008
@@ -34,7 +34,6 @@
         if Template::Declare->around_template;
 
     Template::Declare->around_template(sub { $self->around_template(@_) });
-
 }
 
 # parts of why this is.. weird is because we want to play nicely with Mason
@@ -46,18 +45,23 @@
     $path =~ m{.*/(.+)};
     my $name = $1 || $path;
 
-    my $deparsed = eval {
-        require Data::Dump::Streamer;
-        Data::Dump::Streamer::Dump($code)->Out;
-    };
-
     my $frame = $self->push_frame(
-        args  => [ %{ Jifty->web->request->arguments } ], # ugh :)
+        args  => [ %{ Jifty->web->request->arguments } ],
         path  => $path,
         name  => $name,
-        perl  => $deparsed,
     );
 
+    $frame->{displays}->{P} = {
+        name     => "perl",
+        callback => sub {
+            my $deparsed = eval {
+                require Data::Dump::Streamer;
+                Data::Dump::Streamer::Dump($code)->Out;
+            };
+            Jifty->web->escape($deparsed);
+        },
+    };
+
     Template::Declare->buffer->append($self->halo_header($frame));
     $orig->();
 
@@ -79,12 +83,12 @@
 
         push @buttons, join "\n", grep { $_ }
             qq{<a id="halo-button-$name-$id"},
-            qq{  onclick="halo_render('$id', '$name')"; return false"},
+            qq{  onclick="halo_render('$id', '$name'); return false"},
             $d->{default} && qq{  style="font-weight:bold"},
             qq{  href="#">$letter</a>},
     }
 
-    my $rendermode = '[' . join('|', @buttons) . ']';
+    my $rendermode = '[ ' . join(' | ', @buttons) . ' ]';
 
     return << "    HEADER";
         <div id="halo-$id" class="halo">
@@ -95,6 +99,7 @@
                 <div class="halo-name">$name</div>
             </div>
             <div id="halo-inner-$id">
+                <div id="halo-rendered-$id">
     HEADER
 }
 
@@ -111,16 +116,17 @@
 
         push @divs, join "\n", grep { $_ }
             qq{<div id="halo-info-$name-$id" style="display: none">},
-            $d->{callback} && $d->{callback}->($d),
+            $d->{callback} && $d->{callback}->($frame),
             qq{</div>},
     }
 
     my $divs = join "\n", @divs;
 
     return << "    FOOTER";
-            </div>
-            <div id="halo-info-$id">
-                $divs
+                </div>
+                <div id="halo-info-$id">
+                    $divs
+                </div>
             </div>
         </div>
     FOOTER

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	Fri Feb  1 15:56:45 2008
@@ -3,12 +3,14 @@
     border-style: solid;
     border-width: 0;
     margin: 0;
+    padding: 0;
 }
 
 .halo-header {
     display: none;
     border-bottom: 1px dashed #ffd700;
     background: #fff;
+    margin: 3px;
 }
 
 .halo-rendermode {

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	Fri Feb  1 15:56:45 2008
@@ -68,13 +68,15 @@
     var halo_header_display = 'none';
     var halo_border_width   = '0';
     var halo_margin         = '0';
+    var halo_padding        = '0';
 
     halos_drawn = !halos_drawn;
 
     if (halos_drawn) {
         halo_header_display = 'block';
         halo_border_width   = '1px';
-        halo_margin         = '2px';
+        halo_margin         = '3px';
+        halo_padding        = '3px';
     }
 
     YAHOO.util.Dom.getElementsByClassName("halo-header", null, null,
@@ -87,6 +89,7 @@
         function (e) {
             e.style.borderWidth = halo_border_width;
             e.style.margin = halo_margin;
+            e.style.padding = halo_padding;
         }
     );
 }
@@ -99,7 +102,7 @@
     halo_reset(id);
     $('halo-button-'+name+'-'+id).style.fontWeight = 'bold';
 
-    var e = $('halo-inner-'+id);
+    var e = $('halo-rendered-'+id);
 
     if (name == 'source') {
         e.halo_rendered = e.innerHTML;
@@ -110,6 +113,7 @@
     }
     else {
         e.style.display = 'none';
+        $('halo-info-'+id).style.display = 'block';
         $('halo-info-'+name+'-'+id).style.display = 'block';
     }
 }
@@ -125,6 +129,7 @@
     }
 
     /* hide all the info divs */
+    $('halo-info-'+id).style.display = 'none';
     for (var child = $('halo-info-'+id).firstChild;
          child != null;
          child = child.nextSibling) {
@@ -134,7 +139,7 @@
     }
 
     /* restore the rendered div */
-    var e = $('halo-inner-'+id);
+    var e = $('halo-rendered-'+id);
     e.style.display = 'block';
     if (e.halo_rendered) {
         e.innerHTML = e.halo_rendered;


More information about the Jifty-commit mailing list