show comment state for admin user
This commit is contained in:
parent
e0f30d7a96
commit
61cfff0f91
2 changed files with 17 additions and 0 deletions
|
@ -23,6 +23,7 @@ Definition of view classes and other browser related stuff for comments.
|
|||
from zope import interface, component
|
||||
from zope.app.pagetemplate import ViewPageTemplateFile
|
||||
from zope.cachedescriptors.property import Lazy
|
||||
from zope.security import checkPermission
|
||||
|
||||
from cybertools.browser.action import actions
|
||||
from cybertools.tracking.btree import TrackingStorage
|
||||
|
@ -32,6 +33,7 @@ from loops.browser.form import ObjectForm, EditObject
|
|||
from loops.browser.node import NodeView
|
||||
from loops.organize.comment.base import Comment
|
||||
from loops.organize.party import getPersonForUser
|
||||
from loops.organize.stateful.browser import StateAction
|
||||
from loops.organize.tracking.report import TrackDetails
|
||||
from loops.security.common import canAccessObject
|
||||
from loops.setup import addObject
|
||||
|
@ -83,6 +85,14 @@ class CommentsView(NodeView):
|
|||
result.append(CommentDetails(self, tr))
|
||||
return result
|
||||
|
||||
def getActionsFor(self, comment):
|
||||
if not checkPermission('loops.ViewRestricted', self.context):
|
||||
return []
|
||||
stateAct = StateAction(self,
|
||||
definition='organize.commentStates',
|
||||
stateful=comment.track)
|
||||
return [stateAct]
|
||||
|
||||
|
||||
class CommentDetails(TrackDetails):
|
||||
|
||||
|
|
|
@ -14,6 +14,13 @@
|
|||
<tal:comment tal:repeat="comment items">
|
||||
<br />
|
||||
<div class="comment">
|
||||
<div class="object-actions"
|
||||
tal:define="actions python:comments.getActionsFor(comment)"
|
||||
tal:condition="actions">
|
||||
<tal:actions repeat="action actions">
|
||||
<metal:action use-macro="action/macro" />
|
||||
</tal:actions>
|
||||
</div>
|
||||
<h3>
|
||||
<span tal:content="comment/subject">Subject</span></h3>
|
||||
<div class="info">
|
||||
|
|
Loading…
Add table
Reference in a new issue