X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=root%2Fjs%2Fcomponentload.js;h=da3ad7f90c29cdeb99901a3a444ffe3b79d865ab;hb=38627d20c7f0a0f82ec820b716842d69e905d643;hp=522c87917fffd5fcd4609dc67e2473e9d1477d69;hpb=7c25980fc416b57467382b3d05f9e7e9e7d0eec9;p=scpubgit%2Fstemmaweb.git diff --git a/root/js/componentload.js b/root/js/componentload.js index 522c879..da3ad7f 100644 --- a/root/js/componentload.js +++ b/root/js/componentload.js @@ -47,10 +47,12 @@ function loadTradition( textid, textname, editable ) { $('#open_stemma_add').show(); $('#open_stemma_edit').show(); $('#open_textinfo_edit').show(); + $('#relatebutton_label').text('View collation and edit relationships'); } else { $('#open_stemma_add').hide(); $('#open_stemma_edit').hide(); $('#open_textinfo_edit').hide(); + $('#relatebutton_label').text('View collation and relationships'); } // Then get and load the actual content. @@ -73,6 +75,9 @@ function loadTradition( textid, textname, editable ) { load_stemma( selectedStemmaID ); // Set up the relationship mapper button $('#run_relater').attr( 'action', _get_url([ "relation", textid ]) ); + // Set up the download button + $('#dl_tradition').attr( 'href', _get_url([ "download", textid ]) ); + $('#dl_tradition').attr( 'download', selectedTextInfo.name + '.xml' ); }); } @@ -88,7 +93,12 @@ function load_textinfo() { // Who the owner is $('#owner_id').empty().append('no one'); if( selectedTextInfo.owner ) { - $('#owner_id').empty().append( selectedTextInfo.owner ); + var owneremail = selectedTextInfo.owner; + var chop = owneremail.indexOf( '@' ); + if( chop > -1 ) { + owneremail = owneremail.substr( 0, chop + 1 ) + '...'; + } + $('#owner_id').empty().append( owneremail ); } // Whether or not it is public $('#not_public').empty(); @@ -188,8 +198,10 @@ function display_error( jqXHR, el ) { function file_selected( e ) { if( e.files.length == 1 ) { $('#upload_button').button('enable'); + $('#new_file_name_container').html( '' + e.files[0].name + '' ); } else { $('#upload_button').button('disable'); + $('#new_file_name_container').html( '(Use \'pick file\' to select a tradition file to upload.)' ); } } @@ -438,6 +450,13 @@ $(document).ready( function() { upload_new(); } }, + pick_file: { + text: 'Pick File', + id: 'pick_file_button', + click: function() { + $('#new_file').click(); + } + }, Cancel: function() { $('#upload-collation-dialog').dialog('close'); }