From: Joris van Zundert Date: Wed, 19 Jun 2013 22:06:07 +0000 (+0200) Subject: Added witnesses selection form interactivity; issues with selection state to be resolved. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a84ca4de01286da8da9b73ac584211a26b9c3b75;p=scpubgit%2Fstemmaweb.git Added witnesses selection form interactivity; issues with selection state to be resolved. --- diff --git a/root/js/relationship.js b/root/js/relationship.js index 9782e82..be8dc6a 100644 --- a/root/js/relationship.js +++ b/root/js/relationship.js @@ -5,6 +5,17 @@ var start_element_height = 0; var reltypes = {}; var readingdata = {}; +function arrayUnique(array) { + var a = array.concat(); + for(var i=0; i cy_min && cy < cy_max) { // we actually heve no real 'selected' state for nodes, except coloring $(this).attr( 'fill', '#ffccff' ); + var this_witnesses = $(this).data( 'node_obj' ).get_witnesses(); + witnesses = arrayUnique( witnesses.concat( this_witnesses ) ); } } }); - // select here + if( $('ellipse[fill="#ffccff"]').size() > 0 ) { + $.each( witnesses, function( index, value ) { + $('#multipleselect-form').append( '' + value + '
' ); + }); + $('#multipleselect-form').dialog( 'open' ); + } self.svg_rect.remove( $('#marquee') ); } }; @@ -678,7 +701,7 @@ $(document).ready(function () { event.preventDefault(); return false; }).mouseup(function (event) { - marquee.hide(); + marquee.select(); $(this).data('down', false); }).mousemove(function (event) { if( timer != null ) { clearTimeout(timer); } @@ -813,6 +836,7 @@ $(document).ready(function () { global: function () { delete_relation( true ); }, delete: function() { delete_relation( false ); } }; + $( "#delete-form" ).dialog({ autoOpen: false, height: 135, @@ -820,8 +844,12 @@ $(document).ready(function () { modal: false, create: function(event, ui) { // TODO What is this logic doing? + // This scales the buttons in the dialog and makes it look proper + // Not sure how essential it is, does anything break if it's not here? var buttonset = $(this).parent().find( '.ui-dialog-buttonset' ).css( 'width', '100%' ); buttonset.find( "button:contains('Cancel')" ).css( 'float', 'right' ); + // A: This makes sure that the pop up delete relation dialogue for a hovered over + // relation auto closes if the user doesn't engage (mouseover) with it. var dialog_aria = $("div[aria-labelledby='ui-dialog-title-delete-form']"); dialog_aria.mouseenter( function() { if( mouseWait != null ) { clearTimeout(mouseWait) }; @@ -852,6 +880,31 @@ $(document).ready(function () { close: function() {} }); + var multipleselect_buttonset = { + cancel: function() { $( this ).dialog( "close" ); }, + button1: function () { }, + button2: function() { } + }; + + $( "#multipleselect-form" ).dialog({ + autoOpen: false, + height: 150, + width: 250, + modal: true, + create: function(event, ui) { + var buttonset = $(this).parent().find( '.ui-dialog-buttonset' ).css( 'width', '100%' ); + buttonset.find( "button:contains('Cancel')" ).css( 'float', 'right' ); + }, + open: function() { + $( this ).dialog( "option", "width", 200 ); + $( this ).dialog( "option", "buttons", + [{ text: "Button_1", click: multipleselect_buttonset['button1'] }, + { text: "Button_2", click: multipleselect_buttonset['button2'] }, + { text: "Cancel", click: multipleselect_buttonset['cancel'] }] ); + }, + close: function() {} + }); + // Helpers for relationship deletion function delete_relation( scopewide ) { diff --git a/root/src/relate.tt b/root/src/relate.tt index fe053ff..36403b4 100644 --- a/root/src/relate.tt +++ b/root/src/relate.tt @@ -88,6 +88,14 @@ $(document).ready(function () { Scope:
+ +
+
+ + +
+
This should turn into a proper form.
+