details: http://www.bx.psu.edu/hg/galaxy/rev/7e5797d6b584 changeset: 3390:7e5797d6b584 user: jeremy goecks <jeremy.goecks@emory.edu> date: Mon Feb 15 09:02:58 2010 -0500 description: Added annotations to display templates so that users see annotations when viewing an item. Also show labels and placeholders for input elements in workflow display page. diffstat: lib/galaxy/web/controllers/dataset.py | 3 +- lib/galaxy/web/controllers/history.py | 10 +++++- lib/galaxy/web/controllers/page.py | 12 ++++---- lib/galaxy/web/controllers/workflow.py | 11 +++++-- static/june_2007_style/blue/embed_item.css | 10 ++++-- templates/dataset/display.mako | 2 + templates/dataset/embed.mako | 3 -- templates/display_base.mako | 10 ++++++ templates/display_common.mako | 4 ++- templates/embed_base.mako | 5 ++- templates/history/display.mako | 45 +++++++++++++++++++---------- templates/history/embed.mako | 3 -- templates/workflow/display.mako | 40 ++++++++++++++++++-------- templates/workflow/embed.mako | 3 -- 14 files changed, 106 insertions(+), 55 deletions(-) diffs (417 lines): diff -r c6fe590de8d7 -r 7e5797d6b584 lib/galaxy/web/controllers/dataset.py --- a/lib/galaxy/web/controllers/dataset.py Sun Feb 14 16:03:54 2010 -0500 +++ b/lib/galaxy/web/controllers/dataset.py Mon Feb 15 09:02:58 2010 -0500 @@ -318,6 +318,7 @@ dataset = self.get_dataset( trans, slug ) if dataset: truncated, dataset_data = self.get_data( dataset, preview ) + dataset.annotation = self.get_item_annotation_str( trans.sa_session, dataset.history.user, dataset ) return trans.fill_template_mako( "/dataset/display.mako", item=dataset, item_data=dataset_data, truncated=truncated ) else: raise web.httpexceptions.HTTPNotFound() @@ -332,7 +333,7 @@ raise web.httpexceptions.HTTPNotFound() truncated, dataset_data = self.get_data( dataset, preview=True ) # Get annotation. - annotation = self.get_item_annotation_str( trans.sa_session, trans.get_user(), dataset ) + dataset.annotation = self.get_item_annotation_str( trans.sa_session, trans.get_user(), dataset ) return trans.stream_template_mako( "/dataset/item_content.mako", item=dataset, item_data=dataset_data, truncated=truncated ) diff -r c6fe590de8d7 -r 7e5797d6b584 lib/galaxy/web/controllers/history.py --- a/lib/galaxy/web/controllers/history.py Sun Feb 14 16:03:54 2010 -0500 +++ b/lib/galaxy/web/controllers/history.py Mon Feb 15 09:02:58 2010 -0500 @@ -418,8 +418,10 @@ # Get datasets. datasets = self.get_history_datasets( trans, history ) - # Get annotation. - annotation = self.get_item_annotation_str( trans.sa_session, trans.get_user(), history ) + # Get annotations. + history.annotation = self.get_item_annotation_str( trans.sa_session, history.user, history ) + for dataset in datasets: + dataset.annotation = self.get_item_annotation_str( trans.sa_session, history.user, dataset ) return trans.stream_template_mako( "/history/item_content.mako", item = history, item_data = datasets ) @web.expose @@ -531,6 +533,10 @@ # Get datasets. datasets = self.get_history_datasets( trans, history ) + # Get annotations. + history.annotation = self.get_item_annotation_str( trans.sa_session, history.user, history ) + for dataset in datasets: + dataset.annotation = self.get_item_annotation_str( trans.sa_session, history.user, dataset ) return trans.stream_template_mako( "history/display.mako", item = history, item_data = datasets ) diff -r c6fe590de8d7 -r 7e5797d6b584 lib/galaxy/web/controllers/page.py --- a/lib/galaxy/web/controllers/page.py Sun Feb 14 16:03:54 2010 -0500 +++ b/lib/galaxy/web/controllers/page.py Mon Feb 15 09:02:58 2010 -0500 @@ -695,22 +695,22 @@ item_class = self.get_class( item_class ) if item_class == model.History: history = self.get_history( trans, item_id, False, True ) + history.annotation = self.get_item_annotation_str( trans.sa_session, history.user, history ) if history: datasets = self.get_history_datasets( trans, history ) - annotation = self.get_item_annotation_str( trans.sa_session, history.user, history ) - return trans.fill_template( "history/embed.mako", item=history, item_data=datasets, annotation=annotation ) + return trans.fill_template( "history/embed.mako", item=history, item_data=datasets ) elif item_class == model.HistoryDatasetAssociation: dataset = self.get_dataset( trans, item_id ) + dataset.annotation = self.get_item_annotation_str( trans.sa_session, dataset.history.user, dataset ) if dataset: data = self.get_data( dataset ) - annotation = self.get_item_annotation_str( trans.sa_session, dataset.history.user, dataset ) - return trans.fill_template( "dataset/embed.mako", item=dataset, item_data=data, annotation=annotation ) + return trans.fill_template( "dataset/embed.mako", item=dataset, item_data=data ) elif item_class == model.StoredWorkflow: workflow = self.get_stored_workflow( trans, item_id, False, True ) + workflow.annotation = self.get_item_annotation_str( trans.sa_session, workflow.user, workflow ) if workflow: self.get_stored_workflow_steps( trans, workflow ) - annotation = self.get_item_annotation_str( trans.sa_session, workflow.user, workflow ) - return trans.fill_template( "workflow/embed.mako", item=workflow, item_data=workflow.latest_workflow.steps, annotation=annotation ) + return trans.fill_template( "workflow/embed.mako", item=workflow, item_data=workflow.latest_workflow.steps ) elif item_class == model.Page: pass diff -r c6fe590de8d7 -r 7e5797d6b584 lib/galaxy/web/controllers/workflow.py --- a/lib/galaxy/web/controllers/workflow.py Sun Feb 14 16:03:54 2010 -0500 +++ b/lib/galaxy/web/controllers/workflow.py Mon Feb 15 09:02:58 2010 -0500 @@ -180,7 +180,10 @@ # Get data for workflow's steps. self.get_stored_workflow_steps( trans, stored_workflow ) - + # Get annotations. + stored_workflow.annotation = self.get_item_annotation_str( trans.sa_session, stored_workflow.user, stored_workflow ) + for step in stored_workflow.latest_workflow.steps: + step.annotation = self.get_item_annotation_str( trans.sa_session, stored_workflow.user, step ) return trans.fill_template_mako( "workflow/display.mako", item=stored_workflow, item_data=stored_workflow.latest_workflow.steps ) @web.expose @@ -194,8 +197,10 @@ # Get data for workflow's steps. self.get_stored_workflow_steps( trans, stored ) - # Get annotation. - annotation = self.get_item_annotation_str( trans.sa_session, trans.get_user(), stored ) + # Get annotations. + stored.annotation = self.get_item_annotation_str( trans.sa_session, stored.user, stored ) + for step in stored.latest_workflow.steps: + step.annotation = self.get_item_annotation_str( trans.sa_session, stored.user, step ) return trans.stream_template_mako( "/workflow/item_content.mako", item = stored, item_data = stored.latest_workflow.steps ) @web.expose diff -r c6fe590de8d7 -r 7e5797d6b584 static/june_2007_style/blue/embed_item.css --- a/static/june_2007_style/blue/embed_item.css Sun Feb 14 16:03:54 2010 -0500 +++ b/static/june_2007_style/blue/embed_item.css Mon Feb 15 09:02:58 2010 -0500 @@ -1,4 +1,8 @@ -.embedded-item{background-color: #BBBBBB; margin-left: auto; margin-right: auto; width: 90%; max-height: 25em; overflow: auto; padding: 0.5em;-moz-border-radius: .5em;-webkit-border-radius: .5em;border-radius: .5em;} +.embedded-item{background-color:#BBBBBB;margin-left:auto;margin-right:auto;width:90%;max-height:25em;overflow:auto;padding: 0.5em;-moz-border-radius:0.5em;-webkit-border-radius:0.5em;border-radius:0.5em;} .embedded-item.placeholder{} -.embedded-item .title{font-weight: bold;font-size:120%;vertical-align:top;text-align:center;} -.embedded-item.placeholder .content{padding: 1em 1em;font-style:italic;text-align:center;} \ No newline at end of file +.embedded-item .title{vertical-align:top;text-align:center;} +.embedded-item.placeholder .content{padding: 1em 1em;font-style:italic;text-align:center;} +table.annotated-item{width:100%;border-collapse:collapse;} +table.annotated-item td,th{padding:0;} +table.annotated-item .annotation{padding-left:2em;width:40%;} +table.annotated-item td.annotation{vertical-align:text-top;padding-top:1em;} \ No newline at end of file diff -r c6fe590de8d7 -r 7e5797d6b584 templates/dataset/display.mako --- a/templates/dataset/display.mako Sun Feb 14 16:03:54 2010 -0500 +++ b/templates/dataset/display.mako Mon Feb 15 09:02:58 2010 -0500 @@ -53,6 +53,8 @@ ${self.render_item_links( item )} </div> + ${self.render_item_header( item )} + ${self.render_item( item, item_data )} </div> </div> diff -r c6fe590de8d7 -r 7e5797d6b584 templates/dataset/embed.mako --- a/templates/dataset/embed.mako Sun Feb 14 16:03:54 2010 -0500 +++ b/templates/dataset/embed.mako Mon Feb 15 09:02:58 2010 -0500 @@ -4,9 +4,6 @@ %> <%def name="content( dataset, data )"> - %if annotation: - <div class='annotation'>${annotation}</div> - %endif <ul> <li>Format : ${dataset.extension} </ul> diff -r c6fe590de8d7 -r 7e5797d6b584 templates/display_base.mako --- a/templates/display_base.mako Sun Feb 14 16:03:54 2010 -0500 +++ b/templates/display_base.mako Mon Feb 15 09:02:58 2010 -0500 @@ -77,6 +77,14 @@ ## Override. </%def> +<%def name="render_item_header( item )"> + <h3>Galaxy ${get_class_display_name( item.__class__ )} '${get_item_name( item )| h}'</h3> + %if hasattr( item, "annotation"): + <div class="annotation">Description/Notes: ${item.annotation}</div> + %endif + <hr/> +</%def> + <%def name="render_item( item, item_data=None )"> ## Override. </%def> @@ -130,6 +138,8 @@ ${self.render_item_links( item )} </div> + ${self.render_item_header( item )} + ${self.render_item( item, item_data )} </div> diff -r c6fe590de8d7 -r 7e5797d6b584 templates/display_common.mako --- a/templates/display_common.mako Sun Feb 14 16:03:54 2010 -0500 +++ b/templates/display_common.mako Mon Feb 15 09:02:58 2010 -0500 @@ -20,7 +20,9 @@ <% if type( item ) is model.Page: return item.title - return item.name + if hasattr( item, 'get_display_name'): + return item.get_display_name() + return item.name %> </%def> diff -r c6fe590de8d7 -r 7e5797d6b584 templates/embed_base.mako --- a/templates/embed_base.mako Sun Feb 14 16:03:54 2010 -0500 +++ b/templates/embed_base.mako Mon Feb 15 09:02:58 2010 -0500 @@ -19,7 +19,7 @@ </div> <%def name="title( item )"> - Galaxy ${get_class_display_name( item.__class__ )} | ${get_item_name( item )} + <h4>Galaxy ${get_class_display_name( item.__class__ )} | ${get_item_name( item )}</h4> <% item_controller = "/%s" % get_controller_name( item ) item_user = get_item_user( item ) @@ -28,6 +28,9 @@ %> <a class="display_in_embed icon-button toggle-expand" item_id="${trans.security.encode_id( item.id )}" item_class="$item.__class__.__name__" href="${display_href}"></a> <a class="toggle-contract icon-button" href="${display_href}"></a> + %if hasattr( item, "annotation"): + <div class="annotation">Description/Notes: ${item.annotation}</div> + %endif ## Use a hidden var to store the ajax URL for getting an item's content. <input type="hidden" name="ajax-item-content-url" value="${h.url_for( controller=item_controller, action='get_item_content_async', id=trans.security.encode_id( item.id ) )}"/> diff -r c6fe590de8d7 -r 7e5797d6b584 templates/history/display.mako --- a/templates/history/display.mako Sun Feb 14 16:03:54 2010 -0500 +++ b/templates/history/display.mako Mon Feb 15 09:02:58 2010 -0500 @@ -209,13 +209,21 @@ ${h.css( "history" )} <style type="text/css"> .visible-right-border { - padding-right: 3px; - border-right-style: solid; - border-right-color: #66AA66; + padding-right: 3px; + border-right-style: solid; + border-right-color: #66AA66; } .historyItemBody { display: none; } + .column { + float: left; + padding: 10px; + margin: 20px; + background: #666; + border: 5px solid #ccc; + width: 300px; + } </style> <noscript> @@ -231,7 +239,8 @@ %if history.user != trans.get_user(): <a href="${h.url_for( controller='/history', action='imp', id=trans.security.encode_id(history.id) )}">import and start using history</a> %else: - your history + ## TODO: add tooltip to indicate why this link is disabled. + import and start using history %endif ##<a href="${self.get_history_link( history )}">${_('refresh')}</a> %if show_deleted: @@ -240,10 +249,6 @@ </%def> <%def name="render_item( history, datasets )"> - <div id="history-name-area" class="historyLinks" style="color: gray; font-weight: bold; padding: 0px 0px 5px 0px"> - <div id="history-name">${history.get_display_name() | h}</div> - </div> - %if history.deleted: <div class="warningmessagesmall"> ${_('You are currently viewing a deleted history!')} @@ -254,14 +259,22 @@ %if not datasets: <div class="infomessagesmall" id="emptyHistoryMessage"> %else: - ## Render requested datasets, ordered from newest to oldest - %for data in datasets: - %if data.visible: - <div class="historyItemContainer visible-right-border" id="historyItemContainer-${data.id}"> - ${render_dataset( data, data.hid, show_deleted_on_refresh = show_deleted, user_owns_dataset=user_owns_history )} - </div> - %endif - %endfor + ## Render requested datasets, ordered from newest to oldest, including annotations. + <table class="annotated-item"> + <tr><th>Dataset</th><th class="annotation">Description/Notes</th></tr> + %for data in datasets: + <tr> + %if data.visible: + <td> + <div class="historyItemContainer visible-right-border" id="historyItemContainer-${data.id}"> + ${render_dataset( data, data.hid, show_deleted_on_refresh = show_deleted, user_owns_dataset=user_owns_history )} + </div> + </td> + <td class="annotation">${data.annotation}</td> + %endif + </tr> + %endfor + </table> <div class="infomessagesmall" id="emptyHistoryMessage" style="display:none;"> %endif ${_("Your history is empty. Click 'Get Data' on the left pane to start")} diff -r c6fe590de8d7 -r 7e5797d6b584 templates/history/embed.mako --- a/templates/history/embed.mako Sun Feb 14 16:03:54 2010 -0500 +++ b/templates/history/embed.mako Mon Feb 15 09:02:58 2010 -0500 @@ -4,9 +4,6 @@ %> <%def name="content( history, datasets )"> - %if annotation: - <div class='annotation'>${annotation}</div> - %endif <ul> <% num_datasets = len ( datasets ) %> <li>${num_datasets} dataset${iff( num_datasets != 1, "s", "" )} diff -r c6fe590de8d7 -r 7e5797d6b584 templates/workflow/display.mako --- a/templates/workflow/display.mako Sun Feb 14 16:03:54 2010 -0500 +++ b/templates/workflow/display.mako Mon Feb 15 09:02:58 2010 -0500 @@ -1,6 +1,9 @@ <%inherit file="/display_base.mako"/> -<%! from galaxy.tools.parameters import DataToolParameter, RuntimeValue %> +<%! + from galaxy.tools.parameters import DataToolParameter, RuntimeValue + from galaxy.web import form_builder +%> <%def name="stylesheets()"> ${parent.stylesheets()} @@ -21,10 +24,9 @@ <% repeat_values = values[input.name] %> %for i in range( len( repeat_values ) ): <div class="repeat-group-item"> - <% index = repeat_values[i]['__index__'] %> - <div class="form-title-row"><b>${input.title} ${i + 1}</b></div> - ${do_inputs( input.inputs, repeat_values[ i ], prefix + input.name + "_" + str(index) + "|", step, other_values )} - + <% index = repeat_values[i]['__index__'] %> + <div class="form-title-row"><b>${input.title} ${i + 1}</b></div> + ${do_inputs( input.inputs, repeat_values[ i ], prefix + input.name + "_" + str(index) + "|", step, other_values )} </div> %endfor </div> @@ -37,7 +39,7 @@ %else: ${row_for_param( input, values[ input.name ], other_values, prefix, step )} %endif - %endfor + %endfor </%def> <%def name="row_for_param( param, value, other_values, prefix, step )"> @@ -58,12 +60,18 @@ other_values = {} value = other_values[ param.name ] = param.get_initial_value( t, other_values ) %> - ${param.get_html_field( t, value, other_values ).get_html( str(step.id) + "|" + prefix )} + ## For display, do not show input elements. + <% html_field = param.get_html_field( t, value, other_values ) %> + %if type( html_field ) in [ form_builder.SelectField ]: + <i>select at runtime</i> + %else: + ${html_field.get_html( str(step.id) + "|" + prefix )} + %endif %endif %else: ${param.value_to_display_text( value, app )} %endif - </div> + </div> </div> </%def> @@ -72,13 +80,15 @@ %if workflow.user != trans.get_user(): <a href="${h.url_for( controller='/workflow', action='imp', id=trans.security.encode_id(workflow.id) )}">import and start using workflow</a> %else: - your workflow + import and start using workflow %endif </%def> <%def name="render_item( workflow, steps )"> - <h2>${workflow.name | h}</h2> - %for i, step in enumerate( steps ): + <table class="annotated-item"> + <tr><th>Step</th><th class="annotation">Description/Notes</th></tr> + %for i, step in enumerate( steps ): + <tr><td> %if step.type == 'tool' or step.type is None: <% tool = app.toolbox.tools_by_id[step.tool_id] %> <div class="toolForm"> @@ -88,14 +98,18 @@ </div> </div> %else: + ## TODO: always input dataset? <% module = step.module %> <div class="toolForm"> <div class="toolFormTitle">Step ${int(step.order_index)+1}: ${module.name}</div> <div class="toolFormBody"> - ##Need to do more work to print only dataset label and not combo box as well. - ##${do_inputs( module.get_runtime_inputs(), step.state.inputs, "", step )} + ${do_inputs( module.get_runtime_inputs(), step.state.inputs, "", step )} </div> </div> %endif + </td> + <td class="annotation">${step.annotation}</td> + </tr> %endfor + </table> </%def> \ No newline at end of file diff -r c6fe590de8d7 -r 7e5797d6b584 templates/workflow/embed.mako --- a/templates/workflow/embed.mako Sun Feb 14 16:03:54 2010 -0500 +++ b/templates/workflow/embed.mako Mon Feb 15 09:02:58 2010 -0500 @@ -4,9 +4,6 @@ %> <%def name="content( workflow, steps )"> - %if annotation: - <div class='annotation'>${annotation}</div> - %endif <ul> <% num_steps = len ( steps ) %> <li>${num_steps} step${iff( num_steps != 1, "s", "" )}