[Jifty-commit] r5261 - in jifty/branches/jquery: share/web/static/js share/web/templates/__jifty

Jifty commits jifty-commit at lists.jifty.org
Mon Apr 7 02:56:58 EDT 2008


Author: gugod
Date: Mon Apr  7 02:56:57 2008
New Revision: 5261

Modified:
   jifty/branches/jquery/lib/Jifty/Plugin/Halo.pm
   jifty/branches/jquery/share/web/static/js/halo.js
   jifty/branches/jquery/share/web/templates/__jifty/halo

Log:
de-prototypism in these halo plugin files.


Modified: jifty/branches/jquery/lib/Jifty/Plugin/Halo.pm
==============================================================================
--- jifty/branches/jquery/lib/Jifty/Plugin/Halo.pm	(original)
+++ jifty/branches/jquery/lib/Jifty/Plugin/Halo.pm	Mon Apr  7 02:56:57 2008
@@ -198,7 +198,7 @@
                     my $expanded = Jifty->web->serial;
                     my $yaml = Jifty->web->escape(Jifty::YAML::Dump($value));
                     #$out .= qq{<a href="#" onclick="Element.toggle('$expanded'); return false">$ref</a><div id="$expanded" style="display: none; position: absolute; left: 200px; border: 1px solid black; background: #ccc; padding: 1em; padding-top: 0; width: 300px; height: 500px; overflow: auto"><pre>$yaml</pre></div>};
-                    $out .= qq{<a href="#" onclick="Element.toggle('$expanded'); return false">$ref</a><div id="$expanded" class="halo-argument" style="display: none"><pre>$yaml</pre></div>};
+                    $out .= qq{<a href="#" onclick="jQuery(Jifty.$('$expanded')).toggle()); return false">$ref</a><div id="$expanded" class="halo-argument" style="display: none"><pre>$yaml</pre></div>};
                 }
                 elsif (defined $value) {
                     $out .= Jifty->web->escape($value);

Modified: jifty/branches/jquery/share/web/static/js/halo.js
==============================================================================
--- jifty/branches/jquery/share/web/static/js/halo.js	(original)
+++ jifty/branches/jquery/share/web/static/js/halo.js	Mon Apr  7 02:56:57 2008
@@ -10,7 +10,7 @@
         halo_top   = Jifty.$('halo-'+halo_shown+'-menu').style.top;
         halo_left  = Jifty.$('halo-'+halo_shown+'-menu').style.left;
         halo_width = Jifty.$('halo-'+halo_shown+'-menu').style.width;
-        jQuery('halo-'+halo_shown+'-menu').hide();
+        jQuery('#halo-'+halo_shown+'-menu').hide();
     }
 
     jQuery("#halo-"+id+"-menu").css({
@@ -19,17 +19,17 @@
         width: halo_width
     }).toggle();
 
-    Drag.init( $('halo-'+id+'-title'), $('halo-'+id+'-menu') );
-    init_resize($('halo-'+id+'-resize'), $('halo-'+id+'-menu') );
+    Drag.init( Jifty.$('halo-'+id+'-title'), Jifty.$('halo-'+id+'-menu') );
+    init_resize(Jifty.$('halo-'+id+'-resize'), Jifty.$('halo-'+id+'-menu') );
 
-    var e = $('halo-'+id);
+    var e = jQuery('#halo-'+id).get(0);
     if (jQuery('#halo-'+id+'-menu').is(":visible")) {
         halo_shown = id;
         jQuery(e).css({ background: '#ffff80' });
     } else {
-        halo_top   = $('halo-'+halo_shown+'-menu').style.top;
-        halo_left  = $('halo-'+halo_shown+'-menu').style.left;
-        halo_width = $('halo-'+halo_shown+'-menu').style.width;
+        halo_top   = Jifty.$('halo-'+halo_shown+'-menu').style.top;
+        halo_left  = Jifty.$('halo-'+halo_shown+'-menu').style.left;
+        halo_width = Jifty.$('halo-'+halo_shown+'-menu').style.width;
         halo_shown = null;
         jQuery(e).css({ background: 'inherit' });
     }
@@ -77,9 +77,7 @@
         halo_padding        = '3px';
     }
 
-    jQuery("#render_info-draw_halos").html(
-        halos_drawn ? "Hide halos" : "Draw halos"
-    );
+    jQuery("#render_info-draw_halos").text(halos_drawn ? "Hide halos" : "Draw halos");
 
     jQuery(".halo-header").css({
         display: halo_header_display
@@ -102,11 +100,11 @@
 
     jQuery('#halo-button-'+name+'-'+id).css("font-weight", "bold");
 
-    var e = jQuery('halo-rendered-'+id).get(0);
+    var e = jQuery('#halo-rendered-'+id).get(0);
 
     if (name == 'source') {
         e.halo_rendered = e.innerHTML;
-        e.innerHTML = '<div class="halo-source">' + e.innerHTML.escapeHTML() + '</div>';
+        jQuery(e).html('<div class="halo-source"></div>').find("div").text(e.halo_rendered);
     }
     else if (name == 'render') {
         /* ignore */
@@ -120,7 +118,7 @@
 
 function halo_reset(id) {
     /* restore all buttons to nonbold */
-    for (var child = $('halo-rendermode-'+id).firstChild;
+    for (var child = jQuery('#halo-rendermode-'+id).firstChild;
          child != null;
          child = child.nextSibling) {
             if (child.style) {
@@ -131,7 +129,7 @@
     /* hide all the info divs */
     jQuery('#halo-info-'+id).hide();
 
-    for (var child = $('halo-info-'+id).firstChild;
+    for (var child = jQuery('#halo-info-'+id).firstChild;
          child != null;
          child = child.nextSibling) {
             if (child.style) {

Modified: jifty/branches/jquery/share/web/templates/__jifty/halo
==============================================================================
--- jifty/branches/jquery/share/web/templates/__jifty/halo	(original)
+++ jifty/branches/jquery/share/web/templates/__jifty/halo	Mon Apr  7 02:56:57 2008
@@ -99,7 +99,7 @@
 <li><b><% $e->[0] %></b>:
 % if ($e->[1]) {
 % my $expanded = Jifty->web->serial;
-<a href="#" onclick="Element.toggle('<% $expanded %>'); return false"><% $e->[1] %></a>
+<a href="#" onclick="jQuery(Jifty.$('<% $expanded %>')).toggle(); return false"><% $e->[1] %></a>
 <div id="<% $expanded %>" style="display: none; position: absolute; left: 200px; border: 1px solid black; background: #ccc; padding: 1em; padding-top: 0; width: 300px; height: 500px; overflow: auto"><pre><% Jifty::YAML::Dump($e->[2]) %></pre></div>
 % } elsif (defined $e->[2]) {
 <% $e->[2] %>


More information about the Jifty-commit mailing list