commit/galaxy-central: greg: First pass at standardizing the Repository Actions menu in the tool shed.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/fadc4b334f3e/ Changeset: fadc4b334f3e User: greg Date: 2013-05-01 23:02:32 Summary: First pass at standardizing the Repository Actions menu in the tool shed. Affected #: 21 files diff -r 3294bcdca48fad92dbc9349da0dcd5ee6721b3bc -r fadc4b334f3e3cca07238f86d30053318215486e lib/galaxy/webapps/tool_shed/controllers/repository.py --- a/lib/galaxy/webapps/tool_shed/controllers/repository.py +++ b/lib/galaxy/webapps/tool_shed/controllers/repository.py @@ -545,13 +545,11 @@ repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) ) # Update repository files for browsing. suc.update_repository( repo ) - is_malicious = suc.changeset_is_malicious( trans, id, repository.tip( trans.app ) ) metadata = self.get_metadata( trans, id, repository.tip( trans.app ) ) return trans.fill_template( '/webapps/tool_shed/repository/browse_repository.mako', repository=repository, metadata=metadata, commit_message=commit_message, - is_malicious=is_malicious, message=message, status=status ) @@ -941,7 +939,6 @@ if message: status = 'error' tool_state = self.__new_state( trans ) - is_malicious = suc.changeset_is_malicious( trans, repository_id, repository.tip( trans.app ) ) metadata = self.get_metadata( trans, repository_id, changeset_revision ) try: return trans.fill_template( "/webapps/tool_shed/repository/tool_form.mako", @@ -950,7 +947,6 @@ changeset_revision=changeset_revision, tool=tool, tool_state=tool_state, - is_malicious=is_malicious, message=message, status=status ) except Exception, e: @@ -1779,7 +1775,6 @@ status = params.get( 'status', 'error' ) repository, tool, error_message = tool_util.load_tool_from_changeset_revision( trans, repository_id, changeset_revision, tool_config ) tool_state = self.__new_state( trans ) - is_malicious = suc.changeset_is_malicious( trans, repository_id, repository.tip( trans.app ) ) invalid_file_tups = [] if tool: invalid_file_tups = tool_util.check_tool_input_params( trans.app, @@ -1797,7 +1792,6 @@ changeset_revision=changeset_revision, tool=tool, tool_state=tool_state, - is_malicious=is_malicious, message=message, status='error' ) except Exception, e: @@ -2024,17 +2018,6 @@ malicious_check_box = CheckboxField( 'malicious', checked=is_malicious ) categories = suc.get_categories( trans ) selected_categories = [ rca.category_id for rca in repository.categories ] - # Determine if the current changeset revision has been reviewed by the current user. - reviewed_by_user = review_util.changeset_revision_reviewed_by_user( trans, trans.user, repository, changeset_revision ) - if reviewed_by_user: - review = review_util.get_review_by_repository_id_changeset_revision_user_id( trans=trans, - repository_id=id, - changeset_revision=changeset_revision, - user_id=trans.security.encode_id( trans.user.id ) ) - review_id = trans.security.encode_id( review.id ) - else: - review_id = None - can_browse_repository_reviews = review_util.can_browse_repository_reviews( trans, repository ) containers_dict = container_util.build_repository_containers_for_tool_shed( trans, repository, changeset_revision, repository_dependencies, repository_metadata ) return trans.fill_template( '/webapps/tool_shed/repository/manage_repository.mako', repo_name=repo_name, @@ -2047,8 +2030,6 @@ containers_dict=containers_dict, repository_metadata=repository_metadata, changeset_revision=changeset_revision, - reviewed_by_user=reviewed_by_user, - review_id=review_id, changeset_revision_select_field=changeset_revision_select_field, revision_label=revision_label, selected_categories=selected_categories, @@ -2059,8 +2040,6 @@ num_ratings=num_ratings, alerts_check_box=alerts_check_box, malicious_check_box=malicious_check_box, - is_malicious=is_malicious, - can_browse_repository_reviews=can_browse_repository_reviews, message=message, status=status ) @@ -2214,7 +2193,6 @@ avg_rating, num_ratings = self.get_ave_item_rating_data( trans.sa_session, repository, webapp_model=trans.model ) display_reviews = util.string_as_bool( params.get( 'display_reviews', False ) ) rra = self.get_user_item_rating( trans.sa_session, trans.user, repository, webapp_model=trans.model ) - is_malicious = suc.changeset_is_malicious( trans, id, repository.tip( trans.app ) ) metadata = self.get_metadata( trans, id, repository.tip( trans.app ) ) return trans.fill_template( '/webapps/tool_shed/repository/rate_repository.mako', repository=repository, @@ -2223,7 +2201,6 @@ display_reviews=display_reviews, num_ratings=num_ratings, rra=rra, - is_malicious=is_malicious, message=message, status=status ) @@ -2403,12 +2380,10 @@ else: message = "Select at least 1 file to delete from the repository before clicking <b>Delete selected files</b>." status = "error" - is_malicious = suc.changeset_is_malicious( trans, id, repository.tip( trans.app ) ) return trans.fill_template( '/webapps/tool_shed/repository/browse_repository.mako', repo=repo, repository=repository, commit_message=commit_message, - is_malicious=is_malicious, message=message, status=status ) @@ -2679,13 +2654,11 @@ 'has_metadata' : has_metadata } # Make sure we'll view latest changeset first. changesets.insert( 0, change_dict ) - is_malicious = suc.changeset_is_malicious( trans, id, repository.tip( trans.app ) ) metadata = self.get_metadata( trans, id, repository.tip( trans.app ) ) return trans.fill_template( '/webapps/tool_shed/repository/view_changelog.mako', repository=repository, metadata=metadata, changesets=changesets, - is_malicious=is_malicious, message=message, status=status ) @@ -2711,7 +2684,6 @@ diffs = [] for diff in patch.diff( repo, node1=ctx_parent.node(), node2=ctx.node() ): diffs.append( suc.to_safe_string( diff, to_html=True ) ) - is_malicious = suc.changeset_is_malicious( trans, id, repository.tip( trans.app ) ) metadata = self.get_metadata( trans, id, ctx_str ) return trans.fill_template( '/webapps/tool_shed/repository/view_changeset.mako', repository=repository, @@ -2726,7 +2698,6 @@ ignored=ignored, clean=clean, diffs=diffs, - is_malicious=is_malicious, message=message, status=status ) @@ -2814,18 +2785,7 @@ else: message += malicious_error status = 'error' - # Determine if the current changeset revision has been reviewed by the current user. - reviewed_by_user = review_util.changeset_revision_reviewed_by_user( trans, trans.user, repository, changeset_revision ) - if reviewed_by_user: - review = review_util.get_review_by_repository_id_changeset_revision_user_id( trans=trans, - repository_id=id, - changeset_revision=changeset_revision, - user_id=trans.security.encode_id( trans.user.id ) ) - review_id = trans.security.encode_id( review.id ) - else: - review_id = None containers_dict = container_util.build_repository_containers_for_tool_shed( trans, repository, changeset_revision, repository_dependencies, repository_metadata ) - can_browse_repository_reviews = review_util.can_browse_repository_reviews( trans, repository ) return trans.fill_template( '/webapps/tool_shed/repository/view_repository.mako', repo=repo, repository=repository, @@ -2837,12 +2797,8 @@ num_ratings=num_ratings, alerts_check_box=alerts_check_box, changeset_revision=changeset_revision, - reviewed_by_user=reviewed_by_user, - review_id=review_id, changeset_revision_select_field=changeset_revision_select_field, revision_label=revision_label, - is_malicious=is_malicious, - can_browse_repository_reviews=can_browse_repository_reviews, message=message, status=status ) @@ -2898,22 +2854,12 @@ else: repository_metadata_id = None metadata = None - is_malicious = suc.changeset_is_malicious( trans, repository_id, repository.tip( trans.app ) ) changeset_revision_select_field = grids_util.build_changeset_revision_select_field( trans, repository, selected_value=changeset_revision, add_id_to_name=False, downloadable=False ) trans.app.config.tool_data_path = original_tool_data_path - reviewed_by_user = review_util.changeset_revision_reviewed_by_user( trans, trans.user, repository, changeset_revision ) - if reviewed_by_user: - review = review_util.get_review_by_repository_id_changeset_revision_user_id( trans=trans, - repository_id=repository_id, - changeset_revision=changeset_revision, - user_id=trans.security.encode_id( trans.user.id ) ) - review_id = trans.security.encode_id( review.id ) - else: - review_id = None return trans.fill_template( "/webapps/tool_shed/repository/view_tool_metadata.mako", repository=repository, repository_metadata_id=repository_metadata_id, @@ -2924,9 +2870,6 @@ changeset_revision=changeset_revision, revision_label=revision_label, changeset_revision_select_field=changeset_revision_select_field, - is_malicious=is_malicious, - reviewed_by_user=reviewed_by_user, - review_id=review_id, message=message, status=status ) diff -r 3294bcdca48fad92dbc9349da0dcd5ee6721b3bc -r fadc4b334f3e3cca07238f86d30053318215486e templates/webapps/tool_shed/common/repository_actions_menu.mako --- /dev/null +++ b/templates/webapps/tool_shed/common/repository_actions_menu.mako @@ -0,0 +1,142 @@ +<%inherit file="/base.mako"/> + +<%def name="render_tool_shed_repository_actions( repository, repo=None, metadata=None, changeset_revision=None )"> + <% + from tool_shed.util.review_util import can_browse_repository_reviews, changeset_revision_reviewed_by_user, get_review_by_repository_id_changeset_revision_user_id + from tool_shed.util.shed_util_common import changeset_is_malicious + + has_metadata = repository.metadata_revisions + has_readme = metadata and 'readme' in metadata + is_admin = trans.user_is_admin() + is_deprecated = repository.deprecated + is_new = repository.is_new( trans.app ) + is_malicious = changeset_is_malicious( trans, trans.security.encode_id( repository.id ), repository.tip( trans.app ) ) + + can_browse_contents = not is_new + can_browse_reviews = can_browse_repository_reviews( trans, repository ) + can_contact_owner = trans.user and trans.user != repository.user + can_deprecate = not is_new and trans.user and ( is_admin or repository.user == trans.user ) and not is_deprecated + can_push = not is_deprecated and trans.app.security_agent.can_push( trans.app, trans.user, repository ) + can_download = not is_deprecated and not is_new and ( not is_malicious or can_push ) + if not is_deprecated: + if repo and len( repo ) > 0: + can_reset_all_metadata = True + else: + can_reset_all_metadata = False + else: + can_reset_all_metadata = False + can_upload = can_push and not is_deprecated + can_rate = not is_new and not is_deprecated and trans.user and repository.user != trans.user + if changeset_revision: + can_review_repository = has_metadata and not is_deprecated and trans.app.security_agent.user_can_review_repositories( trans.user ) + reviewed_by_user = changeset_revision_reviewed_by_user( trans, trans.user, repository, changeset_revision ) + else: + can_review_repository = False + reviewed_by_user = False + + # Determine if the current changeset revision has been reviewed by the current user. + if reviewed_by_user: + review = get_review_by_repository_id_changeset_revision_user_id( trans=trans, + repository_id=trans.security.encode_id( repository.id ), + changeset_revision=changeset_revision, + user_id=trans.security.encode_id( trans.user.id ) ) + review_id = trans.security.encode_id( review.id ) + else: + review_id = None + + can_set_metadata = not is_new and not is_deprecated + if changeset_revision: + if changeset_revision == repository.tip( trans.app ): + changeset_revision_is_repository_tip = True + else: + changeset_revision_is_repository_tip = False + else: + changeset_revision_is_repository_tip = False + 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_manage = is_admin or repository.user == trans.user + can_view_change_log = not is_new + + if can_push: + browse_label = 'Browse or delete repository tip files' + else: + browse_label = 'Browse repository tip files' + %> + + <br/><br/> + <ul class="manage-table-actions"> + %if is_new: + %if can_upload: + <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a> + %endif + %else: + <li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li> + <div popupmenu="repository-${repository.id}-popup"> + %if can_review_repository: + %if reviewed_by_user: + <a class="action-button" href="${h.url_for( controller='repository_review', action='edit_review', id=review_id )}">Manage my review of this revision</a> + %else: + <a class="action-button" href="${h.url_for( controller='repository_review', action='create_review', id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision )}">Add a review to this revision</a> + %endif + %endif + %if can_browse_reviews: + <a class="action-button" href="${h.url_for( controller='repository_review', action='manage_repository_reviews', id=trans.app.security.encode_id( repository.id ) )}">Browse reviews of this repository</a> + %endif + %if can_upload: + <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a> + %endif + %if can_manage: + <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">Manage repository</a> + %else: + <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">View repository</a> + %endif + %if can_view_change_log: + <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">View change log</a> + %endif + %if can_browse_contents: + <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label | h}</a> + %endif + %if can_rate: + <a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.app.security.encode_id( repository.id ) )}">Rate repository</a> + %endif + %if can_contact_owner: + <a class="action-button" href="${h.url_for( controller='repository', action='contact_owner', id=trans.security.encode_id( repository.id ) )}">Contact repository owner</a> + %endif + %if can_reset_all_metadata: + <a class="action-button" href="${h.url_for( controller='repository', action='reset_all_metadata', id=trans.security.encode_id( repository.id ) )}">Reset all repository metadata</a> + %endif + %if can_deprecate: + <a class="action-button" href="${h.url_for( controller='repository', action='deprecate', id=trans.security.encode_id( repository.id ), mark_deprecated=True )}" confirm="Click Ok to deprecate this repository.">Mark repository as deprecated</a> + %endif + %if can_undeprecate: + <a class="action-button" href="${h.url_for( controller='repository', action='deprecate', id=trans.security.encode_id( repository.id ), mark_deprecated=False )}">Mark repository as not deprecated</a> + %endif + %if can_download: + <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ), file_type='gz' )}">Download as a .tar.gz file</a> + <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ), file_type='bz2' )}">Download as a .tar.bz2 file</a> + <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ), file_type='zip' )}">Download as a zip file</a> + %endif + </div> + %endif + </ul> +</%def> + +<%def name="render_galaxy_repository_actions( repository=None )"> + <br/><br/> + <ul class="manage-table-actions"> + %if repository: + <li><a class="action-button" href="${h.url_for( controller='repository', action='install_repositories_by_revision', repository_ids=trans.security.encode_id( repository.id ), changeset_revisions=changeset_revision )}">Install to Galaxy</a></li> + <li><a class="action-button" href="${h.url_for( controller='repository', action='preview_tools_in_changeset', repository_id=trans.security.encode_id( repository.id ), changeset_revision=changeset_revision )}">Browse repository</a></li> + <li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Tool Shed Actions</a></li> + <div popupmenu="repository-${repository.id}-popup"> + <a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_categories' )}">Browse valid repositories</a> + <a class="action-button" href="${h.url_for( controller='repository', action='find_tools' )}">Search for valid tools</a> + <a class="action-button" href="${h.url_for( controller='repository', action='find_workflows' )}">Search for workflows</a> + </div> + %else: + <li><a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_categories' )}">Browse valid repositories</a></li> + <a class="action-button" href="${h.url_for( controller='repository', action='find_tools' )}">Search for valid tools</a> + <li><a class="action-button" href="${h.url_for( controller='repository', action='find_workflows' )}">Search for workflows</a></li> + %endif + </ul> +</%def> diff -r 3294bcdca48fad92dbc9349da0dcd5ee6721b3bc -r fadc4b334f3e3cca07238f86d30053318215486e templates/webapps/tool_shed/repository/browse_repository.mako --- a/templates/webapps/tool_shed/repository/browse_repository.mako +++ b/templates/webapps/tool_shed/repository/browse_repository.mako @@ -1,23 +1,9 @@ <%inherit file="/base.mako"/><%namespace file="/message.mako" import="render_msg" /> +<%namespace file="/webapps/tool_shed/common/repository_actions_menu.mako" import="render_tool_shed_repository_actions" /><%namespace file="/webapps/tool_shed/common/common.mako" import="*" /><%namespace file="/webapps/tool_shed/repository/common.mako" import="*" /> -<% - from galaxy.web.framework.helpers import time_ago - is_admin = trans.user_is_admin() - is_new = repository.is_new( trans.app ) - can_contact_owner = trans.user and trans.user != repository.user - can_push = trans.app.security_agent.can_push( trans.app, trans.user, repository ) - can_upload = can_push and ( not repository.deprecated ) - can_download = not is_new and ( not is_malicious or can_push ) - can_browse_contents = not is_new - can_rate = trans.user and repository.user != trans.user - can_manage = is_admin or repository.user == trans.user - can_view_change_log = not is_new - has_readme = metadata and 'readme' in metadata -%> - <%! def inherit(context): if context.get('use_panels'): @@ -30,30 +16,6 @@ <%def name="stylesheets()"> ${parent.stylesheets()} ${h.css( "jquery.rating", "dynatree_skin/ui.dynatree" )} - <style type="text/css"> - ul.fileBrowser, - ul.toolFile { - margin-left: 0; - padding-left: 0; - list-style: none; - } - ul.fileBrowser { - margin-left: 20px; - } - .fileBrowser li, - .toolFile li { - padding-left: 20px; - background-repeat: no-repeat; - background-position: 0; - min-height: 20px; - } - .toolFile li { - background-image: url( ${h.url_for( '/static/images/silk/page_white_compressed.png' )} ); - } - .fileBrowser li { - background-image: url( ${h.url_for( '/static/images/silk/page_white.png' )} ); - } - </style></%def><%def name="javascripts()"> @@ -62,35 +24,14 @@ ${common_javascripts(repository)} </%def> -<br/><br/> -<ul class="manage-table-actions"> - %if is_new: - <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a> - %else: - <li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li> - <div popupmenu="repository-${repository.id}-popup"> - %if can_manage: - <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">Manage repository</a> - %else: - <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">View repository</a> - %endif - %if can_upload: - <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a> - %endif - %if can_view_change_log: - <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">View change log</a> - %endif - %if can_rate: - <a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.app.security.encode_id( repository.id ) )}">Rate repository</a> - %endif - %if can_download: - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ), file_type='gz' )}">Download as a .tar.gz file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ), file_type='bz2' )}">Download as a .tar.bz2 file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ), file_type='zip' )}">Download as a zip file</a> - %endif - </div> - %endif -</ul> +<% + is_new = repository.is_new( trans.app ) + can_push = trans.app.security_agent.can_push( trans.app, trans.user, repository ) + can_download = not is_new and ( not is_malicious or can_push ) + can_browse_contents = not is_new +%> + +${render_tool_shed_repository_actions( repository )} %if message: ${render_msg( message, status )} diff -r 3294bcdca48fad92dbc9349da0dcd5ee6721b3bc -r fadc4b334f3e3cca07238f86d30053318215486e templates/webapps/tool_shed/repository/contact_owner.mako --- a/templates/webapps/tool_shed/repository/contact_owner.mako +++ b/templates/webapps/tool_shed/repository/contact_owner.mako @@ -1,23 +1,6 @@ <%inherit file="/base.mako"/><%namespace file="/message.mako" import="render_msg" /> - -<% - is_admin = trans.user_is_admin() - is_new = repository.is_new( trans.app ) - can_contact_owner = trans.user and trans.user != repository.user - can_push = trans.app.security_agent.can_push( trans.app, trans.user, repository ) - can_upload = can_push - can_download = not is_new and ( not is_malicious or can_push ) - can_browse_contents = not is_new - can_rate = repository.user != trans.user - can_manage = is_admin or repository.user == trans.user - can_view_change_log = not is_new - if can_push: - browse_label = 'Browse or delete repository tip files' - else: - browse_label = 'Browse repository tip files' - has_readme = metadata and 'readme' in metadata -%> +<%namespace file="/webapps/tool_shed/common/repository_actions_menu.mako" import="render_tool_shed_repository_actions" /><%! def inherit(context): @@ -28,35 +11,7 @@ %><%inherit file="${inherit(context)}"/> -<br/><br/> -<ul class="manage-table-actions"> - %if is_new and can_upload: - <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a> - %else: - <li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li> - <div popupmenu="repository-${repository.id}-popup"> - %if can_manage: - <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ) )}">Manage repository</a> - %else: - <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ) )}">View repository</a> - %endif - %if can_upload: - <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a> - %endif - %if can_view_change_log: - <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">View change log</a> - %endif - %if can_browse_contents: - <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label | h}</a> - %endif - %if can_download: - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ), file_type='gz' )}">Download as a .tar.gz file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ), file_type='bz2' )}">Download as a .tar.bz2 file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ), file_type='zip' )}">Download as a zip file</a> - %endif - </div> - %endif -</ul> +${render_tool_shed_repository_actions( repository )} %if message: ${render_msg( message, status )} diff -r 3294bcdca48fad92dbc9349da0dcd5ee6721b3bc -r fadc4b334f3e3cca07238f86d30053318215486e templates/webapps/tool_shed/repository/find_tools.mako --- a/templates/webapps/tool_shed/repository/find_tools.mako +++ b/templates/webapps/tool_shed/repository/find_tools.mako @@ -1,5 +1,6 @@ <%inherit file="/base.mako"/><%namespace file="/message.mako" import="render_msg" /> +<%namespace file="/webapps/tool_shed/common/repository_actions_menu.mako" import="render_galaxy_repository_actions" /><%! def inherit(context): @@ -11,11 +12,7 @@ <%inherit file="${inherit(context)}"/> %if trans.webapp.name == 'galaxy': - <br/><br/> - <ul class="manage-table-actions"> - <li><a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_categories' )}">Browse valid repositories</a></li> - <li><a class="action-button" href="${h.url_for( controller='repository', action='find_workflows' )}">Search for workflows</a></li> - </ul> + ${render_galaxy_repository_actions( repository=None )} %endif %if message: diff -r 3294bcdca48fad92dbc9349da0dcd5ee6721b3bc -r fadc4b334f3e3cca07238f86d30053318215486e templates/webapps/tool_shed/repository/find_workflows.mako --- a/templates/webapps/tool_shed/repository/find_workflows.mako +++ b/templates/webapps/tool_shed/repository/find_workflows.mako @@ -1,5 +1,6 @@ <%inherit file="/base.mako"/><%namespace file="/message.mako" import="render_msg" /> +<%namespace file="/webapps/tool_shed/common/repository_actions_menu.mako" import="render_galaxy_repository_actions" /><%! def inherit(context): @@ -11,11 +12,7 @@ <%inherit file="${inherit(context)}"/> %if trans.webapp.name == 'galaxy': - <br/><br/> - <ul class="manage-table-actions"> - <li><a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_categories' )}">Browse valid repositories</a></li> - <a class="action-button" href="${h.url_for( controller='repository', action='find_tools' )}">Search for valid tools</a> - </ul> + ${render_galaxy_repository_actions( repository=None )} %endif %if message: diff -r 3294bcdca48fad92dbc9349da0dcd5ee6721b3bc -r fadc4b334f3e3cca07238f86d30053318215486e templates/webapps/tool_shed/repository/manage_repository.mako --- a/templates/webapps/tool_shed/repository/manage_repository.mako +++ b/templates/webapps/tool_shed/repository/manage_repository.mako @@ -2,6 +2,7 @@ <%namespace file="/message.mako" import="render_msg" /><%namespace file="/webapps/tool_shed/common/common.mako" import="*" /><%namespace file="/webapps/tool_shed/repository/common.mako" import="*" /> +<%namespace file="/webapps/tool_shed/common/repository_actions_menu.mako" import="render_tool_shed_repository_actions" /><% from galaxy.web.framework.helpers import time_ago @@ -12,26 +13,14 @@ is_new = repository.is_new( trans.app ) is_deprecated = repository.deprecated - can_browse_contents = not is_new - can_contact_owner = trans.user and trans.user != repository.user - can_deprecate = not is_new and trans.user and ( is_admin or repository.user == trans.user ) and not is_deprecated can_push = not is_deprecated and trans.app.security_agent.can_push( trans.app, trans.user, repository ) can_download = not is_deprecated and not is_new and ( not is_malicious or can_push ) - can_rate = not is_new and not is_deprecated and trans.user and repository.user != trans.user - 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 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 - 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:' @@ -62,57 +51,7 @@ ${container_javascripts()} </%def> -<br/><br/> -<ul class="manage-table-actions"> - %if is_new: - %if can_upload: - <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a> - %endif - %else: - <li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li> - <div popupmenu="repository-${repository.id}-popup"> - %if can_review_repository: - %if reviewed_by_user: - <a class="action-button" href="${h.url_for( controller='repository_review', action='edit_review', id=review_id )}">Manage my review of this revision</a> - %else: - <a class="action-button" href="${h.url_for( controller='repository_review', action='create_review', id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision )}">Add a review to this revision</a> - %endif - %endif - %if can_browse_repository_reviews: - <a class="action-button" href="${h.url_for( controller='repository_review', action='manage_repository_reviews', id=trans.app.security.encode_id( repository.id ) )}">Browse reviews of this repository</a> - %endif - %if can_upload: - <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a> - %endif - %if can_view_change_log: - <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">View change log</a> - %endif - %if can_rate: - <a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.app.security.encode_id( repository.id ) )}">Rate repository</a> - %endif - %if can_browse_contents: - <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label | h}</a> - %endif - %if can_contact_owner: - <a class="action-button" href="${h.url_for( controller='repository', action='contact_owner', id=trans.security.encode_id( repository.id ) )}">Contact repository owner</a> - %endif - %if can_reset_all_metadata: - <a class="action-button" href="${h.url_for( controller='repository', action='reset_all_metadata', id=trans.security.encode_id( repository.id ) )}">Reset all repository metadata</a> - %endif - %if can_deprecate: - <a class="action-button" href="${h.url_for( controller='repository', action='deprecate', id=trans.security.encode_id( repository.id ), mark_deprecated=True )}" confirm="Click Ok to deprecate this repository.">Mark repository as deprecated</a> - %endif - %if can_undeprecate: - <a class="action-button" href="${h.url_for( controller='repository', action='deprecate', id=trans.security.encode_id( repository.id ), mark_deprecated=False )}">Mark repository as not deprecated</a> - %endif - %if can_download: - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='gz' )}">Download as a .tar.gz file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='bz2' )}">Download as a .tar.bz2 file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='zip' )}">Download as a zip file</a> - %endif - </div> - %endif -</ul> +${render_tool_shed_repository_actions( repository, repo=repo, metadata=metadata, changeset_revision=changeset_revision )} %if message: ${render_msg( message, status )} diff -r 3294bcdca48fad92dbc9349da0dcd5ee6721b3bc -r fadc4b334f3e3cca07238f86d30053318215486e templates/webapps/tool_shed/repository/preview_tools_in_changeset.mako --- a/templates/webapps/tool_shed/repository/preview_tools_in_changeset.mako +++ b/templates/webapps/tool_shed/repository/preview_tools_in_changeset.mako @@ -2,22 +2,7 @@ <%namespace file="/message.mako" import="render_msg" /><%namespace file="/webapps/tool_shed/common/common.mako" import="*" /><%namespace file="/webapps/tool_shed/repository/common.mako" import="*" /> - -<% - is_new = repository.is_new( trans.app ) - can_contact_owner = trans.user and trans.user != repository.user - can_push = trans.app.security_agent.can_push( trans.app, trans.user, repository ) - can_rate = not is_new and trans.user and repository.user != trans.user - can_upload = can_push - can_download = not is_new and ( not is_malicious or can_push ) - can_browse_contents = not is_new - can_view_change_log = not is_new - if can_push: - browse_label = 'Browse or delete repository tip files' - else: - browse_label = 'Browse repository tip files' - has_readme = metadata and 'readme' in metadata -%> +<%namespace file="/webapps/tool_shed/common/repository_actions_menu.mako" import="render_galaxy_repository_actions" /><%! def inherit(context): @@ -39,16 +24,7 @@ ${container_javascripts()} </%def> -<br/><br/> -<ul class="manage-table-actions"> - <li><a class="action-button" href="${h.url_for( controller='repository', action='install_repositories_by_revision', repository_ids=trans.security.encode_id( repository.id ), changeset_revisions=changeset_revision )}">Install to Galaxy</a></li> - <li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Tool Shed Actions</a></li> - <div popupmenu="repository-${repository.id}-popup"> - <a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_categories' )}">Browse valid repositories</a> - <a class="action-button" href="${h.url_for( controller='repository', action='find_tools' )}">Search for valid tools</a> - <a class="action-button" href="${h.url_for( controller='repository', action='find_workflows' )}">Search for workflows</a> - </div> -</ul> +${render_galaxy_repository_actions( repository=repository )} %if message: ${render_msg( message, status )} diff -r 3294bcdca48fad92dbc9349da0dcd5ee6721b3bc -r fadc4b334f3e3cca07238f86d30053318215486e templates/webapps/tool_shed/repository/rate_repository.mako --- a/templates/webapps/tool_shed/repository/rate_repository.mako +++ b/templates/webapps/tool_shed/repository/rate_repository.mako @@ -1,25 +1,13 @@ <%namespace file="/message.mako" import="render_msg" /><%namespace file="/webapps/tool_shed/common/common.mako" import="*" /><%namespace file="/webapps/tool_shed/repository/common.mako" import="*" /> +<%namespace file="/webapps/tool_shed/common/repository_actions_menu.mako" import="render_tool_shed_repository_actions" /><% from galaxy.web.framework.helpers import time_ago - from urllib import quote_plus - is_admin = trans.user_is_admin() is_new = repository.is_new( trans.app ) - can_contact_owner = trans.user and trans.user != repository.user can_push = trans.app.security_agent.can_push( trans.app, trans.user, repository ) - can_upload = can_push can_download = not is_new and ( not is_malicious or can_push ) - can_browse_contents = not is_new - can_rate = repository.user != trans.user - can_manage = is_admin or repository.user == trans.user - can_view_change_log = not is_new - if can_push: - browse_label = 'Browse or delete repository tip files' - else: - browse_label = 'Browse repository tip files' - has_readme = metadata and 'readme' in metadata %><%! @@ -45,38 +33,7 @@ ${render_msg( message, status )} %endif -<br/><br/> -<ul class="manage-table-actions"> - %if is_new: - <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a> - %else: - <li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li> - <div popupmenu="repository-${repository.id}-popup"> - %if can_manage: - <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">Manage repository</a> - %else: - <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">View repository</a> - %endif - %if can_upload: - <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a> - %endif - %if can_view_change_log: - <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">View change log</a> - %endif - %if can_browse_contents: - <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label | h}</a> - %endif - %if can_contact_owner: - <a class="action-button" href="${h.url_for( controller='repository', action='contact_owner', id=trans.security.encode_id( repository.id ) )}">Contact repository owner</a> - %endif - %if can_download: - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ), file_type='gz' )}">Download as a .tar.gz file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ), file_type='bz2' )}">Download as a .tar.bz2 file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ), file_type='zip' )}">Download as a zip file</a> - %endif - </div> - %endif -</ul> +${render_tool_shed_repository_actions( repository, repo=None, metadata=None, changeset_revision=None )} %if repository.user != trans.user: <div class="toolForm"> diff -r 3294bcdca48fad92dbc9349da0dcd5ee6721b3bc -r fadc4b334f3e3cca07238f86d30053318215486e templates/webapps/tool_shed/repository/tool_form.mako --- a/templates/webapps/tool_shed/repository/tool_form.mako +++ b/templates/webapps/tool_shed/repository/tool_form.mako @@ -1,27 +1,12 @@ <%inherit file="/base.mako"/><%namespace file="/message.mako" import="render_msg" /> +<%namespace file="/webapps/tool_shed/common/repository_actions_menu.mako" import="*" /><% from galaxy.util.expressions import ExpressionContext from galaxy import util from galaxy.tools.parameters.basic import DataToolParameter, ColumnListParameter, GenomeBuildParameter, SelectToolParameter from galaxy.web.form_builder import SelectField - - is_admin = trans.user_is_admin() - is_new = repository.is_new( trans.app ) - can_contact_owner = trans.user and trans.user != repository.user - can_push = trans.app.security_agent.can_push( trans.app, trans.user, repository ) - can_upload = can_push - can_download = not is_new and ( not is_malicious or can_push ) - can_browse_contents = not is_new - can_rate = trans.user and repository.user != trans.user - can_manage = is_admin or repository.user == trans.user - can_view_change_log = not is_new - if can_push: - browse_label = 'Browse or delete repository tip files' - else: - browse_label = 'Browse repository tip files' - has_readme = metadata and 'readme' in metadata %><html> @@ -119,56 +104,12 @@ </div></%def> - <br/><br/> - <ul class="manage-table-actions"> - %if trans.webapp.name == 'galaxy': - <li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li> - <div popupmenu="repository-${repository.id}-popup"> - <li><a class="action-button" href="${h.url_for( controller='repository', action='install_repositories_by_revision', repository_ids=trans.security.encode_id( repository.id ), changeset_revisions=changeset_revision )}">Install to Galaxy</a></li> - <li><a class="action-button" href="${h.url_for( controller='repository', action='preview_tools_in_changeset', repository_id=trans.security.encode_id( repository.id ), changeset_revision=changeset_revision )}">Browse repository</a></li> - </div> - <li><a class="action-button" id="tool_shed-${repository.id}-popup" class="menubutton">Tool Shed Actions</a></li> - <div popupmenu="tool_shed-${repository.id}-popup"> - <a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_categories' )}">Browse valid repositories</a> - <a class="action-button" href="${h.url_for( controller='repository', action='find_tools' )}">Search for valid tools</a> - <a class="action-button" href="${h.url_for( controller='repository', action='find_workflows' )}">Search for workflows</a> - </div> - %else: - %if is_new: - <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a> - %else: - <li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li> - <div popupmenu="repository-${repository.id}-popup"> - %if can_manage: - <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision )}">Manage repository</a> - %else: - <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision )}">View repository</a> - %endif - %if can_upload: - <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a> - %endif - %if can_view_change_log: - <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">View change log</a> - %endif - %if can_browse_contents: - <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label}</a> - %endif - %if can_rate: - <a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.app.security.encode_id( repository.id ) )}">Rate repository</a> - %endif - %if can_contact_owner: - <a class="action-button" href="${h.url_for( controller='repository', action='contact_owner', id=trans.security.encode_id( repository.id ) )}">Contact repository owner</a> - %endif - %if can_download: - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='gz' )}">Download as a .tar.gz file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='bz2' )}">Download as a .tar.bz2 file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='zip' )}">Download as a zip file</a> - %endif - </div> - %endif - %endif - </ul> - + %if trans.webapp.name == 'galaxy': + ${render_galaxy_repository_actions( repository=repository )} + %else: + ${render_tool_shed_repository_actions( repository, repo=None, metadata=None, changeset_revision=None )} + %endif + %if message: ${render_msg( message, status )} %endif diff -r 3294bcdca48fad92dbc9349da0dcd5ee6721b3bc -r fadc4b334f3e3cca07238f86d30053318215486e templates/webapps/tool_shed/repository/upload.mako --- a/templates/webapps/tool_shed/repository/upload.mako +++ b/templates/webapps/tool_shed/repository/upload.mako @@ -1,14 +1,9 @@ <%namespace file="/message.mako" import="render_msg" /><%namespace file="/webapps/tool_shed/repository/common.mako" import="*" /> +<%namespace file="/webapps/tool_shed/common/repository_actions_menu.mako" import="render_tool_shed_repository_actions" /><% - is_admin = trans.user_is_admin() is_new = repository.is_new( trans.app ) - can_browse_contents = not is_new - can_browse_contents = not is_new - can_rate = repository.user != trans.user - can_manage = is_admin or repository.user == trans.user - can_view_change_log = not is_new %><%! @@ -43,23 +38,7 @@ ${render_msg( message, status )} %endif -<br/><br/> -<ul class="manage-table-actions"> - <li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li> - <div popupmenu="repository-${repository.id}-popup"> - %if can_manage: - <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">Manage repository</a> - %else: - <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">View repository</a> - %endif - %if can_view_change_log: - <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">View change log</a> - %endif - %if can_browse_contents: - <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">Browse or delete repository files</a> - %endif - </div> -</ul> +${render_tool_shed_repository_actions( repository=repository)} <div class="toolForm"><div class="toolFormTitle">Upload a single file or a tarball</div> diff -r 3294bcdca48fad92dbc9349da0dcd5ee6721b3bc -r fadc4b334f3e3cca07238f86d30053318215486e templates/webapps/tool_shed/repository/view_changelog.mako --- a/templates/webapps/tool_shed/repository/view_changelog.mako +++ b/templates/webapps/tool_shed/repository/view_changelog.mako @@ -2,23 +2,13 @@ <%namespace file="/message.mako" import="render_msg" /><%namespace file="/webapps/tool_shed/common/common.mako" import="*" /><%namespace file="/webapps/tool_shed/repository/common.mako" import="render_clone_str" /> +<%namespace file="/webapps/tool_shed/common/repository_actions_menu.mako" import="render_tool_shed_repository_actions" /><% from galaxy.web.framework.helpers import time_ago - is_admin = trans.user_is_admin() is_new = repository.is_new( trans.app ) - can_contact_owner = trans.user and trans.user != repository.user - can_browse_contents = not is_new - can_manage = is_admin or trans.user == repository.user can_push = trans.app.security_agent.can_push( trans.app, trans.user, repository ) - can_rate = trans.user and repository.user != trans.user - can_upload = can_push can_download = not is_new and ( not is_malicious or can_push ) - if can_push: - browse_label = 'Browse or delete repository tip files' - else: - browse_label = 'Browse repository tip files' - has_readme = metadata and 'readme' in metadata %><%! @@ -40,34 +30,7 @@ ${h.js( "libs/jquery/jquery.rating" )} </%def> -<br/><br/> -<ul class="manage-table-actions"> - <li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li> - <div popupmenu="repository-${repository.id}-popup"> - %if can_upload: - <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a> - %endif - %if can_manage: - <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">Manage repository</a> - %else: - <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">View repository</a> - %endif - %if can_rate: - <a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.security.encode_id( repository.id ) )}">Rate repository</a> - %endif - %if can_browse_contents: - <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.security.encode_id( repository.id ) )}">${browse_label}</a> - %endif - %if can_contact_owner: - <a class="action-button" href="${h.url_for( controller='repository', action='contact_owner', id=trans.security.encode_id( repository.id ) )}">Contact repository owner</a> - %endif - %if can_download: - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ), file_type='gz' )}">Download as a .tar.gz file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ), file_type='bz2' )}">Download as a .tar.bz2 file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ), file_type='zip' )}">Download as a zip file</a> - %endif - </div> -</ul> +${render_tool_shed_repository_actions( repository=repository )} %if message: ${render_msg( message, status )} diff -r 3294bcdca48fad92dbc9349da0dcd5ee6721b3bc -r fadc4b334f3e3cca07238f86d30053318215486e templates/webapps/tool_shed/repository/view_changeset.mako --- a/templates/webapps/tool_shed/repository/view_changeset.mako +++ b/templates/webapps/tool_shed/repository/view_changeset.mako @@ -2,24 +2,12 @@ <%namespace file="/message.mako" import="render_msg" /><%namespace file="/webapps/tool_shed/common/common.mako" import="*" /><%namespace file="/webapps/tool_shed/repository/common.mako" import="render_clone_str" /> +<%namespace file="/webapps/tool_shed/common/repository_actions_menu.mako" import="render_tool_shed_repository_actions" /><% - from galaxy.web.framework.helpers import time_ago - is_admin = trans.user_is_admin() is_new = repository.is_new( trans.app ) - can_contact_owner = trans.user and trans.user != repository.user - can_browse_contents = not is_new - can_rate = trans.user and repository.user != trans.user - can_manage = is_admin or trans.user == repository.user can_push = trans.app.security_agent.can_push( trans.app, trans.user, repository ) - can_view_change_log = not is_new - can_upload = can_push can_download = not is_new and ( not is_malicious or can_push ) - if can_push: - browse_label = 'Browse or delete repository tip files' - else: - browse_label = 'Browse repository tip files' - has_readme = metadata and 'readme' in metadata %><%! @@ -41,37 +29,7 @@ ${h.js( "libs/jquery/jquery.rating" )} </%def> -<br/><br/> -<ul class="manage-table-actions"> - <li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li> - <div popupmenu="repository-${repository.id}-popup"> - %if can_upload: - <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a> - %endif - %if can_manage: - <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">Manage repository</a> - %else: - <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">View repository</a> - %endif - %if can_view_change_log: - <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">View change log</a> - %endif - %if can_rate: - <a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.app.security.encode_id( repository.id ) )}">Rate repository</a> - %endif - %if can_browse_contents: - <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label}</a> - %endif - %if can_contact_owner: - <a class="action-button" href="${h.url_for( controller='repository', action='contact_owner', id=trans.security.encode_id( repository.id ) )}">Contact repository owner</a> - %endif - %if can_download: - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ), file_type='gz' )}">Download as a .tar.gz file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ), file_type='bz2' )}">Download as a .tar.bz2 file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ), file_type='zip' )}">Download as a zip file</a> - %endif - </div> -</ul> +${render_tool_shed_repository_actions( repository=repository )} %if message: ${render_msg( message, status )} diff -r 3294bcdca48fad92dbc9349da0dcd5ee6721b3bc -r fadc4b334f3e3cca07238f86d30053318215486e templates/webapps/tool_shed/repository/view_repository.mako --- a/templates/webapps/tool_shed/repository/view_repository.mako +++ b/templates/webapps/tool_shed/repository/view_repository.mako @@ -2,34 +2,21 @@ <%namespace file="/message.mako" import="render_msg" /><%namespace file="/webapps/tool_shed/common/common.mako" import="*" /><%namespace file="/webapps/tool_shed/repository/common.mako" import="*" /> +<%namespace file="/webapps/tool_shed/common/repository_actions_menu.mako" import="*" /><% from galaxy.web.framework.helpers import time_ago from tool_shed.util.shed_util_common import to_safe_string - if metadata: - has_readme = 'readme' in metadata - else: - has_readme = False - has_metadata = repository.metadata_revisions is_new = repository.is_new( trans.app ) is_deprecated = repository.deprecated can_browse_contents = trans.webapp.name == 'tool_shed' and not is_new - can_contact_owner = trans.user and trans.user != repository.user + can_push = not is_deprecated and trans.app.security_agent.can_push( trans.app, trans.user, repository ) can_download = not is_deprecated and not is_new and ( not is_malicious or can_push ) - can_push = not is_deprecated and trans.app.security_agent.can_push( trans.app, trans.user, repository ) - can_rate = not is_deprecated and not is_new and trans.user and repository.user != trans.user - 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 == 'tool_shed' 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:' @@ -60,58 +47,11 @@ ${container_javascripts()} </%def> -<br/><br/> -<ul class="manage-table-actions"> - %if trans.webapp.name == 'tool_shed': - %if is_new: - %if can_upload: - <li><a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a></li> - %endif - %else: - <li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li> - <div popupmenu="repository-${repository.id}-popup"> - %if can_review_repository: - %if reviewed_by_user: - <a class="action-button" href="${h.url_for( controller='repository_review', action='edit_review', id=review_id )}">Manage my review of this revision</a> - %else: - <a class="action-button" href="${h.url_for( controller='repository_review', action='create_review', id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision )}">Add a review to this revision</a> - %endif - %endif - %if can_browse_repository_reviews: - <a class="action-button" href="${h.url_for( controller='repository_review', action='manage_repository_reviews', id=trans.app.security.encode_id( repository.id ) )}">Browse reviews of this repository</a> - %endif - %if can_upload: - <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a> - %endif - %if can_view_change_log: - <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">View change log</a> - %endif - %if can_rate: - <a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.app.security.encode_id( repository.id ) )}">Rate repository</a> - %endif - %if can_browse_contents: - <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label}</a> - %endif - %if can_contact_owner: - <a class="action-button" href="${h.url_for( controller='repository', action='contact_owner', id=trans.security.encode_id( repository.id ) )}">Contact repository owner</a> - %endif - %if can_download: - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='gz' )}">Download as a .tar.gz file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='bz2' )}">Download as a .tar.bz2 file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='zip' )}">Download as a zip file</a> - %endif - </div> - %endif - %else: - <li><a class="action-button" href="${h.url_for( controller='repository', action='install_repositories_by_revision', repository_ids=trans.security.encode_id( repository.id ), changeset_revisions=changeset_revision )}">Install to Galaxy</a></li> - <li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Tool Shed Actions</a></li> - <div popupmenu="repository-${repository.id}-popup"> - <a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_categories' )}">Browse valid repositories</a> - <a class="action-button" href="${h.url_for( controller='repository', action='find_tools' )}">Search for valid tools</a> - <a class="action-button" href="${h.url_for( controller='repository', action='find_workflows' )}">Search for workflows</a> - </div> - %endif -</ul> +%if trans.webapp.name == 'tool_shed': + ${render_tool_shed_repository_actions( repository=repository, changeset_revision=changeset_revision )} +%else: + ${render_galaxy_repository_actions( repository=repository )} +%endif %if message: ${render_msg( message, status )} diff -r 3294bcdca48fad92dbc9349da0dcd5ee6721b3bc -r fadc4b334f3e3cca07238f86d30053318215486e templates/webapps/tool_shed/repository/view_tool_metadata.mako --- a/templates/webapps/tool_shed/repository/view_tool_metadata.mako +++ b/templates/webapps/tool_shed/repository/view_tool_metadata.mako @@ -2,33 +2,14 @@ <%namespace file="/message.mako" import="render_msg" /><%namespace file="/webapps/tool_shed/common/common.mako" import="*" /><%namespace file="/webapps/tool_shed/repository/common.mako" import="*" /> +<%namespace file="/webapps/tool_shed/common/repository_actions_menu.mako" import="*" /><% - from galaxy.web.framework.helpers import time_ago - from urllib import quote_plus + is_new = repository.is_new( trans.app ) - has_metadata = repository.metadata_revisions - has_readme = metadata and 'readme' in metadata - is_admin = trans.user_is_admin() - is_new = repository.is_new( trans.app ) - is_deprecated = repository.deprecated - - can_browse_contents = trans.webapp.name == 'tool_shed' and not is_new - can_contact_owner = trans.user and trans.user != repository.user + can_push = trans.app.security_agent.can_push( trans.app, trans.user, repository ) can_download = not is_new and ( not is_malicious or can_push ) - can_manage = is_admin or repository.user == trans.user - can_push = trans.app.security_agent.can_push( trans.app, trans.user, repository ) - can_rate = repository.user != trans.user - 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 == 'tool_shed' and not is_new - # TODO: fix the following when the install and test buildbot is functional. - #can_view_tool_test_results = tool_test_results is not None - - if can_push: - browse_label = 'Browse or delete repository tip files' - else: - browse_label = 'Browse repository tip files' %><%! @@ -40,59 +21,11 @@ %><%inherit file="${inherit(context)}"/> -<br/><br/> -<ul class="manage-table-actions"> - %if trans.webapp.name == 'galaxy': - <li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li> - <div popupmenu="repository-${repository.id}-popup"> - <li><a class="action-button" href="${h.url_for( controller='repository', action='install_repositories_by_revision', repository_ids=trans.security.encode_id( repository.id ), changeset_revisions=changeset_revision )}">Install to Galaxy</a></li> - <li><a class="action-button" href="${h.url_for( controller='repository', action='preview_tools_in_changeset', repository_id=trans.security.encode_id( repository.id ), changeset_revision=changeset_revision )}">Browse repository</a></li> - </div> - <li><a class="action-button" id="tool_shed-${repository.id}-popup" class="menubutton">Tool Shed Actions</a></li> - <div popupmenu="tool_shed-${repository.id}-popup"> - <a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_categories' )}">Browse valid repositories</a> - <a class="action-button" href="${h.url_for( controller='repository', action='find_tools' )}">Search for valid tools</a> - <a class="action-button" href="${h.url_for( controller='repository', action='find_workflows' )}">Search for workflows</a> - </div> - %else: - %if is_new: - <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a> - %else: - <li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li> - <div popupmenu="repository-${repository.id}-popup"> - %if can_review_repository: - %if reviewed_by_user: - <a class="action-button" href="${h.url_for( controller='repository_review', action='edit_review', id=review_id )}">Manage my review of this revision</a> - %else: - <a class="action-button" href="${h.url_for( controller='repository_review', action='create_review', id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision )}">Add a review to this revision</a> - %endif - %endif - %if can_manage: - <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision )}">Manage repository</a> - %else: - <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision )}">View repository</a> - %endif - %if can_upload: - <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a> - %endif - %if can_view_change_log: - <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">View change log</a> - %endif - %if can_browse_contents: - <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label}</a> - %endif - %if can_contact_owner: - <a class="action-button" href="${h.url_for( controller='repository', action='contact_owner', id=trans.security.encode_id( repository.id ) )}">Contact repository owner</a> - %endif - %if can_download: - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='gz' )}">Download as a .tar.gz file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='bz2' )}">Download as a .tar.bz2 file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='zip' )}">Download as a zip file</a> - %endif - </div> - %endif - %endif -</ul> +%if trans.webapp.name == 'tool_shed': + ${render_tool_shed_repository_actions( repository=repository, changeset_revision=changeset_revision )} +%else: + ${render_galaxy_repository_actions( repository=repository )} +%endif %if message: ${render_msg( message, status )} diff -r 3294bcdca48fad92dbc9349da0dcd5ee6721b3bc -r fadc4b334f3e3cca07238f86d30053318215486e templates/webapps/tool_shed/repository/view_workflow.mako --- a/templates/webapps/tool_shed/repository/view_workflow.mako +++ b/templates/webapps/tool_shed/repository/view_workflow.mako @@ -2,27 +2,10 @@ <%namespace file="/message.mako" import="render_msg" /><%namespace file="/webapps/tool_shed/common/common.mako" import="*" /><%namespace file="/webapps/tool_shed/repository/common.mako" import="*" /> +<%namespace file="/webapps/tool_shed/common/repository_actions_menu.mako" import="render_tool_shed_repository_actions" /><% - from galaxy.web.framework.helpers import time_ago from tool_shed.util.encoding_util import tool_shed_encode - - is_admin = trans.user_is_admin() - is_new = repository.is_new( trans.app ) - can_manage = is_admin or trans.user == repository.user - can_contact_owner = trans.user and trans.user != repository.user - can_push = trans.app.security_agent.can_push( trans.app, trans.user, repository ) - can_upload = can_push - can_download = not is_new and ( not is_malicious or can_push ) - can_browse_contents = not is_new - can_rate = not is_new and trans.user and repository.user != trans.user - can_view_change_log = not is_new - if can_push: - browse_label = 'Browse or delete repository tip files' - else: - browse_label = 'Browse repository tip files' - - # <li><a class="action-button" href="${h.url_for( controller='repository', action='install_repositories_by_revision', repository_ids=trans.security.encode_id( repository.id ), changeset_revisions=changeset_revision )}">Install repository to Galaxy</a></li> %><%! @@ -32,6 +15,7 @@ else: return '/base.mako' %> + <%inherit file="${inherit(context)}"/><%def name="render_workflow( workflow_name, repository_metadata_id )"> @@ -39,41 +23,7 @@ <iframe name="galaxy_main" id="galaxy_main" frameborder="0" style="position: absolute; width: 100%; height: 100%;" src="${center_url}"></iframe></%def> -<br/><br/> -<ul class="manage-table-actions"> - %if is_new and can_upload: - <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a> - %else: - <li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li> - <div popupmenu="repository-${repository.id}-popup"> - %if can_upload: - <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a> - %endif - %if can_manage: - <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">Manage repository</a> - %else: - <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">View repository</a> - %endif - %if can_view_change_log: - <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">View change log</a> - %endif - %if can_rate: - <a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.app.security.encode_id( repository.id ) )}">Rate repository</a> - %endif - %if can_browse_contents: - <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label}</a> - %endif - %if can_contact_owner: - <a class="action-button" href="${h.url_for( controller='repository', action='contact_owner', id=trans.security.encode_id( repository.id ) )}">Contact repository owner</a> - %endif - %if can_download: - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='gz' )}">Download as a .tar.gz file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='bz2' )}">Download as a .tar.bz2 file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='zip' )}">Download as a zip file</a> - %endif - </div> - %endif -</ul> +${render_tool_shed_repository_actions( repository=repository )} %if message: ${render_msg( message, status )} diff -r 3294bcdca48fad92dbc9349da0dcd5ee6721b3bc -r fadc4b334f3e3cca07238f86d30053318215486e templates/webapps/tool_shed/repository_review/browse_review.mako --- a/templates/webapps/tool_shed/repository_review/browse_review.mako +++ b/templates/webapps/tool_shed/repository_review/browse_review.mako @@ -1,12 +1,12 @@ <%inherit file="/base.mako"/><%namespace file="/message.mako" import="render_msg" /><%namespace file="/webapps/tool_shed/common/common.mako" import="*" /> +<%namespace file="/webapps/tool_shed/common/repository_actions_menu.mako" import="render_tool_shed_repository_actions" /><% from galaxy.web.form_builder import CheckboxField from galaxy.webapps.tool_shed.util.container_util import STRSEP from tool_shed.util.shed_util_common import to_safe_string - can_manage_repository = is_admin or repository.user == trans.user %><%def name="stylesheets()"> @@ -18,17 +18,7 @@ ${h.js( "libs/jquery/jquery.rating" )} </%def> -<br/><br/> -<ul class="manage-table-actions"> - <li><a class="action-button" id="review-${review.id}-popup" class="menubutton">Review Actions</a></li> - <div popupmenu="review-${review.id}-popup"> - %if can_manage_repository: - <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=review.changeset_revision )}">Manage repository</a> - %else: - <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=review.changeset_revision )}">View repository</a> - %endif - </div> -</ul> +${render_tool_shed_repository_actions( repository=repository, changeset_revision=review.changeset_revision )} %if message: ${render_msg( message, status )} diff -r 3294bcdca48fad92dbc9349da0dcd5ee6721b3bc -r fadc4b334f3e3cca07238f86d30053318215486e templates/webapps/tool_shed/repository_review/edit_review.mako --- a/templates/webapps/tool_shed/repository_review/edit_review.mako +++ b/templates/webapps/tool_shed/repository_review/edit_review.mako @@ -1,12 +1,12 @@ <%inherit file="/base.mako"/><%namespace file="/message.mako" import="render_msg" /><%namespace file="/webapps/tool_shed/common/common.mako" import="*" /> +<%namespace file="/webapps/tool_shed/common/repository_actions_menu.mako" import="render_tool_shed_repository_actions" /><% from galaxy.web.form_builder import CheckboxField from tool_shed.grids.util import build_approved_select_field from galaxy.webapps.tool_shed.util.container_util import STRSEP - can_manage_repository = is_admin or repository.user == trans.user %><%def name="stylesheets()"> @@ -18,17 +18,7 @@ ${h.js( "libs/jquery/jquery.rating" )} </%def> -<br/><br/> -<ul class="manage-table-actions"> - <li><a class="action-button" id="review-${review.id}-popup" class="menubutton">Review Actions</a></li> - <div popupmenu="review-${review.id}-popup"> - %if can_manage_repository: - <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=review.changeset_revision )}">Manage repository</a> - %else: - <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=review.changeset_revision )}">View repository</a> - %endif - </div> -</ul> +${render_tool_shed_repository_actions( repository=repository, changeset_revision=review.changeset_revision )} %if message: ${render_msg( message, status )} diff -r 3294bcdca48fad92dbc9349da0dcd5ee6721b3bc -r fadc4b334f3e3cca07238f86d30053318215486e templates/webapps/tool_shed/repository_review/reviews_of_changeset_revision.mako --- a/templates/webapps/tool_shed/repository_review/reviews_of_changeset_revision.mako +++ b/templates/webapps/tool_shed/repository_review/reviews_of_changeset_revision.mako @@ -2,22 +2,12 @@ <%namespace file="/message.mako" import="render_msg" /><%namespace file="/webapps/tool_shed/common/common.mako" import="*" /><%namespace file="/webapps/tool_shed/repository/common.mako" import="*" /> +<%namespace file="/webapps/tool_shed/common/repository_actions_menu.mako" import="render_tool_shed_repository_actions" /><% from tool_shed.grids.util import build_approved_select_field from galaxy.webapps.tool_shed.util.container_util import STRSEP - is_admin = trans.user_is_admin() - is_new = repository.is_new( trans.app ) - can_browse_contents = not is_new - can_contact_owner = trans.user and trans.user != repository.user - can_manage = is_admin or repository.user == trans.user - can_push = trans.app.security_agent.can_push( trans.app, trans.user, repository ) - can_rate = not is_new and trans.user and repository.user != trans.user - can_view_change_log = not is_new - if can_push: - browse_label = 'Browse or delete repository tip files' - else: - browse_label = 'Browse repository tip files' + if installable: installable_str = 'yes' else: @@ -44,29 +34,7 @@ ${common_javascripts(repository)} </%def> -<br/><br/> -<ul class="manage-table-actions"> - <li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li> - <div popupmenu="repository-${repository.id}-popup"> - %if can_manage: - <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision )}">Manage repository</a> - %else: - <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision )}">View repository</a> - %endif - %if can_view_change_log: - <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.security.encode_id( repository.id ) )}">View change log</a> - %endif - %if can_rate: - <a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.security.encode_id( repository.id ) )}">Rate repository</a> - %endif - %if can_browse_contents: - <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.security.encode_id( repository.id ) )}">${browse_label}</a> - %endif - %if can_contact_owner: - <a class="action-button" href="${h.url_for( controller='repository', action='contact_owner', id=trans.security.encode_id( repository.id ) )}">Contact repository owner</a> - %endif - </div> -</ul> +${render_tool_shed_repository_actions( repository=repository, changeset_revision=changeset_revision )} %if message: ${render_msg( message, status )} diff -r 3294bcdca48fad92dbc9349da0dcd5ee6721b3bc -r fadc4b334f3e3cca07238f86d30053318215486e templates/webapps/tool_shed/repository_review/reviews_of_repository.mako --- a/templates/webapps/tool_shed/repository_review/reviews_of_repository.mako +++ b/templates/webapps/tool_shed/repository_review/reviews_of_repository.mako @@ -2,26 +2,13 @@ <%namespace file="/message.mako" import="render_msg" /><%namespace file="/webapps/tool_shed/common/common.mako" import="*" /><%namespace file="/webapps/tool_shed/repository/common.mako" import="*" /> +<%namespace file="/webapps/tool_shed/common/repository_actions_menu.mako" import="render_tool_shed_repository_actions" /><% - is_admin = trans.user_is_admin() - is_new = repository.is_new( trans.app ) - can_browse_contents = not is_new - can_contact_owner = trans.user and trans.user != repository.user - can_manage = is_admin or repository.user == trans.user - can_push = trans.app.security_agent.can_push( trans.app, trans.user, repository ) - can_rate = not is_new and trans.user and repository.user != trans.user - can_view_change_log = not is_new - if can_push: - browse_label = 'Browse or delete repository tip files' - else: - browse_label = 'Browse repository tip files' if mine: title = "My reviews of repository '%s'" % repository.name - review_revision_label = "Manage my review of this revision" else: title = "All reviews of repository '%s'" % repository.name - review_revision_label = "Inspect reviews of this revision" %><%! @@ -39,29 +26,7 @@ ${common_javascripts(repository)} </%def> -<br/><br/> -<ul class="manage-table-actions"> - <li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li> - <div popupmenu="repository-${repository.id}-popup"> - %if can_manage: - <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">Manage repository</a> - %else: - <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">View repository</a> - %endif - %if can_view_change_log: - <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.security.encode_id( repository.id ) )}">View change log</a> - %endif - %if can_rate: - <a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.security.encode_id( repository.id ) )}">Rate repository</a> - %endif - %if can_browse_contents: - <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.security.encode_id( repository.id ) )}">${browse_label | h}</a> - %endif - %if can_contact_owner: - <a class="action-button" href="${h.url_for( controller='repository', action='contact_owner', id=trans.security.encode_id( repository.id ) )}">Contact repository owner</a> - %endif - </div> -</ul> +${render_tool_shed_repository_actions( repository=repository )} %if message: ${render_msg( message, status )} diff -r 3294bcdca48fad92dbc9349da0dcd5ee6721b3bc -r fadc4b334f3e3cca07238f86d30053318215486e templates/webapps/tool_shed/repository_review/select_previous_review.mako --- a/templates/webapps/tool_shed/repository_review/select_previous_review.mako +++ b/templates/webapps/tool_shed/repository_review/select_previous_review.mako @@ -2,22 +2,7 @@ <%namespace file="/message.mako" import="render_msg" /><%namespace file="/webapps/tool_shed/common/common.mako" import="*" /><%namespace file="/webapps/tool_shed/repository/common.mako" import="*" /> - -<% - is_admin = trans.user_is_admin() - is_new = repository.is_new( trans.app ) - can_browse_contents = not is_new - can_contact_owner = trans.user and trans.user != repository.user - can_manage = is_admin or repository.user == trans.user - can_push = trans.app.security_agent.can_push( trans.app, trans.user, repository ) - can_rate = not is_new and trans.user and repository.user != trans.user - can_view_change_log = not is_new - if can_push: - browse_label = 'Browse or delete repository tip files' - else: - browse_label = 'Browse repository tip files' - can_review_repositories = trans.app.security_agent.user_can_review_repositories( trans.user ) -%> +<%namespace file="/webapps/tool_shed/common/repository_actions_menu.mako" import="render_tool_shed_repository_actions" /><%! def inherit(context): @@ -38,29 +23,7 @@ ${common_javascripts(repository)} </%def> -<br/><br/> -<ul class="manage-table-actions"> - <li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li> - <div popupmenu="repository-${repository.id}-popup"> - %if can_manage: - <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">Manage repository</a> - %else: - <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">View repository</a> - %endif - %if can_view_change_log: - <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.security.encode_id( repository.id ) )}">View change log</a> - %endif - %if can_rate: - <a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.security.encode_id( repository.id ) )}">Rate repository</a> - %endif - %if can_browse_contents: - <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.security.encode_id( repository.id ) )}">${browse_label}</a> - %endif - %if can_contact_owner: - <a class="action-button" href="${h.url_for( controller='repository', action='contact_owner', id=trans.security.encode_id( repository.id ) )}">Contact repository owner</a> - %endif - </div> -</ul> +${render_tool_shed_repository_actions( repository=repository )} %if message: ${render_msg( message, status )} 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.
participants (1)
-
commits-noreply@bitbucket.org