From: Tara L Andrews Date: Sat, 5 May 2012 10:12:24 +0000 (+0200) Subject: dblclick action now works; a little styling on dialog X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1301020e6ec9c61107d9db02744303fbd2f7aca6;hp=f26e47cdc01f445c29f4c0c32ef2eba77b79d41b;p=scpubgit%2Fstemmatology.git dblclick action now works; a little styling on dialog --- diff --git a/stemmaweb/root/css/relationship.css b/stemmaweb/root/css/relationship.css index 2091ccb..3a85b7d 100644 --- a/stemmaweb/root/css/relationship.css +++ b/stemmaweb/root/css/relationship.css @@ -213,3 +213,9 @@ span.apimore { -ms-user-select: none; user-select: none; } + +#morphology { + float: left; + text-align: right; + margin: 10px; +} diff --git a/stemmaweb/root/js/relationship.js b/stemmaweb/root/js/relationship.js index 3c271c4..7f6ed87 100644 --- a/stemmaweb/root/js/relationship.js +++ b/stemmaweb/root/js/relationship.js @@ -42,6 +42,71 @@ function jq(myid) { return '#' + myid.replace(/(:|\.)/g,'\\$1'); } +// Actions for opening the reading panel +function node_dblclick_listener( evt ) { + // Open the reading dialogue for the given node. + // First get the reading info + var reading_id = $(this).attr('id'); + var reading_info = readingdata[reading_id]; + // and then populate the dialog box with it. + // Set the easy properties first + $('#reading-form').dialog( 'option', 'title', 'Reading information for "' + reading_info['text'] + '"' ); + $('#reading_id').val( reading_id ); + $('#reading_is_nonsense').val( reading_info['is_nonsense'] ); + $('#reading_grammar_invalid').val( reading_info['grammar_invalid'] ); + // Use .text as a backup for .normal_form + var normal_form = reading_info['normal_form']; + if( !normal_form ) { + normal_form = reading_info['text']; + } + var nfboxsize = 10; + if( normal_form.length > 9 ) { + nfboxsize = normal_form.length + 1; + } + $('#reading_normal_form').attr( 'size', nfboxsize ) + $('#reading_normal_form').val( normal_form ); + // Now do the morphological properties. + // and then open the dialog. + $('#morphology').empty(); + $.each( reading_info['lexemes'], function( idx, lex ) { + var morphoptions = []; + $.each( lex['wordform_matchlist'], function( tdx, tag ) { + var tagstr = stringify_wordform( tag ); + morphoptions.push( tagstr ); + }); + var formtag = 'morphology_' + idx; + var form_morph_elements = morph_elements( formtag ); + form_morph_elements[0].text( lex['string'] + ': ' ); + form_morph_elements[1].autocomplete({ + source: morphoptions, + minLength: 0 + }); + //forminput.autocomplete('search', ''); + if( lex['form'] ) { + var formstr = stringify_wordform( lex['form'] ); + form_morph_elements[1].val( formstr ); + } + $.each( form_morph_elements, function( idx, el ) { + $('#morphology').append( el ); + }); + }); + $('#reading-form').dialog("open"); +} + +function stringify_wordform ( tag ) { + return tag['lemma'] + ' // ' + tag['morphology']; +} + +function morph_elements ( formtag ) { + var formlabel = $('