some code clean-up; show description as td title

git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@3050 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2008-12-06 16:42:40 +00:00
parent 3582e85bb4
commit 23b6355386
3 changed files with 37 additions and 18 deletions

View file

@ -166,8 +166,9 @@ Recent changes
>>> data[0].timeStamp >>> data[0].timeStamp
u'... ...:...' u'... ...:...'
>>> data[0].object >>> data[0].objectData
{'url': '', 'object': <loops.resource.Resource ...>, 'title': 'Change Doc 001'} {'url': '', 'version': '', 'object': <loops.resource.Resource ...>,
'title': 'Change Doc 001'}
>>> data[0].user >>> data[0].user
{'url': '', 'object': <loops.concept.Concept ...>, 'title': u'john'} {'url': '', 'object': <loops.concept.Concept ...>, 'title': u'john'}
>>> data[0].action >>> data[0].action

View file

@ -35,16 +35,28 @@
<table class="listing"> <table class="listing">
<tr> <tr>
<th i18n:translate="">Title</th> <th i18n:translate="">Title</th>
<th i18n:translate=""
tal:condition="view/useVersioning">V</th>
<th i18n:translate="">User</th> <th i18n:translate="">User</th>
<th i18n:translate="">Date/Time</th> <th i18n:translate="">Date/Time</th>
<th i18n:translate="">New</th> <th i18n:translate="">New</th>
</tr> </tr>
<tr tal:repeat="row info/data" <tr tal:repeat="row info/data"
tal:attributes="class python: repeat['row'].odd() and 'even' or 'odd'"> tal:attributes="class python: repeat['row'].odd() and 'even' or 'odd'">
<td tal:define="url row/object/url"> <tal:row define="object row/objectData;
<a tal:attributes="href url" url object/url">
tal:omit-tag="not:url" <td tal:attributes="title object/object/description">
tal:content="row/object/title" /></td> <a tal:omit-tag="not:url"
tal:attributes="href string:$url?version=this"
tal:content="object/title" /></td>
<tal:version tal:condition="view/useVersioning">
<td class="center"
tal:define="version object/version">
<a tal:omit-tag="python: version == '1.1'"
tal:attributes="href string:$url?loops.viewName=listversions"
tal:content="version">1.1</a>
</td>
</tal:version>
<td tal:define="url row/user/url"> <td tal:define="url row/user/url">
<a tal:attributes="href url" <a tal:attributes="href url"
tal:omit-tag="not:url" tal:omit-tag="not:url"
@ -52,6 +64,7 @@
<td tal:content="row/timeStamp"></td> <td tal:content="row/timeStamp"></td>
<td class="center" <td class="center"
tal:content="row/markNew"></td> tal:content="row/markNew"></td>
</tal:row>
</tr> </tr>
</table> </table>
</metal:recent> </metal:recent>

View file

@ -36,6 +36,7 @@ from loops.browser.common import BaseView
from loops.interfaces import IResource from loops.interfaces import IResource
from loops import util from loops import util
from loops.util import _ from loops.util import _
from loops.versioning.interfaces import IVersionable
report_macros = ViewPageTemplateFile('report.pt') report_macros = ViewPageTemplateFile('report.pt')
@ -142,7 +143,7 @@ class RecentChanges(TrackingStats):
if track.data['action'] == 'add' and track.taskId not in new: if track.data['action'] == 'add' and track.taskId not in new:
sameChanged = changed.get(track.taskId) sameChanged = changed.get(track.taskId)
if sameChanged and sameChanged.timeStamp < track.timeStamp + 60: if sameChanged and sameChanged.timeStamp < track.timeStamp + 60:
# change immediate after creation # skip change immediate after creation
if result[-1].taskId == track.taskId: if result[-1].taskId == track.taskId:
result.pop() result.pop()
new[track.taskId] = track new[track.taskId] = track
@ -170,12 +171,16 @@ class TrackDetails(object):
@Lazy @Lazy
def object(self): def object(self):
obj = util.getObjectForUid(self.track.taskId) return util.getObjectForUid(self.track.taskId)
@Lazy
def objectData(self):
obj = self.object
node = self.view.nodeView node = self.view.nodeView
url = node is not None and node.getUrlForTarget(obj) or '' url = node is not None and node.getUrlForTarget(obj) or ''
if url: versionable = IVersionable(self.object, None)
url = url + '?version=this' version = versionable is not None and versionable.versionId or ''
return dict(object=obj, title=obj.title, url=url) return dict(object=obj, title=obj.title, url=url, version=version)
@Lazy @Lazy
def user(self): def user(self):