From: Tara L Andrews <tla@mit.edu>
Date: Mon, 3 Sep 2012 15:35:10 +0000 (+0200)
Subject: stemma button logic bugfix, streamline a little
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=57e3a0088749af076931553ed7945594d3a813a4;p=scpubgit%2Fstemmaweb.git

stemma button logic bugfix, streamline a little
---

diff --git a/root/js/componentload.js b/root/js/componentload.js
index 2df5fec..42be5f6 100644
--- a/root/js/componentload.js
+++ b/root/js/componentload.js
@@ -35,12 +35,13 @@ function loadTradition( textid, textname, editable ) {
     	stemmata = textdata.stemmata;
     	if( stemmata.length ) {
     		selectedStemmaID = 0;
-    		load_stemma( selectedStemmaID, basepath );
+			$('#run_stexaminer').show();
     	} else {
+    		selectedStemmaID = -1;
 			$('#open_stemma_edit').hide();
 			$('#run_stexaminer').hide();
-			show_stemmapager(); // to grey out both buttons
 		}
+		load_stemma( selectedStemmaID, basepath );
     	// Set up the relationship mapper button
 		$('#run_relater').attr( 'action', basepath + "/relation/" + textid );
 	});
@@ -90,10 +91,10 @@ function show_stemmapager () {
 function load_stemma( idx ) {
 	// Load the stemma at idx
 	selectedStemmaID = idx;
+	show_stemmapager();
 	if( idx > -1 ) {
 		$('#stemma_graph').empty();
 		$('#stemma_graph').append( stemmata[idx] );
-		show_stemmapager();
 		// Stexaminer submit action
 		var stexpath = basepath + "/stexaminer/" + selectedTextID + "/" + idx;
 		$('#run_stexaminer').attr( 'action', stexpath );