X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=root%2Fjs%2Frelationship.js;h=c98077b7963aa88b9d2bc9e6dc8d1133ce3e60ff;hb=b6f3476bd55d911d9fe9132f8b0321bbe7727213;hp=6eb672f766bd61d8f82175c65143ee15261ee199;hpb=0c4354f64bfe31724f55899acbceb27224ffefcb;p=scpubgit%2Fstemmaweb.git diff --git a/root/js/relationship.js b/root/js/relationship.js index 6eb672f..c98077b 100644 --- a/root/js/relationship.js +++ b/root/js/relationship.js @@ -665,7 +665,18 @@ function draw_relation( source_id, target_id, relation_color ) { function detach_node( readings ) { // separate out the deleted relationships, discard for now - delete readings['DELETED']; + if( 'DELETED' in readings ) { + // Remove each of the deleted relationship links. + $.each( readings['DELETED'], function( idx, pair ) { + var relation_id = get_relation_id( pair[0], pair[1] ); + var relation = $( jq( relation_id ) ); + if( relation.size() == 0 ) { + relation_id = get_relation_id( pair[1], pair[0] ); + } + relation_manager.remove( relation_id ); + }); + delete readings['DELETED']; + } // add new node(s) $.extend( readingdata, readings ); // remove from existing readings the witnesses for the new nodes/readings