prevent buttons from being irrevocably disabled
Tara L Andrews [Sat, 23 Jun 2012 23:31:13 +0000 (01:31 +0200)]
stemmaweb/lib/stemmaweb/Controller/Relation.pm
stemmaweb/root/js/relationship.js

index 22a1d07..bd7d527 100644 (file)
@@ -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;
                                                }
index 72f83b2..a2b242d 100644 (file)
@@ -708,8 +708,8 @@ $(document).ready(function () {
        && ajaxSettings.type == 'POST' && jqXHR.status == 403 ) {
          var errobj = jQuery.parseJSON( jqXHR.responseText );
           $('#status').append( '<p class="error">Error: ' + errobj.error + '</br>The relationship cannot be made.</p>' );
-                 $(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( '<p class="error">Error: ' + errobj.error + '</p>' );
-                 $(event.target).parent().find('.ui-button').button("enable");
       }
+         $(event.target).parent().find('.ui-button').button("enable");
   });