From: Tara L Andrews Date: Sun, 30 Sep 2012 14:03:03 +0000 (+0200) Subject: rely on T::T 1.2, handle relationship propagation X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=eeea8fb65f839e321e3bbc4a0012088d414d268d;p=scpubgit%2Fstemmaweb.git rely on T::T 1.2, handle relationship propagation --- diff --git a/Makefile.PL b/Makefile.PL index e268669..d883b3e 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -10,7 +10,7 @@ name 'stemmaweb'; all_from 'lib/stemmaweb.pm'; # Tradition libraries -requires 'Text::Tradition' => '1.1'; +requires 'Text::Tradition' => '1.2'; requires 'Text::Tradition::Directory'; requires 'Text::Tradition::Analysis'; requires 'Text::Tradition::StemmaUtil'; diff --git a/root/js/relationship-full.js b/root/js/relationship-full.js index 20424db..fb81069 100644 --- a/root/js/relationship-full.js +++ b/root/js/relationship-full.js @@ -204,6 +204,9 @@ function add_relations( callback_fn ) { var textrelpath = getTextURL( 'relationships' ); $.getJSON( basepath + 'definitions', function(data) { var rel_types = data.types.sort(); + // Add the relationship types to our document data so that we don't have + // to call again + $('#keymap').data( 'relations', rel_types ); $.getJSON( textrelpath, function(data) { $.each(data, function( index, rel_info ) { @@ -638,10 +641,10 @@ $(document).ready(function () { $.each( data, function(item, source_target) { var source_found = get_ellipse( source_target[0] ); var target_found = get_ellipse( source_target[1] ); - var relation_found = $.inArray( source_target[2], rel_types ); + var relation_found = $.inArray( source_target[2], $('#keymap').data('relations') ); if( source_found.size() && target_found.size() && relation_found > -1 ) { - var relation = relation_manager.create( source_target[0], source_target[1], $('#rel_type')[0].selectedIndex-1 ); - relation.data( 'type', $('#rel_type :selected').text() ); + var relation = relation_manager.create( source_target[0], source_target[1], relation_found ); + relation.data( 'type', source_target[2] ); relation.data( 'scope', $('#scope :selected').text() ); relation.data( 'note', $('#note').val() ); relation_manager.toggle_active( relation.attr('id') );