From 24ec30b10c2ec25a65e370204ddbe9d9acb151d0 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Tue, 23 Oct 2007 20:42:15 +0000 Subject: [PATCH] SCM browser: * open subfolders are preserved when collapsing/re-expanding a folder * prevent a folder to be loaded twice if double-clicked while loading git-svn-id: http://redmine.rubyforge.org/svn/trunk@868 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- public/javascripts/application.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 075bb7a90..5ad04e91d 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -74,6 +74,9 @@ function expandScmEntry(id) { var els = document.getElementsByClassName(id, 'browser'); for (var i = 0; i < els.length; i++) { Element.show(els[i]); + if (els[i].hasClassName('loaded') && !els[i].hasClassName('collapsed')) { + expandScmEntry(els[i].id); + } } $(id).addClassName('open'); } @@ -82,17 +85,24 @@ function scmEntryClick(id) { el = $(id); if (el.hasClassName('open')) { collapseScmEntry(id); + el.addClassName('collapsed'); return false; } else if (el.hasClassName('loaded')) { expandScmEntry(id); + el.removeClassName('collapsed'); return false; } + if (el.hasClassName('loading')) { + return false; + } + el.addClassName('loading'); return true; } function scmEntryLoaded(id) { Element.addClassName(id, 'open'); Element.addClassName(id, 'loaded'); + Element.removeClassName(id, 'loading'); } /* shows and hides ajax indicator */ -- 2.39.5