1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/4f562e319784/ changeset: 4f562e319784 user: greg date: 2013-02-11 20:43:31 summary: Enhance the new sharable link for repositories in the tool shed to include the changeset revision if it is not the repository tip. Standardize the citable string by changing it to sharable. Fix several methos name typos. affected #: 8 files diff -r 400659787f76f11ee54fb8e3d97a258ab35843cb -r 4f562e319784d0a316157f8e8f6eea1202c7023e lib/galaxy/util/shed_util_common.py --- a/lib/galaxy/util/shed_util_common.py +++ b/lib/galaxy/util/shed_util_common.py @@ -944,11 +944,6 @@ for repository_components_list in val: tool_shed, name, owner, changeset_revision = repository_components_list repository = get_or_create_tool_shed_repository( trans, tool_shed, name, owner, changeset_revision ) -def generate_citable_link_for_repository_in_tool_shed( trans, repository ): - """Generate the URL for citing a repository that is in the tool shed.""" - base_url = url_for( '/', qualified=True ).rstrip( '/' ) - protocol, base = base_url.split( '://' ) - return '%s://%s/view/%s/%s' % ( protocol, base, repository.user.username, repository.name ) def generate_clone_url_for_installed_repository( app, repository ): """Generate the URL for cloning a repository that has been installed into a Galaxy instance.""" tool_shed_url = get_url_from_repository_tool_shed( app, repository ) @@ -1310,6 +1305,14 @@ repository_dependencies=repository_dependencies_tups ) metadata_dict[ 'repository_dependencies' ] = repository_dependencies_dict return metadata_dict, error_message +def generate_sharable_link_for_repository_in_tool_shed( trans, repository, changeset_revision=None ): + """Generate the URL for sharing a repository that is in the tool shed.""" + base_url = url_for( '/', qualified=True ).rstrip( '/' ) + protocol, base = base_url.split( '://' ) + sharable_url = '%s://%s/view/%s/%s' % ( protocol, base, repository.user.username, repository.name ) + if changeset_revision: + sharable_url += '/%s' % changeset_revision + return sharable_url def generate_tool_dependency_metadata( app, repository, changeset_revision, repository_clone_url, tool_dependencies_config, metadata_dict, original_repository_metadata=None ): """ @@ -1803,7 +1806,7 @@ if parent_id is None: # The tool did not change through all of the changeset revisions. return old_id -def get_previous_downloadable_changset_revision( repository, repo, before_changeset_revision ): +def get_previous_downloadable_changeset_revision( repository, repo, before_changeset_revision ): """ Return the installable changeset_revision in the repository changelog prior to the changeset to which before_changeset_revision refers. If there isn't one, return the hash value of an empty repository changelog, INITIAL_CHANGELOG_HASH. @@ -2021,7 +2024,7 @@ def get_repository_metadata_by_id( trans, id ): """Get repository metadata from the database""" return trans.sa_session.query( trans.model.RepositoryMetadata ).get( trans.security.decode_id( id ) ) -def get_repository_metadata_by_repository_id_changset_revision( trans, id, changeset_revision ): +def get_repository_metadata_by_repository_id_changeset_revision( trans, id, changeset_revision ): """Get a specified metadata record for a specified repository.""" return trans.sa_session.query( trans.model.RepositoryMetadata ) \ .filter( and_( trans.model.RepositoryMetadata.table.c.repository_id == trans.security.decode_id( id ), @@ -2236,9 +2239,9 @@ if tool_shed_is_this_tool_shed( rd_toolshed ): repository = get_repository_by_name_and_owner( trans.app, rd_name, rd_owner ) if repository: - repository_metadata = get_repository_metadata_by_repository_id_changset_revision( trans, - trans.security.encode_id( repository.id ), - rd_changeset_revision ) + repository_metadata = get_repository_metadata_by_repository_id_changeset_revision( trans, + trans.security.encode_id( repository.id ), + rd_changeset_revision ) if repository_metadata: # The repository changeset_revision is installable, so no updates are available. new_key_rd_dict = {} @@ -2249,9 +2252,9 @@ repo_dir = repository.repo_path( trans.app ) repo = hg.repository( get_configured_ui(), repo_dir ) changeset_revision = get_next_downloadable_changeset_revision( repository, repo, rd_changeset_revision ) - repository_metadata = get_repository_metadata_by_repository_id_changset_revision( trans, - trans.security.encode_id( repository.id ), - changeset_revision ) + repository_metadata = get_repository_metadata_by_repository_id_changeset_revision( trans, + trans.security.encode_id( repository.id ), + changeset_revision ) if repository_metadata: new_key_rd_dict = {} new_key_rd_dict[ key ] = [ rd_toolshed, rd_name, rd_owner, repository_metadata.changeset_revision ] @@ -2450,9 +2453,9 @@ toolshed, name, owner, changeset_revision = repository_dependency if tool_shed_is_this_tool_shed( toolshed ): required_repository = get_repository_by_name_and_owner( trans.app, name, owner ) - required_repository_metadata = get_repository_metadata_by_repository_id_changset_revision( trans, - trans.security.encode_id( required_repository.id ), - changeset_revision ) + required_repository_metadata = get_repository_metadata_by_repository_id_changeset_revision( trans, + trans.security.encode_id( required_repository.id ), + changeset_revision ) if required_repository_metadata: # The required_repository_metadata changeset_revision is installable. required_metadata = required_repository_metadata.metadata @@ -3075,9 +3078,9 @@ if rd_tup not in rd_tups_processed: toolshed, name, owner, changeset_revision = rd_tup repository = get_repository_by_name_and_owner( trans.app, name, owner ) - repository_metadata = get_repository_metadata_by_repository_id_changset_revision( trans, - trans.security.encode_id( repository.id ), - changeset_revision ) + repository_metadata = get_repository_metadata_by_repository_id_changeset_revision( trans, + trans.security.encode_id( repository.id ), + changeset_revision ) if repository_metadata: metadata = repository_metadata.metadata if metadata: @@ -3088,9 +3091,9 @@ if rd_tup not in rd_tups_processed: toolshed, name, owner, changeset_revision = rd_tup repository = get_repository_by_name_and_owner( trans.app, name, owner ) - repository_metadata = get_repository_metadata_by_repository_id_changset_revision( trans, - trans.security.encode_id( repository.id ), - changeset_revision ) + repository_metadata = get_repository_metadata_by_repository_id_changeset_revision( trans, + trans.security.encode_id( repository.id ), + changeset_revision ) if repository_metadata: metadata = repository_metadata.metadata if metadata: @@ -3147,7 +3150,7 @@ metadata = repository_metadata.metadata tool_dicts = metadata[ 'tools' ] if index == 0: - # The first changset_revision is a special case because it will have no ancestor changeset_revisions in which to match tools. + # The first changeset_revision is a special case because it will have no ancestor changeset_revisions in which to match tools. # The parent tool id for tools in the first changeset_revision will be the "old_id" in the tool config. for tool_dict in tool_dicts: tool_versions_dict[ tool_dict[ 'guid' ] ] = tool_dict[ 'id' ] @@ -3298,7 +3301,7 @@ """ # To set excluded_lower_bounds_changeset_revision, calling methods should do the following, where the value of changeset_revision # is a downloadable changeset_revision. - # excluded_lower_bounds_changeset_revision = get_previous_downloadable_changset_revision( repository, repo, changeset_revision ) + # excluded_lower_bounds_changeset_revision = get_previous_downloadable_changeset_revision( repository, repo, changeset_revision ) if excluded_lower_bounds_changeset_revision == INITIAL_CHANGELOG_HASH: appending_started = True else: diff -r 400659787f76f11ee54fb8e3d97a258ab35843cb -r 4f562e319784d0a316157f8e8f6eea1202c7023e lib/galaxy/webapps/community/buildapp.py --- a/lib/galaxy/webapps/community/buildapp.py +++ b/lib/galaxy/webapps/community/buildapp.py @@ -63,9 +63,9 @@ # Create the universe WSGI application webapp = CommunityWebApplication( app, session_cookie='galaxycommunitysession', name="community" ) add_ui_controllers( webapp, app ) - webapp.add_route( '/view/{owner}', controller='repository', action='citable_owner' ) - webapp.add_route( '/view/{owner}/{name}', controller='repository', action='citable_repository' ) - webapp.add_route( '/view/{owner}/{name}/{changeset_revision}', controller='repository', action='citable_repository_revision' ) + webapp.add_route( '/view/{owner}', controller='repository', action='sharable_owner' ) + webapp.add_route( '/view/{owner}/{name}', controller='repository', action='sharable_repository' ) + webapp.add_route( '/view/{owner}/{name}/{changeset_revision}', controller='repository', action='sharable_repository_revision' ) webapp.add_route( '/:controller/:action', action='index' ) webapp.add_route( '/:action', controller='repository', action='index' ) webapp.add_route( '/repos/*path_info', controller='hg', action='handle_request', path_info='/' ) diff -r 400659787f76f11ee54fb8e3d97a258ab35843cb -r 4f562e319784d0a316157f8e8f6eea1202c7023e lib/galaxy/webapps/community/controllers/admin.py --- a/lib/galaxy/webapps/community/controllers/admin.py +++ b/lib/galaxy/webapps/community/controllers/admin.py @@ -509,9 +509,9 @@ # know the refresh_on_change occurred, and we have the necessary repository id and change set # revision to pass on. for k, v in kwd.items(): - changset_revision_str = 'changeset_revision_' - if k.startswith( changset_revision_str ): - repository_id = trans.security.encode_id( int( k.lstrip( changset_revision_str ) ) ) + changeset_revision_str = 'changeset_revision_' + if k.startswith( changeset_revision_str ): + repository_id = trans.security.encode_id( int( k.lstrip( changeset_revision_str ) ) ) repository = suc.get_repository_in_tool_shed( trans, repository_id ) if repository.tip( trans.app ) != v: return trans.response.send_redirect( web.url_for( controller='repository', diff -r 400659787f76f11ee54fb8e3d97a258ab35843cb -r 4f562e319784d0a316157f8e8f6eea1202c7023e lib/galaxy/webapps/community/controllers/repository.py --- a/lib/galaxy/webapps/community/controllers/repository.py +++ b/lib/galaxy/webapps/community/controllers/repository.py @@ -697,7 +697,7 @@ kwd[ 'message' ] = 'You must be logged in to set email alerts.' kwd[ 'status' ] = 'error' del kwd[ 'operation' ] - selected_changeset_revision, repository = self.get_repository_from_refresh_on_change( trans, **kwd ) + selected_changeset_revision, repository = self.__get_repository_from_refresh_on_change( trans, **kwd ) if repository: return trans.response.send_redirect( web.url_for( controller='repository', action='browse_repositories', @@ -726,7 +726,7 @@ kwd[ 'user_id' ] = trans.security.encode_id( repository.user.id ) else: # The user selected a repository revision which results in a refresh_on_change. - selected_changeset_revision, repository = self.get_repository_from_refresh_on_change( trans, **kwd ) + selected_changeset_revision, repository = self.__get_repository_from_refresh_on_change( trans, **kwd ) if repository: return trans.response.send_redirect( web.url_for( controller='repository', action='view_or_manage_repository', @@ -818,7 +818,7 @@ category_id = kwd.get( 'id', None ) category = suc.get_category( trans, category_id ) kwd[ 'f-Category.name' ] = category.name - selected_changeset_revision, repository = self.get_repository_from_refresh_on_change( trans, **kwd ) + selected_changeset_revision, repository = self.__get_repository_from_refresh_on_change( trans, **kwd ) if repository: return trans.response.send_redirect( web.url_for( controller='repository', action='preview_tools_in_changeset', @@ -930,86 +930,6 @@ url += '&latest_ctx_rev=%s' % str( update_to_ctx.rev() ) return trans.response.send_redirect( url ) @web.expose - def citable_owner( self, trans, owner ): - """Support for citable URL for each repository owner's tools, e.g. http://example.org/view/owner.""" - try: - user = suc.get_user_by_username( trans, owner ) - except: - user = None - if user: - user_id = trans.security.encode_id( user.id ) - return trans.response.send_redirect( web.url_for( controller='repository', - action='index', - user_id=user_id ) ) - else: - return trans.show_error_message( "The tool shed <b>%s</b> contains no repositories owned by <b>%s</b>." % \ - ( web.url_for( '/', qualified=True ).rstrip( '/' ), str( owner ) ) ) - @web.expose - def citable_repository( self, trans, owner, name ): - """Support for citable URL for a specified repository, e.g. http://example.org/view/owner/name.""" - try: - repository = suc.get_repository_by_name_and_owner( trans.app, name, owner ) - except: - repository = None - if repository: - repository_id = trans.security.encode_id( repository.id ) - return trans.response.send_redirect( web.url_for( controller='repository', - action='index', - repository_id=repository_id ) ) - else: - # If the owner is valid, then show all of their repositories. - try: - user = suc.get_user_by_username( trans, owner ) - except: - user = None - if user: - user_id = trans.security.encode_id( user.id ) - message = "This list of repositories owned by <b>%s</b>, does not include one named <b>%s</b>." % ( str( owner ), str( name ) ) - return trans.response.send_redirect( web.url_for( controller='repository', - action='index', - user_id=user_id, - message=message, - status='error' ) ) - else: - return trans.show_error_message( "The tool shed <b>%s</b> contains no repositories named <b>%s</b> with owner <b>%s</b>." % \ - ( web.url_for( '/', qualified=True ).rstrip( '/' ), str( name ), str( owner ) ) ) - @web.expose - def citable_repository_revision( self, trans, owner, name, changeset_revision ): - """Support for citable URL for a specified repository revision, e.g. http://example.org/view/owner/name/changeset_revision.""" - try: - repository = suc.get_repository_by_name_and_owner( trans.app, name, owner ) - except: - repository = None - if repository: - repository_id = trans.security.encode_id( repository.id ) - repository_metadata = suc.get_repository_metadata_by_repository_id_changset_revision( trans, repository_id, changeset_revision ) - if not repository_metadata: - # Get updates to the received changeset_revision if any exist. - repo_dir = repository.repo_path( trans.app ) - repo = hg.repository( suc.get_configured_ui(), repo_dir ) - upper_bound_changeset_revision = suc.get_next_downloadable_changeset_revision( repository, repo, changeset_revision ) - if upper_bound_changeset_revision: - changeset_revision = upper_bound_changeset_revision - repository_metadata = suc.get_repository_metadata_by_repository_id_changset_revision( trans, repository_id, changeset_revision ) - if repository_metadata: - return trans.response.send_redirect( web.url_for( controller='repository', - action='index', - repository_id=repository_id, - changeset_revision=changeset_revision ) ) - else: - message = "The change log for the repository named <b>%s</b> owned by <b>%s</b> does not include revision <b>%s</b>." % \ - ( str( name ), str( owner ), str( changeset_revision ) ) - return trans.response.send_redirect( web.url_for( controller='repository', - action='index', - repository_id=repository_id, - message=message, - status='error' ) ) - else: - # See if the owner is valid. - return trans.response.send_redirect( web.url_for( controller='repository', - action='citable_owner', - owner=owner ) ) - @web.expose def contact_owner( self, trans, id, **kwd ): params = util.Params( kwd ) message = util.restore_text( params.get( 'message', '' ) ) @@ -1521,16 +1441,16 @@ if repository_dependencies: return encoding_util.tool_shed_encode( repository_dependencies ) return '' - def get_repository_from_refresh_on_change( self, trans, **kwd ): + def __get_repository_from_refresh_on_change( self, trans, **kwd ): # The changeset_revision_select_field in several grids performs a refresh_on_change which sends in request parameters like # changeset_revison_1, changeset_revision_2, etc. One of the many select fields on the grid performed the refresh_on_change, # so we loop through all of the received values to see which value is not the repository tip. If we find it, we know the # refresh_on_change occurred and we have the necessary repository id and change set revision to pass on. repository_id = None for k, v in kwd.items(): - changset_revision_str = 'changeset_revision_' - if k.startswith( changset_revision_str ): - repository_id = trans.security.encode_id( int( k.lstrip( changset_revision_str ) ) ) + changeset_revision_str = 'changeset_revision_' + if k.startswith( changeset_revision_str ): + repository_id = trans.security.encode_id( int( k.lstrip( changeset_revision_str ) ) ) repository = suc.get_repository_in_tool_shed( trans, repository_id ) if repository.tip( trans.app ) != v: return v, repository @@ -1807,7 +1727,7 @@ if repository.deprecated: has_deprecated_repositories = True break - # Route in may have been from a citable URL, in whcih case we'll have a user_id and possibly a name + # Route in may have been from a sharable URL, in whcih case we'll have a user_id and possibly a name # The received user_id will be the id of the repository owner. user_id = params.get( 'user_id', None ) repository_id = params.get( 'repository_id', None ) @@ -2062,7 +1982,7 @@ is_malicious = repository_metadata.malicious else: # There is no repository_metadata defined for the changeset_revision, so see if it was defined in a previous changeset in the changelog. - previous_changeset_revision = suc.get_previous_downloadable_changset_revision( repository, repo, changeset_revision ) + previous_changeset_revision = suc.get_previous_downloadable_changeset_revision( repository, repo, changeset_revision ) if previous_changeset_revision != suc.INITIAL_CHANGELOG_HASH: repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans, id, previous_changeset_revision ) if repository_metadata: @@ -2243,7 +2163,7 @@ repo_dir = repository.repo_path( trans.app ) repo = hg.repository( suc.get_configured_ui(), repo_dir ) # Get the lower bound changeset revision. - lower_bound_changeset_revision = suc.get_previous_downloadable_changset_revision( repository, repo, changeset_revision ) + lower_bound_changeset_revision = suc.get_previous_downloadable_changeset_revision( repository, repo, changeset_revision ) # Build the list of changeset revision hashes. changeset_hashes = [] for changeset in suc.reversed_lower_upper_bounded_changelog( repo, lower_bound_changeset_revision, changeset_revision ): @@ -2563,6 +2483,86 @@ malicious=malicious, message=message, status=status ) ) + @web.expose + def sharable_owner( self, trans, owner ): + """Support for sharable URL for each repository owner's tools, e.g. http://example.org/view/owner.""" + try: + user = suc.get_user_by_username( trans, owner ) + except: + user = None + if user: + user_id = trans.security.encode_id( user.id ) + return trans.response.send_redirect( web.url_for( controller='repository', + action='index', + user_id=user_id ) ) + else: + return trans.show_error_message( "The tool shed <b>%s</b> contains no repositories owned by <b>%s</b>." % \ + ( web.url_for( '/', qualified=True ).rstrip( '/' ), str( owner ) ) ) + @web.expose + def sharable_repository( self, trans, owner, name ): + """Support for sharable URL for a specified repository, e.g. http://example.org/view/owner/name.""" + try: + repository = suc.get_repository_by_name_and_owner( trans.app, name, owner ) + except: + repository = None + if repository: + repository_id = trans.security.encode_id( repository.id ) + return trans.response.send_redirect( web.url_for( controller='repository', + action='index', + repository_id=repository_id ) ) + else: + # If the owner is valid, then show all of their repositories. + try: + user = suc.get_user_by_username( trans, owner ) + except: + user = None + if user: + user_id = trans.security.encode_id( user.id ) + message = "This list of repositories owned by <b>%s</b>, does not include one named <b>%s</b>." % ( str( owner ), str( name ) ) + return trans.response.send_redirect( web.url_for( controller='repository', + action='index', + user_id=user_id, + message=message, + status='error' ) ) + else: + return trans.show_error_message( "The tool shed <b>%s</b> contains no repositories named <b>%s</b> with owner <b>%s</b>." % \ + ( web.url_for( '/', qualified=True ).rstrip( '/' ), str( name ), str( owner ) ) ) + @web.expose + def sharable_repository_revision( self, trans, owner, name, changeset_revision ): + """Support for sharable URL for a specified repository revision, e.g. http://example.org/view/owner/name/changeset_revision.""" + try: + repository = suc.get_repository_by_name_and_owner( trans.app, name, owner ) + except: + repository = None + if repository: + repository_id = trans.security.encode_id( repository.id ) + repository_metadata = suc.get_repository_metadata_by_repository_id_changeset_revision( trans, repository_id, changeset_revision ) + if not repository_metadata: + # Get updates to the received changeset_revision if any exist. + repo_dir = repository.repo_path( trans.app ) + repo = hg.repository( suc.get_configured_ui(), repo_dir ) + upper_bound_changeset_revision = suc.get_next_downloadable_changeset_revision( repository, repo, changeset_revision ) + if upper_bound_changeset_revision: + changeset_revision = upper_bound_changeset_revision + repository_metadata = suc.get_repository_metadata_by_repository_id_changeset_revision( trans, repository_id, changeset_revision ) + if repository_metadata: + return trans.response.send_redirect( web.url_for( controller='repository', + action='index', + repository_id=repository_id, + changeset_revision=changeset_revision ) ) + else: + message = "The change log for the repository named <b>%s</b> owned by <b>%s</b> does not include revision <b>%s</b>." % \ + ( str( name ), str( owner ), str( changeset_revision ) ) + return trans.response.send_redirect( web.url_for( controller='repository', + action='index', + repository_id=repository_id, + message=message, + status='error' ) ) + else: + # See if the owner is valid. + return trans.response.send_redirect( web.url_for( controller='repository', + action='sharable_owner', + owner=owner ) ) def __stringify( self, list ): if list: return ','.join( list ) diff -r 400659787f76f11ee54fb8e3d97a258ab35843cb -r 4f562e319784d0a316157f8e8f6eea1202c7023e templates/webapps/community/index.mako --- a/templates/webapps/community/index.mako +++ b/templates/webapps/community/index.mako @@ -45,7 +45,7 @@ <div class="toolMenu"><div class="toolSectionList"> %if user_id or repository_id: - ## The route in was a citable url. + ## The route in was a sharable url, and may have included a changeset_revision, although we don't check for it. <div class="toolSectionPad"></div><div class="toolSectionTitle"> All Repositories @@ -150,13 +150,13 @@ if trans.app.config.require_login and not trans.user: center_url = h.url_for( controller='user', action='login', message=message, status=status ) elif repository_id and changeset_revision: - # Route in was a citable url: /view/{owner}/{name}/{changeset_revision}. + # Route in was a sharable url: /view/{owner}/{name}/{changeset_revision}. center_url = h.url_for( controller='repository', action='view_repository', id=repository_id, changeset_revision=changeset_revision, message=message, status=status ) elif repository_id: - # Route in was a citable url: /view/{owner}/{name}. + # Route in was a sharable url: /view/{owner}/{name}. center_url = h.url_for( controller='repository', action='view_repository', id=repository_id, message=message, status=status ) elif user_id: - # Route in was a citable url: /view/{owner}. + # Route in was a sharable url: /view/{owner}. center_url = h.url_for( controller='repository', action='browse_repositories', operation="repositories_by_user", user_id=user_id, message=message, status=status ) else: center_url = h.url_for( controller='repository', action='browse_categories', message=message, status=status ) diff -r 400659787f76f11ee54fb8e3d97a258ab35843cb -r 4f562e319784d0a316157f8e8f6eea1202c7023e templates/webapps/community/repository/common.mako --- a/templates/webapps/community/repository/common.mako +++ b/templates/webapps/community/repository/common.mako @@ -163,12 +163,12 @@ </script></%def> -<%def name="render_sharable_str( repository )"> +<%def name="render_sharable_str( repository, changeset_revision=None )"><% - from galaxy.util.shed_util_common import generate_citable_link_for_repository_in_tool_shed - citable_str = generate_citable_link_for_repository_in_tool_shed( trans, repository ) + from galaxy.util.shed_util_common import generate_sharable_link_for_repository_in_tool_shed + sharable_link = generate_sharable_link_for_repository_in_tool_shed( trans, repository, changeset_revision=changeset_revision ) %> - ${citable_str} + ${sharable_link} </%def><%def name="render_clone_str( repository )"> diff -r 400659787f76f11ee54fb8e3d97a258ab35843cb -r 4f562e319784d0a316157f8e8f6eea1202c7023e templates/webapps/community/repository/manage_repository.mako --- a/templates/webapps/community/repository/manage_repository.mako +++ b/templates/webapps/community/repository/manage_repository.mako @@ -21,7 +21,8 @@ can_reset_all_metadata = not is_deprecated and len( repo ) > 0 can_review_repository = has_metadata and not is_deprecated and trans.app.security_agent.user_can_review_repositories( trans.user ) can_set_metadata = not is_new and not is_deprecated - can_set_malicious = metadata and can_set_metadata and is_admin and changeset_revision == repository.tip( trans.app ) + changeset_revision_is_repository_tip = changeset_revision == repository.tip( trans.app ) + can_set_malicious = metadata and can_set_metadata and is_admin and changeset_revision_is_repository_tip can_undeprecate = trans.user and ( is_admin or repository.user == trans.user ) and is_deprecated can_upload = can_push can_view_change_log = not is_new @@ -30,10 +31,15 @@ browse_label = 'Browse or delete repository tip files' else: browse_label = 'Browse repository tip files' - if changeset_revision == repository.tip( trans.app ): + + if changeset_revision_is_repository_tip: tip_str = 'repository tip' + sharable_link_label = 'Sharable link to this repository:' + sharable_link_changeset_revision = None else: tip_str = '' + sharable_link_label = 'Sharable link to this repository revision:' + sharable_link_changeset_revision = changeset_revision %><%! @@ -143,8 +149,8 @@ <div class="toolFormBody"><form name="edit_repository" id="edit_repository" action="${h.url_for( controller='repository', action='manage_repository', id=trans.security.encode_id( repository.id ) )}" method="post" ><div class="form-row"> - <label>Sharable link to this repository:</label> - ${render_sharable_str( repository )} + <label>${sharable_link_label}</label> + ${render_sharable_str( repository, changeset_revision=sharable_link_changeset_revision )} </div> %if can_download: <div class="form-row"> diff -r 400659787f76f11ee54fb8e3d97a258ab35843cb -r 4f562e319784d0a316157f8e8f6eea1202c7023e templates/webapps/community/repository/view_repository.mako --- a/templates/webapps/community/repository/view_repository.mako +++ b/templates/webapps/community/repository/view_repository.mako @@ -23,11 +23,21 @@ can_review_repository = has_metadata and not is_deprecated and trans.app.security_agent.user_can_review_repositories( trans.user ) can_upload = can_push can_view_change_log = trans.webapp.name == 'community' and not is_new + changeset_revision_is_repository_tip = changeset_revision == repository.tip( trans.app ) if can_push: browse_label = 'Browse or delete repository tip files' else: browse_label = 'Browse repository tip files' + + if changeset_revision_is_repository_tip: + tip_str = 'repository tip' + sharable_link_label = 'Sharable link to this repository:' + sharable_link_changeset_revision = None + else: + tip_str = '' + sharable_link_label = 'Sharable link to this repository revision:' + sharable_link_changeset_revision = changeset_revision %><%! @@ -119,12 +129,6 @@ <div class="toolFormBody"><form name="change_revision" id="change_revision" action="${h.url_for( controller='repository', action='view_repository', id=trans.security.encode_id( repository.id ) )}" method="post" ><div class="form-row"> - <% - if changeset_revision == repository.tip( trans.app ): - tip_str = 'repository tip' - else: - tip_str = '' - %> ${changeset_revision_select_field.get_html()} <i>${tip_str}</i><div class="toolParamHelp" style="clear: both;"> Select a revision to inspect and download versions of tools from this repository. @@ -139,8 +143,8 @@ <div class="toolFormTitle">Repository '${repository.name}'</div><div class="toolFormBody"><div class="form-row"> - <label>Sharable link to this repository:</label> - ${render_sharable_str( repository )} + <label>${sharable_link_label}</label> + ${render_sharable_str( repository, changeset_revision=sharable_link_changeset_revision )} </div> %if can_download: <div class="form-row"> Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.