From d00b01f1eacf57c07fb657bf0e1f9a8ff69e6f2d Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Fri, 9 Jan 2009 15:54:35 -0700 Subject: [PATCH] Annotate improvements from CVS HEAD --- chora/annotate.php | 3 +-- chora/js/annotate.js | 2 +- chora/js/src/annotate.js | 22 +++++++++++++++------- chora/templates/annotate/line.inc | 4 ++-- chora/themes/screen.css | 3 +++ 5 files changed, 22 insertions(+), 12 deletions(-) diff --git a/chora/annotate.php b/chora/annotate.php index 1ae747e25..4808210c1 100644 --- a/chora/annotate.php +++ b/chora/annotate.php @@ -58,7 +58,7 @@ require CHORA_TEMPLATES . '/headerbar.inc'; require CHORA_TEMPLATES . '/annotate/header.inc'; $author = ''; -$i = $style = 0; +$style = 0; /* Use this counter so that we can give each tooltip object a unique * id attribute (which we use to set the tooltip text later). */ @@ -78,7 +78,6 @@ while (list(,$line) = each($lines)) { $line = Text::htmlAllSpaces($line['line']); include CHORA_TEMPLATES . '/annotate/line.inc'; - ++$i; } require $registry->get('templates', 'horde') . '/common-footer.inc'; diff --git a/chora/js/annotate.js b/chora/js/annotate.js index f0f1e8e3c..c8233a5bf 100644 --- a/chora/js/annotate.js +++ b/chora/js/annotate.js @@ -1 +1 @@ -var Chora_Annotate={showLog:function(d){var c=d.findElement("SPAN").hide(),b=c.up("TD").down("A").readAttribute("id").slice(4,-2),a=new Element("TD",{colspan:5}).insert(Chora.loading_text);c.up("TR").insert({after:new Element("TR").insert(a)});new Ajax.Updater(a,Chora.ANNOTATE_URL+b)}};document.observe("dom:loaded",function(){$$(".logdisplay").invoke("observe","click",Chora_Annotate.showLog.bindAsEventListener(Chora_Annotate))}); \ No newline at end of file +var Chora_Annotate={showLog:function(d){var c=d.element(),b,a;if(!c.hasClassName("logdisplay")){c=c.up("SPAN.logdisplay");if(!c){return}}d.stop();b=c.hide().up("TD").down("A").readAttribute("rev");a=new Element("TD",{colspan:5}).insert(Chora.loading_text);c.up("TR").insert({after:new Element("TR",{className:"logentry"}).insert(a)});new Ajax.Updater(a,Chora.ANNOTATE_URL+b)}};document.observe("click",Chora_Annotate.showLog.bindAsEventListener(Chora_Annotate)); \ No newline at end of file diff --git a/chora/js/src/annotate.js b/chora/js/src/annotate.js index c9a0f9637..60d6ad453 100644 --- a/chora/js/src/annotate.js +++ b/chora/js/src/annotate.js @@ -9,15 +9,23 @@ var Chora_Annotate = { showLog: function(e) { - var elt = e.findElement('SPAN').hide(), - rev = elt.up('TD').down('A').readAttribute('id').slice(4, -2), - newelt = new Element('TD', { colspan: 5 }).insert(Chora.loading_text); - elt.up('TR').insert({ after: new Element('TR').insert(newelt) }); + var elt = e.element(), rev, newelt; + if (!elt.hasClassName('logdisplay')) { + elt = elt.up('SPAN.logdisplay'); + if (!elt) { + return; + } + } + + e.stop(); + + rev = elt.hide().up('TD').down('A').readAttribute('rev'); + newelt = new Element('TD', { colspan: 5 }).insert(Chora.loading_text); + + elt.up('TR').insert({ after: new Element('TR', { className: 'logentry' }).insert(newelt) }); new Ajax.Updater(newelt, Chora.ANNOTATE_URL + rev); } }; -document.observe('dom:loaded', function() { - $$('.logdisplay').invoke('observe', 'click', Chora_Annotate.showLog.bindAsEventListener(Chora_Annotate)); -}); +document.observe('click', Chora_Annotate.showLog.bindAsEventListener(Chora_Annotate)); diff --git a/chora/templates/annotate/line.inc b/chora/templates/annotate/line.inc index 42d773bf3..a7824ae34 100644 --- a/chora/templates/annotate/line.inc +++ b/chora/templates/annotate/line.inc @@ -6,7 +6,7 @@ - abbrev($rev)) ?> + abbrev($rev)) ?> "> @@ -14,7 +14,7 @@ - abbrev($prev)) ?> + abbrev($prev)) ?> diff --git a/chora/themes/screen.css b/chora/themes/screen.css index d0dfbd68b..2e5db5e27 100644 --- a/chora/themes/screen.css +++ b/chora/themes/screen.css @@ -224,6 +224,9 @@ table.annotate .rev { padding-right: 2px; white-space: nowrap; } +table.annotate .logentry { + background: #cde; +} /* Diff styles. */ table.hrdiff { -- 2.11.0