[hg] galaxy 3693: Fix multiple issues for history display. Fixes...
details: http://www.bx.psu.edu/hg/galaxy/rev/df8fc06fdac9 changeset: 3693:df8fc06fdac9 user: jeremy goecks <jeremy.goecks@emory.edu> date: Sun Apr 25 16:18:15 2010 -0400 description: Fix multiple issues for history display. Fixes include: (a) empty annotations hidden; (b) text 'import XXX' added next to import icon; (c) fix dataset display links; (d) fix dataset view links; and (e) fix peek placement. diffstat: lib/galaxy/datatypes/interval.py | 2 +- lib/galaxy/web/controllers/history.py | 2 -- templates/dataset/display.mako | 5 ++++- templates/display_base.mako | 2 +- templates/history/display.mako | 15 ++++++++++++--- templates/history/view.mako | 12 +----------- templates/page/history_annotation_table.mako | 2 +- templates/root/history.mako | 2 +- templates/root/history_common.mako | 28 ++++++++++++++++++++++------ templates/workflow/display.mako | 7 ++++++- 10 files changed, 49 insertions(+), 28 deletions(-) diffs (237 lines): diff -r 7151ae06bf7a -r df8fc06fdac9 lib/galaxy/datatypes/interval.py --- a/lib/galaxy/datatypes/interval.py Sat Apr 24 15:03:22 2010 -0400 +++ b/lib/galaxy/datatypes/interval.py Sun Apr 25 16:18:15 2010 -0400 @@ -235,7 +235,7 @@ # if our URL scheme is https. Making this work # requires additional hackery in your upstream proxy. # If UCSC ever supports https, remove this hack. - internal_url = "%s" % url_for( controller='dataset', dataset_id=dataset.id, action='display_at', filename='ucsc_' + site_name ) + internal_url = "%s" % url_for( controller='/dataset', dataset_id=dataset.id, action='display_at', filename='ucsc_' + site_name ) if base_url.startswith( 'https://' ): base_url = base_url.replace( 'https', 'http', 1 ) display_url = urllib.quote_plus( "%s%s/display_as?id=%i&display_app=%s&authz_method=display_at" % (base_url, url_for( controller='root' ), dataset.id, type) ) diff -r 7151ae06bf7a -r df8fc06fdac9 lib/galaxy/web/controllers/history.py --- a/lib/galaxy/web/controllers/history.py Sat Apr 24 15:03:22 2010 -0400 +++ b/lib/galaxy/web/controllers/history.py Sun Apr 25 16:18:15 2010 -0400 @@ -590,11 +590,9 @@ error( "Either you are not allowed to view this history or the owner of this history has not made it accessible." ) # View history. datasets = self.get_history_datasets( trans, history_to_view ) - user_owns_history = ( trans.get_user() == history_to_view.user ) return trans.stream_template_mako( "history/view.mako", history = history_to_view, datasets = datasets, - user_owns_history = user_owns_history, show_deleted = False ) @web.expose diff -r 7151ae06bf7a -r df8fc06fdac9 templates/dataset/display.mako --- a/templates/dataset/display.mako Sat Apr 24 15:03:22 2010 -0400 +++ b/templates/dataset/display.mako Sun Apr 25 16:18:15 2010 -0400 @@ -24,7 +24,10 @@ <%def name="render_item_links( data )"> ## Provide links to save data and import dataset. <a href="${h.url_for( controller='/dataset', action='display', dataset_id=trans.security.encode_id( data.id ), to_ext=data.ext )}" class="icon-button disk tooltip" title="Save dataset"></a> - <a href="${h.url_for( controller='/dataset', action='imp', dataset_id=trans.security.encode_id( data.id ) )}" class="icon-button import tooltip" title="Import dataset"></a> + <a + href="${h.url_for( controller='/dataset', action='imp', dataset_id=trans.security.encode_id( data.id ) )}" + class="icon-button import tooltip" + title="Import dataset"></a> </%def> <%def name="render_item( data, data_to_render )"> diff -r 7151ae06bf7a -r df8fc06fdac9 templates/display_base.mako --- a/templates/display_base.mako Sat Apr 24 15:03:22 2010 -0400 +++ b/templates/display_base.mako Sun Apr 25 16:18:15 2010 -0400 @@ -114,7 +114,7 @@ <%def name="render_item_header( item )"> <h3>Galaxy ${get_class_display_name( item.__class__ )} '${get_item_name( item )| h}'</h3> - %if hasattr( item, "annotation"): + %if hasattr( item, "annotation") and item.annotation is not None: <div class="annotation">Annotation: ${item.annotation}</div> %endif <hr/> diff -r 7151ae06bf7a -r df8fc06fdac9 templates/history/display.mako --- a/templates/history/display.mako Sat Apr 24 15:03:22 2010 -0400 +++ b/templates/history/display.mako Sun Apr 25 16:18:15 2010 -0400 @@ -38,7 +38,12 @@ </%def> <%def name="render_item_links( history )"> - <a href="${h.url_for( controller='/history', action='imp', id=trans.security.encode_id(history.id) )}" class="icon-button import tooltip" title="Import history"></a> + <a + href="${h.url_for( controller='/history', action='imp', id=trans.security.encode_id(history.id) )}" + class="icon-button import" + ## Needed to overwide initial width so that link is floated left appropriately. + style="width: 100%" + title="Import history">Import history</a> </%def> <%def name="render_item( history, datasets )"> @@ -60,10 +65,14 @@ %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 )} + ${render_dataset( data, data.hid, show_deleted_on_refresh = show_deleted, for_editing=False )} </div> </td> - <td class="annotation">${data.annotation}</td> + <td class="annotation"> + %if hasattr( data, "annotation") and data.annotation is not None: + ${data.annotation} + %endif + </td> %endif </tr> %endfor diff -r 7151ae06bf7a -r df8fc06fdac9 templates/history/view.mako --- a/templates/history/view.mako Sat Apr 24 15:03:22 2010 -0400 +++ b/templates/history/view.mako Sun Apr 25 16:18:15 2010 -0400 @@ -64,11 +64,6 @@ </%def> <%def name="center_panel()"> - ## For now, turn off inline editing so that view is external only. - <% - user_owns_history = False - %> - ## Get URL to other histories owned by user that owns this history. <% ##TODO: is there a better way to create this URL? Can't use 'f-username' as a key b/c it's not a valid identifier. @@ -84,9 +79,7 @@ <div style="overflow: auto; height: 100%;"> ## Render view of history. <div id="top-links" class="historyLinks" style="padding: 0px 0px 5px 0px"> - %if not user_owns_history: <a href="${h.url_for( action='imp', id=trans.security.encode_id(history.id) )}">import and start using history</a> | - %endif <a href="${get_history_link( history )}">${_('refresh')}</a> %if show_deleted: | <a href="${h.url_for('history', show_deleted=False)}">${_('hide deleted')}</a> @@ -95,9 +88,6 @@ </div> <div id="history-name-area" class="historyLinks" style="color: gray; font-weight: bold; padding: 0px 0px 5px 0px"> - %if user_owns_history: - <div style="float: right"><a id="history-rename" title="Rename" class="icon-button edit" target="galaxy_main" href="${h.url_for( controller='history', action='rename' )}"></a></div> - %endif <div id="history-name">${history.get_display_name()}</div> </div> @@ -118,7 +108,7 @@ %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 )} + ${render_dataset( data, data.hid, show_deleted_on_refresh = show_deleted, for_editing=False )} </div> %endif %endfor diff -r 7151ae06bf7a -r df8fc06fdac9 templates/page/history_annotation_table.mako --- a/templates/page/history_annotation_table.mako Sat Apr 24 15:03:22 2010 -0400 +++ b/templates/page/history_annotation_table.mako Sun Apr 25 16:18:15 2010 -0400 @@ -50,7 +50,7 @@ ##<td valign="top" class="annotation">Describe this step: why was it done? what data does it produce?</td> <td> <div class="historyItemContainer" id="historyItemContainer-${data.id}"> - ${render_dataset( data, data.hid, show_deleted_on_refresh = show_deleted, user_owns_dataset = False )} + ${render_dataset( data, data.hid, show_deleted_on_refresh = show_deleted, for_editing = False )} </div> </td> </tr> diff -r 7151ae06bf7a -r df8fc06fdac9 templates/root/history.mako --- a/templates/root/history.mako Sat Apr 24 15:03:22 2010 -0400 +++ b/templates/root/history.mako Sun Apr 25 16:18:15 2010 -0400 @@ -387,7 +387,7 @@ %for data in reversed( datasets ): %if data.visible: <div class="historyItemContainer" id="historyItemContainer-${data.id}"> - ${render_dataset( data, data.hid, show_deleted_on_refresh = show_deleted, user_owns_dataset = True )} + ${render_dataset( data, data.hid, show_deleted_on_refresh = show_deleted, for_editing = True )} </div> %endif %endfor diff -r 7151ae06bf7a -r df8fc06fdac9 templates/root/history_common.mako --- a/templates/root/history_common.mako Sat Apr 24 15:03:22 2010 -0400 +++ b/templates/root/history_common.mako Sun Apr 25 16:18:15 2010 -0400 @@ -1,6 +1,6 @@ <% _=n_ %> ## Render the dataset `data` as history item, using `hid` as the displayed id -<%def name="render_dataset( data, hid, show_deleted_on_refresh = False, user_owns_dataset = True )"> +<%def name="render_dataset( data, hid, show_deleted_on_refresh = False, for_editing = True )"> <a name="${trans.security.encode_id( data.id )}"></a> <% if data.state in ['no state','',None]: @@ -29,16 +29,28 @@ ## links should be enough. However the number of datasets being uploaded ## at a time is usually small so the impact of these images is also small. <img src="${h.url_for('/static/images/eye_icon_grey.png')}" width='16' height='16' alt='display data' title='display data' class='button display' border='0'> - %if user_owns_dataset: + %if for_editing: <img src="${h.url_for('/static/images/pencil_icon_grey.png')}" width='16' height='16' alt='edit attributes' title='edit attributes' class='button edit' border='0'> %endif %else: - <a class="icon-button display tooltip" title="Display data in browser" href="${h.url_for( controller='dataset', action='display', dataset_id=trans.security.encode_id( data.id ), preview=True, filename='' )}" target="galaxy_main"></a> - %if user_owns_dataset: + <% + dataset_id = trans.security.encode_id( data.id ) + if for_editing: + display_url = h.url_for( controller='dataset', action='display', dataset_id=dataset_id, preview=True, filename='' ) + else: + display_url = h.url_for( controller='dataset', action='display_by_username_and_slug', + username=data.history.user.username, slug=dataset_id ) + %> + <a class="icon-button display tooltip" title="Display data in browser" href="${display_url}" + %if for_editing: + target="galaxy_main" + %endif + ></a> + %if for_editing: <a class="icon-button edit tooltip" title="Edit attributes" href="${h.url_for( controller='root', action='edit', id=data.id )}" target="galaxy_main"></a> %endif %endif - %if user_owns_dataset: + %if for_editing: <a class="icon-button delete tooltip" title="Delete" href="${h.url_for( action='delete', id=data.id, show_deleted_on_refresh=show_deleted_on_refresh )}" id="historyItemDeleter-${data.id}"></a> %endif </div> @@ -89,7 +101,7 @@ <% dataset_id=trans.security.encode_id( data.id ) %> %if data.has_data: <a href="${h.url_for( controller='dataset', action='display', dataset_id=dataset_id, to_ext=data.ext )}" title="Save" class="icon-button disk tooltip"></a> - %if user_owns_dataset: + %if for_editing: <a href="${h.url_for( controller='tool_runner', action='rerun', id=data.id )}" target="galaxy_main" title="Run this job again" class="icon-button arrow-circle tooltip"></a> %if app.config.get_bool( 'enable_tracks', False ) and data.ext in app.datatypes_registry.get_available_tracks(): <a class="icon-button vis-chart tooltip trackster" title="Visualize in Trackster" id="visualize_${hid}"></a> @@ -110,6 +122,10 @@ </div> %endif + %else: + ## When displaying datasets for viewing, this is often needed to prevent peek from overlapping + ## icons. + <div style="clear: both"></div> %endif %if data.peek != "no peek": <div><pre id="peek${data.id}" class="peek">${_(data.display_peek())}</pre></div> diff -r 7151ae06bf7a -r df8fc06fdac9 templates/workflow/display.mako --- a/templates/workflow/display.mako Sat Apr 24 15:03:22 2010 -0400 +++ b/templates/workflow/display.mako Sun Apr 25 16:18:15 2010 -0400 @@ -71,7 +71,12 @@ <%def name="render_item_links( workflow )"> - <a href="${h.url_for( controller='/workflow', action='imp', id=trans.security.encode_id(workflow.id) )}" class="icon-button import tooltip" title="Import workflow"></a> + <a + href="${h.url_for( controller='/workflow', action='imp', id=trans.security.encode_id(workflow.id) )}" + class="icon-button import" + ## Needed to overwide initial width so that link is floated left appropriately. + style="width: 100%" + title="Import workflow">Import workflow</a> </%def> <%def name="render_item( workflow, steps )">
participants (1)
-
Nate Coraor