diff --git a/lib/galaxy/web/controllers/library_common.py b/lib/galaxy/web/controllers/library_common.py index 1a5d3d9f8af..a442bdf75fa 100644 --- a/lib/galaxy/web/controllers/library_common.py +++ b/lib/galaxy/web/controllers/library_common.py @@ -1287,8 +1287,7 @@ class LibraryCommon( BaseController ): filter=dict( deleted=False ), form_type=trans.app.model.FormDefinition.types.LIBRARY_INFO_TEMPLATE ) if not forms: - msg = "There are no forms on which to base the template, so create a form and " - msg += "try again to add the information template to the %s." % library_item_desc + msg = "There are no forms on which to base the template, so create a form and try to add the template again." trans.response.send_redirect( web.url_for( controller='forms', action='new', msg=msg, diff --git a/templates/library/common/browse_library.mako b/templates/library/common/browse_library.mako index cab9f80c052..5ddd4cb3631 100644 --- a/templates/library/common/browse_library.mako +++ b/templates/library/common/browse_library.mako @@ -196,7 +196,7 @@ View this dataset's information %endif %if not branch_deleted( folder ) and not ldda.library_dataset.deleted and ( ( cntrller in [ 'library_admin', 'requests_admin' ] or can_add ) and not info_association ): - Add template to this dataset + Add a template to this dataset %endif %if not branch_deleted( folder ) and not ldda.library_dataset.deleted and cntrller == 'library_admin' and info_association: Delete this dataset's template @@ -294,7 +294,7 @@ Edit this folder's information %endif %if not branch_deleted( folder ) and ( ( cntrller in [ 'library_admin', 'requests_admin' ] or can_add ) and not info_association ): - Add template to this folder + Add a template to this folder %endif %if not branch_deleted( folder ) and cntrller == 'library_admin' and info_association: Delete this folder's template diff --git a/templates/library/common/common.mako b/templates/library/common/common.mako index 120b5dfbeb5..4a357120936 100644 --- a/templates/library/common/common.mako +++ b/templates/library/common/common.mako @@ -265,7 +265,7 @@ ${field[ 'widget' ].get_html()}
- ${field[ 'helptext' ]} + ${field[ 'helptext' ]}, leave blank to add a different template to this dataset after upload.
diff --git a/templates/library/common/ldda_info.mako b/templates/library/common/ldda_info.mako index 762619531d8..0395e32ea29 100644 --- a/templates/library/common/ldda_info.mako +++ b/templates/library/common/ldda_info.mako @@ -1,13 +1,19 @@ <%inherit file="/base.mako"/> <%namespace file="/message.mako" import="render_msg" /> <%namespace file="/library/common/common.mako" import="render_template_info" /> -<% from galaxy import util %> - <% + from galaxy import util + from galaxy.web.controllers.library_common import branch_deleted + if ldda == ldda.library_dataset.library_dataset_dataset_association: current_version = True else: current_version = False + if ldda.user: + uploaded_by = ldda.user.email + else: + uploaded_by = 'anonymous' + info_association, inherited = ldda.get_info_association( restrict=True ) %> %if current_version: @@ -27,24 +33,22 @@ ${render_msg( msg, messagetype )} %endif -<% - if ldda.user: - uploaded_by = ldda.user.email - else: - uploaded_by = 'anonymous' -%> -
Information about ${ldda.name} - %if not library.deleted and not ldda.library_dataset.folder.deleted and not ldda.deleted: + %if not library.deleted and not branch_deleted( ldda.library_dataset.folder ) and not ldda.library_dataset.deleted:
%if cntrller=='library_admin' or trans.app.security_agent.can_modify_library_item( current_user_roles, ldda.library_dataset ): Edit this dataset's information + %if not info_association: + Add a template to this dataset + %else: + Delete this dataset's template + %endif %endif %if cntrller=='library_admin' or trans.app.security_agent.can_manage_dataset( current_user_roles, ldda.dataset ) and trans.app.security_agent.can_manage_library_item( current_user_roles, ldda.library_dataset ): - Edit this dataset's permissions + Edit this dataset's permissions %endif %if current_version and ( cntrller=='library_admin' or trans.app.security_agent.can_modify_library_item( current_user_roles, ldda.library_dataset ) ): Upload a new version of this dataset diff --git a/test/functional/test_security_and_libraries.py b/test/functional/test_security_and_libraries.py index 5a32c55472f..5074b09cf07 100644 --- a/test/functional/test_security_and_libraries.py +++ b/test/functional/test_security_and_libraries.py @@ -118,7 +118,10 @@ class TestSecurityAndLibraries( TwillTestCase ): dp = sa_session.query( galaxy.model.DatasetPermissions ) \ .filter( galaxy.model.DatasetPermissions.table.c.dataset_id==latest_dataset.id ) \ .first() - if not dp.action == galaxy.model.Dataset.permitted_actions.DATASET_MANAGE_PERMISSIONS.action: + if not dp.action: + raise AssertionError( 'The Dataset id %d has no associated DatasetPermissions when is should have "manage permissions".' \ + % latest_dataset.id ) + elif not dp.action == galaxy.model.Dataset.permitted_actions.DATASET_MANAGE_PERMISSIONS.action: raise AssertionError( 'The DatasetPermissions.action for dataset id %d is "%s", but it should be "manage permissions"' \ % ( latest_dataset.id, dp.action ) ) # Change DefaultHistoryPermissions for regular_user1