From: Tara L Andrews Date: Wed, 6 Jun 2012 20:20:03 +0000 (+0200) Subject: fix undefined bug in javascript for wordform-less lexemes X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=08f8443a751947e6222c425df3d118a84fa1dea1;p=scpubgit%2Fstemmaweb.git fix undefined bug in javascript for wordform-less lexemes --- diff --git a/lib/stemmaweb/Controller/Relation.pm b/lib/stemmaweb/Controller/Relation.pm index 8ec7673..4bae11d 100644 --- a/lib/stemmaweb/Controller/Relation.pm +++ b/lib/stemmaweb/Controller/Relation.pm @@ -145,7 +145,6 @@ sub help :Local :Args(1) { $c->log->debug("Warning: could not load $mod"); } my $has_mod = $mod->can('morphology_tags'); - $DB::single = 1; if( $has_mod ) { my $tagset = &$has_mod; $c->stash->{'tagset'} = $tagset; diff --git a/root/js/relationship.js b/root/js/relationship.js index a731474..0c34643 100644 --- a/root/js/relationship.js +++ b/root/js/relationship.js @@ -75,13 +75,15 @@ function morphology_form ( lexlist ) { $('#morphology').empty(); $.each( lexlist, function( idx, lex ) { var morphoptions = []; - $.each( lex['wordform_matchlist'], function( tdx, tag ) { - var tagstr = stringify_wordform( tag ); - morphoptions.push( tagstr ); - }); + if( 'wordform_matchlist' in lex ) { + $.each( lex['wordform_matchlist'], function( tdx, tag ) { + var tagstr = stringify_wordform( tag ); + morphoptions.push( tagstr ); + }); + } var formtag = 'morphology_' + idx; var formstr = ''; - if( lex['form'] ) { + if( 'form' in lex ) { formstr = stringify_wordform( lex['form'] ); } var form_morph_elements = morph_elements( @@ -93,8 +95,11 @@ function morphology_form ( lexlist ) { } function stringify_wordform ( tag ) { - var elements = tag.split(' // '); - return elements[1] + ' // ' + elements[2]; + if( tag ) { + var elements = tag.split(' // '); + return elements[1] + ' // ' + elements[2]; + } + return '' } function morph_elements ( formtag, formtxt, currform, morphoptions ) {