From: Tara L Andrews Date: Mon, 3 Sep 2012 15:29:41 +0000 (+0200) Subject: hook up pager buttons to stemma loading; zap occasional error in upload success function X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=65a0c9c6c2ffa577d6068b7b8c181e84b1bd23bc;p=scpubgit%2Fstemmaweb.git hook up pager buttons to stemma loading; zap occasional error in upload success function --- diff --git a/root/js/componentload.js b/root/js/componentload.js index 35f529a..2df5fec 100644 --- a/root/js/componentload.js +++ b/root/js/componentload.js @@ -36,7 +36,11 @@ function loadTradition( textid, textname, editable ) { if( stemmata.length ) { selectedStemmaID = 0; load_stemma( selectedStemmaID, basepath ); - } + } else { + $('#open_stemma_edit').hide(); + $('#run_stexaminer').hide(); + show_stemmapager(); // to grey out both buttons + } // Set up the relationship mapper button $('#run_relater').attr( 'action', basepath + "/relation/" + textid ); }); @@ -67,11 +71,29 @@ function load_textinfo() { } } +function show_stemmapager () { + $('.pager_left_button').unbind('click').css( 'opacity', '0.5' ); + $('.pager_right_button').unbind('click').css( 'opacity', '0.5' ); + if( selectedStemmaID > 0 ) { + $('.pager_left_button').click( function () { + load_stemma( selectedStemmaID - 1 ); + }).css( 'opacity' , '1.0' ); + } + if( selectedStemmaID + 1 < stemmata.length ) { + $('.pager_right_button').click( function () { + load_stemma( selectedStemmaID + 1 ); + }).css( 'opacity' , '1.0' ); + } +} + + function load_stemma( idx ) { + // Load the stemma at idx + selectedStemmaID = idx; if( idx > -1 ) { - selectedStemmaID = idx; $('#stemma_graph').empty(); $('#stemma_graph').append( stemmata[idx] ); + show_stemmapager(); // Stexaminer submit action var stexpath = basepath + "/stexaminer/" + selectedTextID + "/" + idx; $('#run_stexaminer').attr( 'action', stexpath ); diff --git a/root/js/uploader.js b/root/js/uploader.js index 7fd5fe0..2cb4c26 100644 --- a/root/js/uploader.js +++ b/root/js/uploader.js @@ -60,7 +60,7 @@ function create_uploader(upload_url) { uploader.bind('FileUploaded', function(up, file, ret) { var result = parseResponse( ret.response ); if( result.id ) { - $('#upload-collation-dialog').dialog( 'option', 'buttons').cancel(); + $('#upload-collation-dialog').dialog('close'); refreshDirectory(); loadTradition( result.id, result.name, 1 ); } else if( result.error ) { diff --git a/root/src/index.tt b/root/src/index.tt index cc0f725..e2e8192 100644 --- a/root/src/index.tt +++ b/root/src/index.tt @@ -266,8 +266,8 @@ $(document).ready( function() {
-
-
+
+