[hg] galaxy 2542: Grid: Age -> Created, for dates further than a...
details: http://www.bx.psu.edu/hg/galaxy/rev/5e608f42dc88 changeset: 2542:5e608f42dc88 user: Kanwei Li <kanwei@gmail.com> date: Mon Aug 03 18:57:13 2009 -0400 description: Grid: Age -> Created, for dates further than a week ago, display actual date 2 file(s) affected in this change: lib/galaxy/web/controllers/history.py lib/galaxy/web/framework/helpers/__init__.py diffs (36 lines): diff -r 5003b7d10ff5 -r 5e608f42dc88 lib/galaxy/web/controllers/history.py --- a/lib/galaxy/web/controllers/history.py Mon Aug 03 17:35:44 2009 -0400 +++ b/lib/galaxy/web/controllers/history.py Mon Aug 03 18:57:13 2009 -0400 @@ -47,8 +47,8 @@ attach_popup=True ), DatasetsByStateColumn( "Datasets (by state)", ncells=4 ), StatusColumn( "Status", attach_popup=False ), - grids.GridColumn( "Age", key="create_time", format=time_ago ), - grids.GridColumn( "Last update", key="update_time", format=time_ago ), + grids.GridColumn( "Created", key="create_time", format=time_ago ), + grids.GridColumn( "Last Updated", key="update_time", format=time_ago ), # Valid for filtering but invisible grids.GridColumn( "Deleted", key="deleted", visible=False ) ] diff -r 5003b7d10ff5 -r 5e608f42dc88 lib/galaxy/web/framework/helpers/__init__.py --- a/lib/galaxy/web/framework/helpers/__init__.py Mon Aug 03 17:35:44 2009 -0400 +++ b/lib/galaxy/web/framework/helpers/__init__.py Mon Aug 03 18:57:13 2009 -0400 @@ -3,10 +3,16 @@ pkg_resources.require( "WebHelpers" ) from webhelpers import * -from datetime import datetime +from datetime import datetime, timedelta +# If the date is more than one week ago, then display the actual date instead of in words def time_ago( x ): - return date.distance_of_time_in_words( x, datetime.utcnow() ) + delta = timedelta(weeks=1) + + if (datetime.utcnow() - x) > delta: # Greater than a week difference + return x.strftime("%b %d, %Y") + else: + return date.distance_of_time_in_words( x, datetime.utcnow() ) + " ago" def iff( a, b, c ): if a:
participants (1)
-
Greg Von Kuster