Add preliminary expander indicator (just text for now)
Add preliminary expander indicator (just text for now)

file:a/js/tree.js -> file:b/js/tree.js
--- a/js/tree.js
+++ b/js/tree.js
@@ -16,6 +16,11 @@
 	}
 	url = url[1];
 
+	var collapsed = '[+]';
+	var expanded = '[–]';
+
+	$('table.treeTable td.expander').text(collapsed);
+
 	$('a.jsTree').live('click', function() {
 		var treeHash = $(this).attr('href').match(/h=([0-9a-fA-F]{40}|HEAD)/);
 		if (!treeHash) {
@@ -24,15 +29,21 @@
 
 		treeHash = treeHash[1];
 
+		var cell = $(this).parent();
+		var row = cell.parent();
+
 		var treeRows = $('.' + treeHash);
 		if (treeRows && treeRows.size() > 0) {
-			if (treeRows.is(':visible'))
+			if (treeRows.is(':visible')) {
 				treeRows.hide();
-			else
+				treeRows.find('td.expander').text(collapsed);
+				row.find('td.expander').text(collapsed);
+			} else {
 				treeRows.show();
+				treeRows.find('td.expander').text(expanded);
+				row.find('td.expander').text(expanded);
+			}
 		} else {
-			var cell = $(this).parent();
-			var row = cell.parent();
 			var indent = cell.html().match(/^(—+)/);
 			if (indent)
 				indent = indent[1];
@@ -60,9 +71,11 @@
 				});
 
 				subRows.find('td.fileName').prepend(indent);
+				subRows.find('td.expander').text(collapsed);
 
 				row.after(subRows);
 
+				row.find('td.expander').text(expanded);
 				cell.children('img.treeSpinner').remove();
 			});
 		}

--- a/templates/treelist.tpl
+++ b/templates/treelist.tpl
@@ -14,6 +14,7 @@
     <td class="monospace perms">{$treeitem->GetModeString()}</td>
     {if $treeitem instanceof GitPHP_Blob}
       <td class="filesize">{$treeitem->GetSize()}</td>
+      <td></td>
       <td class="list fileName">
         <a href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=blob&amp;h={$treeitem->GetHash()}&amp;hb={$commit->GetHash()}&amp;f={$treeitem->GetPath()}" class="list">{$treeitem->GetName()}</a>
       </td>
@@ -26,6 +27,7 @@
       </td>
     {elseif $treeitem instanceof GitPHP_Tree}
       <td class="filesize"></td>
+      <td class="expander"></td>
       <td class="list fileName">
         <a href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=tree&amp;h={$treeitem->GetHash()}&amp;hb={$commit->GetHash()}&amp;f={$treeitem->GetPath()}" class="jsTree">{$treeitem->GetName()}</a>
       </td>

comments