[hg] galaxy 3552: Fix saving annotations in workflow editor
details: http://www.bx.psu.edu/hg/galaxy/rev/2bda9c59b992 changeset: 3552:2bda9c59b992 user: James Taylor <james@jamestaylor.org> date: Mon Mar 22 17:11:10 2010 -0400 description: Fix saving annotations in workflow editor diffstat: static/scripts/galaxy.workflow_editor.canvas.js | 6 +--- templates/workflow/editor.mako | 39 ++++++++++-------------- templates/workflow/editor_tool_form.mako | 15 +++++--- 3 files changed, 26 insertions(+), 34 deletions(-) diffs (104 lines): diff -r 84386da2a3f3 -r 2bda9c59b992 static/scripts/galaxy.workflow_editor.canvas.js --- a/static/scripts/galaxy.workflow_editor.canvas.js Mon Mar 22 16:59:20 2010 -0400 +++ b/static/scripts/galaxy.workflow_editor.canvas.js Mon Mar 22 17:11:10 2010 -0400 @@ -448,12 +448,8 @@ // If active form has changed, save it if (this.active_form_has_changes) { this.has_changes = true; - // Get annotation and add to form. - var annotation = $("textarea[name=annotation]").val(); - var tool_form = $("#right-content").find("form"); - tool_form.append( "<input type='hidden' name='annotation' value='"+annotation+"' />" ); // Submit form. - tool_form.submit(); + $("#right-content").find("form").submit(); this.active_form_has_changes = false; } }, diff -r 84386da2a3f3 -r 2bda9c59b992 templates/workflow/editor.mako --- a/templates/workflow/editor.mako Mon Mar 22 16:59:20 2010 -0400 +++ b/templates/workflow/editor.mako Mon Mar 22 17:11:10 2010 -0400 @@ -310,7 +310,22 @@ function show_form_for_tool( text, node ) { $("#edit-attributes").hide(); - $("#right-content").show().html( text ); + $("#right-content").show().html( text ); + + // Add metadata form to tool. + if (node) { + $("#right-content").find(".toolForm").after( "<p><div class='metadataForm'> \ + <div class='metadataFormTitle'>Edit Step Attributes</div> \ + <div class='form-row'> \ + <label>Annotation / Notes:</label> \ + <div style='margin-right: 10px;'> \ + <textarea name='annotation' rows='3' style='width: 100%'>" + node.annotation + "</textarea> \ + <div class='toolParamHelp'>Add an annotation or notes to this step; annotations are available when a workflow is viewed.</div> \ + </div> \ + </div> \ + </div>" ); + } + $("#right-content").find( "form" ).ajaxForm( { type: 'POST', dataType: 'json', @@ -352,28 +367,6 @@ }); }); }); - - - // Add metadata form to tool. - if (node) { - var metadata_div = - $( "<p><div class='metadataForm'> \ - <div class='metadataFormTitle'>Edit Step Attributes</div> \ - <div class='form-row'> \ - <label>Annotation / Notes:</label> \ - <div style='margin-right: 10px;'> \ - <textarea name='annotation' rows='3' style='width: 100%'>" + node.annotation + "</textarea> \ - <div class='toolParamHelp'>Add an annotation or notes to this step; annotations are available when a workflow is viewed.</div> \ - </div> \ - </div> \ - </div>"); - // See above comment: this is necessary to handle autosaving. - var textarea = $(metadata_div).find("textarea"); - textarea.focus( function () { - workflow.active_form_has_changes = true; - }); - $("#right-content").find(".toolForm").after( metadata_div ); - } } var close_editor = function() { diff -r 84386da2a3f3 -r 2bda9c59b992 templates/workflow/editor_tool_form.mako --- a/templates/workflow/editor_tool_form.mako Mon Mar 22 16:59:20 2010 -0400 +++ b/templates/workflow/editor_tool_form.mako Mon Mar 22 17:11:10 2010 -0400 @@ -94,10 +94,11 @@ </div> </%def> -<div class="toolForm"> - <div class="toolFormTitle">Tool: ${tool.name}</div> - <div class="toolFormBody"> - <form method="post" action="${h.url_for( action='editor_form_post' )}"> +<form method="post" action="${h.url_for( action='editor_form_post' )}"> + + <div class="toolForm"> + <div class="toolFormTitle">Tool: ${tool.name}</div> + <div class="toolFormBody"> <input type="hidden" name="tool_id" value="${tool.id}" /> %for i, inputs in enumerate( tool.inputs_by_page ): %if tool.has_multiple_pages: @@ -105,6 +106,8 @@ %endif ${do_inputs( inputs, values, errors, "" )} %endfor - </form> + </div> </div> -</div> + + +</form> \ No newline at end of file
participants (1)
-
Greg Von Kuster