diff -r a94f92bb4839 -r 4a7679f7f16c src/pyams_content/shared/common/zmi/review.py --- a/src/pyams_content/shared/common/zmi/review.py Fri Sep 29 16:23:09 2017 +0200 +++ b/src/pyams_content/shared/common/zmi/review.py Mon Oct 02 14:43:28 2017 +0200 @@ -21,7 +21,7 @@ from pyams_content.shared.common.interfaces import IWfSharedContent from pyams_security.interfaces import ISecurityManager from pyams_security.interfaces.profile import IPublicProfile -from pyams_skin.interfaces.viewlet import IContextActions +from pyams_skin.interfaces.viewlet import IContextActions, IWidgetTitleViewletManager from pyams_skin.layer import IPyAMSLayer from pyams_zmi.interfaces.menu import IContentManagementMenu from pyams_zmi.layer import IAdminLayer @@ -34,9 +34,9 @@ from pyams_pagelet.pagelet import pagelet_config from pyams_security.schema import PrincipalsSet from pyams_skin.viewlet.menu import MenuItem -from pyams_skin.viewlet.toolbar import ToolbarMenuItem +from pyams_skin.viewlet.toolbar import ToolbarMenuItem, JsToolbarAction from pyams_template.template import template_config, get_view_template -from pyams_utils.date import get_age +from pyams_utils.date import get_age, format_datetime from pyams_utils.registry import get_utility, query_utility from pyams_viewlet.viewlet import viewlet_config from pyams_zmi.form import AdminDialogAddForm @@ -192,10 +192,23 @@ def get_avatar(self, principal): return IPublicProfile(principal).avatar + def get_date(self, comment): + return format_datetime(comment.creation_date) + def get_age(self, comment): return get_age(comment.creation_date) +@viewlet_config(name='add-review-comment.action', context=IWfSharedContent, layer=IAdminLayer, + view=SharedContentReviewCommentsView, manager=IWidgetTitleViewletManager, + permission=COMMENT_CONTENT_PERMISSION) +class SharedContentReviewAddCommentAction(JsToolbarAction): + """Shared content review add comment action""" + + label = _("Add comment...") + url = 'PyAMS_content.review.addCommentAction' + + @view_config(name='get-last-review-comments.json', context=IWfSharedContent, request_type=IPyAMSLayer, permission=COMMENT_CONTENT_PERMISSION, renderer='json', xhr=True) @template_config(template='templates/review-comments-json.pt')