[hg] galaxy 3723: Add a link to the user's uploaded tools from t...
details: http://www.bx.psu.edu/hg/galaxy/rev/85e05920bada changeset: 3723:85e05920bada user: Greg Von Kuster <greg@bx.psu.edu> date: Fri Apr 30 15:20:04 2010 -0400 description: Add a link to the user's uploaded tools from the Manage users grid, and fix some more bugs in the community app. diffstat: lib/galaxy/webapps/community/controllers/admin.py | 60 ++++++---------------- templates/webapps/community/index.mako | 4 +- templates/webapps/community/tool/edit_tool.mako | 1 - templates/webapps/community/tool/view_tool.mako | 1 - 4 files changed, 20 insertions(+), 46 deletions(-) diffs (148 lines): diff -r db4f8befcd89 -r 85e05920bada lib/galaxy/webapps/community/controllers/admin.py --- a/lib/galaxy/webapps/community/controllers/admin.py Fri Apr 30 14:08:23 2010 -0400 +++ b/lib/galaxy/webapps/community/controllers/admin.py Fri Apr 30 15:20:04 2010 -0400 @@ -18,13 +18,6 @@ if user.username: return user.username return 'not set' - class StatusColumn( grids.GridColumn ): - def get_value( self, trans, grid, user ): - if user.purged: - return "purged" - elif user.deleted: - return "deleted" - return "" class GroupsColumn( grids.GridColumn ): def get_value( self, trans, grid, user ): if user.groups: @@ -45,6 +38,16 @@ if user.galaxy_sessions: return self.format( user.galaxy_sessions[ 0 ].update_time ) return 'never' + class StatusColumn( grids.GridColumn ): + def get_value( self, trans, grid, user ): + if user.purged: + return "purged" + elif user.deleted: + return "deleted" + return "" + class ToolsColumn( grids.TextColumn ): + def get_value( self, trans, grid, user ): + return '<a href="browse_tools_by_user?operation=browse&id=%s">%s</a>' % ( trans.security.encode_id( user.id ), str( len( user.tools ) ) ) # Grid definition webapp = "community" @@ -69,6 +72,10 @@ ExternalColumn( "External", attach_popup=False ), LastLoginColumn( "Last Login", format=time_ago ), StatusColumn( "Status", attach_popup=False ), + ToolsColumn( "Uploaded Tools", + model_class=model.User, + attach_popup=False, + filterable="advanced" ), # Columns that are valid for filtering but are not visible. grids.DeletedColumn( "Deleted", key="deleted", visible=False, filterable="advanced" ) ] @@ -488,11 +495,7 @@ grids.GridOperation( "Edit information", condition=( lambda item: not item.deleted ), allow_multiple=False, - url_args=dict( controller="common", action="edit_tool", cntrller="admin", webapp="community" ) ), - grids.GridOperation( "Manage categories", - condition=( lambda item: not item.deleted ), - allow_multiple=False, - url_args=dict( controller="common", action="manage_categories", cntrller="admin", webapp="community" ) ) + url_args=dict( controller="common", action="edit_tool", cntrller="admin", webapp="community" ) ) ] standard_filters = [ grids.GridColumnFilter( "Deleted", args=dict( deleted=True ) ), @@ -553,7 +556,6 @@ @web.expose @web.require_admin def browse_tools_by_user( self, trans, **kwd ): - # TODO: move this to the common controller as it is in the tool controller as well... if 'operation' in kwd: operation = kwd['operation'].lower() if operation == "browse": @@ -580,35 +582,8 @@ return trans.response.send_redirect( web.url_for( controller='tool', action='download_tool', **kwd ) ) - @web.expose - @web.require_admin - def browse_tools_by_user( self, trans, **kwd ): - # TODO: move this to the common controller as it is in the tool controller as well... - if 'operation' in kwd: - operation = kwd['operation'].lower() - if operation == "browse": - return trans.response.send_redirect( web.url_for( controller='admin', - action='browse_tools_by_user', - **kwd ) ) - elif operation == "browse category": - return trans.response.send_redirect( web.url_for( controller='common', - action='browse_category', - cntrller='admin', - **kwd ) ) - elif operation == "view tool": - return trans.response.send_redirect( web.url_for( controller='common', - action='view_tool', - cntrller='admin', - **kwd ) ) - elif operation == "edit tool": - return trans.response.send_redirect( web.url_for( controller='common', - action='edit_tool', - cntrller='admin', - **kwd ) ) - elif operation == "download tool": - return trans.response.send_redirect( web.url_for( controller='tool', - action='download_tool', - **kwd ) ) + # Render the list view + return self.tool_list_grid( trans, **kwd ) @web.expose @web.require_admin def manage_categories( self, trans, **kwd ): @@ -860,7 +835,6 @@ ## ---- Utility methods ------------------------------------------------------- def get_tools_by_state( trans, state ): - # TODO: this can be written so that it is much cleaner and faster tool_id = [] if state == trans.model.Tool.states.NEW: for tool in get_tools( trans ): diff -r db4f8befcd89 -r 85e05920bada templates/webapps/community/index.mako --- a/templates/webapps/community/index.mako Fri Apr 30 14:08:23 2010 -0400 +++ b/templates/webapps/community/index.mako Fri Apr 30 15:20:04 2010 -0400 @@ -82,7 +82,9 @@ <div class="toolSectionBg"> <div class="toolTitle"><a target="galaxy_main" href="${h.url_for( controller='tool', action='browse_categories' )}">Browse by category</a></div> <div class="toolTitle"><a target="galaxy_main" href="${h.url_for( controller='tool', action='browse_tools' )}">Browse all tools</a></div> - <div class="toolTitle"><a target="galaxy_main" href="${h.url_for( controller='tool', action='browse_tools_by_user', operation='browse', id=trans.security.encode_id( trans.user.id ) )}">Browse your tools</a></div> + %if trans.user: + <div class="toolTitle"><a target="galaxy_main" href="${h.url_for( controller='tool', action='browse_tools_by_user', operation='browse', id=trans.security.encode_id( trans.user.id ) )}">Browse your tools</a></div> + %endif </div> </div> <div class="toolSectionBody"> diff -r db4f8befcd89 -r 85e05920bada templates/webapps/community/tool/edit_tool.mako --- a/templates/webapps/community/tool/edit_tool.mako Fri Apr 30 14:08:23 2010 -0400 +++ b/templates/webapps/community/tool/edit_tool.mako Fri Apr 30 15:20:04 2010 -0400 @@ -58,7 +58,6 @@ <a id="tool-${tool.id}-popup" class="popup-arrow" style="display: none;">▼</a> <div popupmenu="tool-${tool.id}-popup"> <a class="action-button" href="${h.url_for( controller='common', action='view_tool', id=trans.app.security.encode_id( tool.id ), cntrller=cntrller )}">View information</a> - <a class="action-button" href="${h.url_for( controller='common', action='manage_categories', id=trans.app.security.encode_id( tool.id ), cntrller=cntrller )}">Manage categories</a> <a class="action-button" href="${h.url_for( controller='common', action='upload_new_tool_version', id=trans.app.security.encode_id( tool.id ), cntrller=cntrller )}">Upload a new version</a> <a class="action-button" href="${h.url_for( controller='tool', action='download_tool', id=trans.app.security.encode_id( tool.id ) )}">Download tool</a> </div> diff -r db4f8befcd89 -r 85e05920bada templates/webapps/community/tool/view_tool.mako --- a/templates/webapps/community/tool/view_tool.mako Fri Apr 30 14:08:23 2010 -0400 +++ b/templates/webapps/community/tool/view_tool.mako Fri Apr 30 15:20:04 2010 -0400 @@ -67,7 +67,6 @@ <div popupmenu="tool-${tool.id}-popup"> %if cntrller=='admin' or can_edit: <a class="action-button" href="${h.url_for( controller='common', action='edit_tool', id=trans.app.security.encode_id( tool.id ), cntrller=cntrller )}">Edit information</a> - <a class="action-button" href="${h.url_for( controller='common', action='manage_categories', id=trans.app.security.encode_id( tool.id ), cntrller=cntrller )}">Manage categories</a> <a class="action-button" href="${h.url_for( controller='common', action='upload_new_tool_version', id=trans.app.security.encode_id( tool.id ), cntrller=cntrller )}">Upload a new version</a> %endif <a class="action-button" href="${h.url_for( controller='tool', action='download_tool', id=trans.app.security.encode_id( tool.id ) )}">Download tool</a>
participants (1)
-
Nate Coraor