From 953ddfd9e17d65312f0e3bf8dd06d0f2fca7a877 Mon Sep 17 00:00:00 2001 From: Jeremy Goecks Date: Thu, 4 Mar 2010 16:16:42 -0500 Subject: [PATCH] Better handling of workflow step annotations. --- static/scripts/galaxy.workflow_editor.canvas.js | 8 +++++++- templates/workflow/editor.mako | 7 +++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/static/scripts/galaxy.workflow_editor.canvas.js b/static/scripts/galaxy.workflow_editor.canvas.js index 58c564be000..ebdf949f23f 100644 --- a/static/scripts/galaxy.workflow_editor.canvas.js +++ b/static/scripts/galaxy.workflow_editor.canvas.js @@ -308,6 +308,7 @@ $.extend( Node.prototype, { this.tool_state = data.tool_state; this.form_html = data.form_html; this.tool_errors = data.tool_errors; + this.annotation = data['annotation']; if ( this.tool_errors ) { el.addClass( "tool-node-error" ); } else { @@ -447,7 +448,12 @@ $.extend( Workflow.prototype, { // If active form has changed, save it if (this.active_form_has_changes) { this.has_changes = true; - $("#right-content").find("form").submit(); + // Get annotation and add to form. + var annotation = $("textarea[name=annotation]").val(); + var tool_form = $("#right-content").find("form"); + tool_form.append( "" ); + // Submit form. + tool_form.submit(); this.active_form_has_changes = false; } }, diff --git a/templates/workflow/editor.mako b/templates/workflow/editor.mako index 988d8b803ab..88c765ee990 100644 --- a/templates/workflow/editor.mako +++ b/templates/workflow/editor.mako @@ -367,11 +367,10 @@ \ \ "); - // When metadata is changed, update node and set workflow changes flag. + // See above comment: this is necessary to handle autosaving. var textarea = $(metadata_div).find("textarea"); - textarea.change( function () { - node.annotation = $(this).val(); - workflow.has_changes = true; + textarea.focus( function () { + workflow.active_form_has_changes = true; }); $("#right-content").find(".toolForm").after( metadata_div ); }