From: Tara L Andrews Date: Sat, 23 Jun 2012 23:31:13 +0000 (+0200) Subject: prevent buttons from being irrevocably disabled X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=aafcb75bd185450585be2efd1c1f6bfc46efdd12;p=scpubgit%2Fstemmaweb.git prevent buttons from being irrevocably disabled --- diff --git a/lib/stemmaweb/Controller/Relation.pm b/lib/stemmaweb/Controller/Relation.pm index 22a1d07..bd7d527 100644 --- a/lib/stemmaweb/Controller/Relation.pm +++ b/lib/stemmaweb/Controller/Relation.pm @@ -313,18 +313,18 @@ sub reading :Chained('text') :PathPart :Args(1) { foreach my $p ( keys %{$c->request->params} ) { if( $p =~ /^morphology_(\d+)$/ ) { # Set the form on the correct lexeme + my $morphval = $c->request->param( $p ); + next unless $morphval; my $midx = $1; - $c->log->debug( "Fetching lexeme $midx" ); my $lx = $rdg->lexeme( $midx ); - my $strrep = $rdg->language . ' // ' - . $c->request->param( $p ); + my $strrep = $rdg->language . ' // ' . $morphval; my $idx = $lx->has_form( $strrep ); unless( defined $idx ) { # Make the word form and add it to the lexeme. - $c->log->debug("Adding new form for $strrep"); try { $idx = $lx->add_matching_form( $strrep ) - 1; } catch( Text::Tradition::Error $e ) { + # TODO catch other errors e.g. Moose ones $c->response->status( '403' ); $errmsg = $e->message; } diff --git a/root/js/relationship.js b/root/js/relationship.js index 72f83b2..a2b242d 100644 --- a/root/js/relationship.js +++ b/root/js/relationship.js @@ -708,8 +708,8 @@ $(document).ready(function () { && ajaxSettings.type == 'POST' && jqXHR.status == 403 ) { var errobj = jQuery.parseJSON( jqXHR.responseText ); $('#status').append( '

Error: ' + errobj.error + '
The relationship cannot be made.

' ); - $(event.target).parent().find('.ui-button').button("enable"); } + $(event.target).parent().find('.ui-button').button("enable"); } ); $( "#delete-form" ).dialog({ @@ -812,8 +812,8 @@ $(document).ready(function () { && ajaxSettings.type == 'POST' && jqXHR.status == 403 ) { var errobj = jQuery.parseJSON( jqXHR.responseText ); $('#reading_status').append( '

Error: ' + errobj.error + '

' ); - $(event.target).parent().find('.ui-button').button("enable"); } + $(event.target).parent().find('.ui-button').button("enable"); });