Hide error when merging a new item
Errietta Kostala [Wed, 10 Jun 2015 15:34:24 +0000 (15:34 +0000)]
lib/stemmaweb/Controller/Relation.pm
root/js/relationship.js

index a8e63d0..12c63ef 100644 (file)
@@ -9,15 +9,6 @@ use TryCatch;
 
 BEGIN { extends 'Catalyst::Controller' }
 
-
-sub throw {
-       Text::Tradition::Error->throw(
-               'ident' => 'Collation error',
-               'message' => $_[0],
-               );
-}
-
-
 =head1 NAME
 
 stemmaweb::Controller::Relation - Controller for the relationship mapper
@@ -508,16 +499,16 @@ sub compress :Chained('text') :PathPart :Args(0) {
                        # Finally, make sure we haven't screwed anything up.
                        foreach my $wit ( $tradition->witnesses ) {
                                my $pathtext = $collation->path_text( $wit->sigil );
-                               throw( "Text differs for witness " . $wit->sigil )
+                               Text::Tradition::Error->throw_collation_error( "Text differs for witness " . $wit->sigil )
                                        unless $pathtext eq $origtext{$wit->sigil};
                                if( $wit->is_layered ) {
                                        my $acsig = $wit->sigil . $collation->ac_label;
                                        $pathtext = $collation->path_text( $acsig );
-                                       throw( "Layered text differs for witness " . $wit->sigil )
+                                       Text::Tradition::Error->throw_collation_error( "Layered text differs for witness " . $wit->sigil )
                                                unless $pathtext eq $origtext{$acsig};
                                }
                        }
-               } catch ($e) {
+               } catch (Text::Tradition::Error $e) {
                        $c->stash->{result} = {
                                error_msg => $e->message,
                        };
index f011bc6..79162d9 100644 (file)
@@ -1325,7 +1325,10 @@ $(document).ready(function () {
     width: 250,
     modal: true,
     buttons: {
-        Cancel: function() { $( this ).dialog( "close" ); },
+        Cancel: function() {
+            document.getElementById('duplicate-merge-error').innerHTML = "";
+            $( this ).dialog( "close" );
+        },
         Detach: function ( evt ) {
             evt.target.id = 'detach_btn';
 
@@ -1352,6 +1355,8 @@ $(document).ready(function () {
 
             var jqjson = $.post(ncpath, form_values, function(data) {
                 if (data.success) {
+                    document.getElementById('duplicate-merge-error').innerHTML = "";
+
                     if (data.nodes) {
                         compress_nodes(data.nodes);
                     }