better handling for errors, don't send filler text to server
Tara L Andrews [Sun, 24 Jun 2012 11:53:34 +0000 (13:53 +0200)]
lib/stemmaweb/Controller/Relation.pm
root/js/relationship.js

index bd7d527..0842124 100644 (file)
@@ -324,9 +324,12 @@ sub reading :Chained('text') :PathPart :Args(1) {
                                                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;
+                                               } catch {
+                                                       # Something else went wrong, probably a Moose error
+                                                       $c->response->status( '403' );
+                                                       $errmsg = 'Something went wrong with the request';      
                                                }
                                        }
                                        $lx->disambiguate( $idx ) if defined $idx;
index a2b242d..cd3d867 100644 (file)
@@ -772,9 +772,11 @@ $(document).ready(function () {
                                'normal_form': $('#reading_normal_form').val() };
                        // Add the morphology values
                        $('.reading_morphology').each( function() {
-                               var rmid = $(this).attr('id');
-                               rmid = rmid.substring(8);
-                               form_values[rmid] = $(this).val();
+                               if( $(this).val() != '(Click to select)' ) {
+                                       var rmid = $(this).attr('id');
+                                       rmid = rmid.substring(8);
+                                       form_values[rmid] = $(this).val();
+                               }
                        });
                        // Make the JSON call
                        ncpath = getReadingURL( reading_id );
@@ -803,6 +805,7 @@ $(document).ready(function () {
         $("#dialog_overlay").height( $("#enlargement_container").height() );
         $("#dialog_overlay").width( $("#enlargement_container").innerWidth() );
         $("#dialog_overlay").offset( $("#enlargement_container").offset() );
+        $("#reading-form").parent().find('.ui-button').button("enable");
        },
        close: function() {
                $("#dialog_overlay").hide();