plone.app.discussion/plone/app/discussion/browser/comments.pt

242 lines
12 KiB
Plaintext
Raw Permalink Normal View History

<tal:block tal:define="userHasReplyPermission view/can_reply;
isDiscussionAllowed view/is_discussion_allowed;
isAnonymousDiscussionAllowed view/anonymous_discussion_allowed;
2013-09-17 14:03:46 +02:00
isEditCommentAllowed view/edit_comment_allowed;
isDeleteOwnCommentAllowed view/delete_own_comment_allowed;
isAnon view/is_anonymous;
canReview view/can_review;
replies python:view.get_replies(canReview);
has_replies python:view.has_replies(canReview);
showCommenterImage view/show_commenter_image;
errors options/state/getErrors|nothing;
2015-05-30 22:20:32 +02:00
wtool context/@@plone_tools/workflow;
auth_token context/@@authenticator/token|nothing"
tal:condition="python:isDiscussionAllowed or has_replies"
i18n:domain="plone">
<div class="pat-discussion">
<div class="reply"
tal:condition="python:isAnon and not isAnonymousDiscussionAllowed">
<form tal:attributes="action view/login_action">
<button class="btn btn-primary mb-3"
type="submit"
value="Log in to add comments"
i18n:attributes="value label_login_to_add_comments;"
i18n:translate="label_login_to_add_comments">Log in to add comments</button>
</form>
</div>
<div class="discussion"
tal:condition="has_replies">
<tal:getreplies repeat="reply_dict replies">
<div class="comment"
tal:define="reply reply_dict/comment;
comment_id reply/getId;
depth reply_dict/depth|python:0;
depth python: depth > 10 and '10' or depth;
author_home_url python:view.get_commenter_home_url(username=reply.author_username);
has_author_link python:author_home_url and not isAnon;
portrait_url python:view.get_commenter_portrait(reply.author_username);
review_state python:wtool.getInfoFor(reply, 'review_state', 'none');
canEdit python:view.can_edit(reply);
canDelete python:view.can_delete(reply);
colorclass python:lambda x: 'state-private' if x=='rejected' else ('state-internal' if x=='spam' else 'state-'+x);"
tal:attributes="class python:'comment level-{depth} {state}'.format(depth= depth, state=colorclass(review_state));
id comment_id"
tal:condition="python:canReview or review_state == 'published'">
<div class="d-flex flex-row align-items-center mb-3">
<!-- commenter image -->
<div class="comment-image me-3"
tal:condition="showCommenterImage">
<a href=""
tal:condition="has_author_link"
tal:attributes="href author_home_url">
<img src="defaultUser.png"
alt=""
tal:attributes="src portrait_url; alt reply/author_name" />
</a>
<img src="defaultUser.png"
alt=""
tal:condition="not: has_author_link"
tal:attributes="src portrait_url; alt reply/author_name" />
</div>
<!-- commenter name and date -->
<div class="comment-author">
2021-02-15 17:06:49 +01:00
<a href=""
tal:condition="has_author_link"
tal:attributes="href author_home_url">${reply/author_name}</a>
2021-02-15 17:06:49 +01:00
<span tal:condition="not: has_author_link">${reply/author_name}</span>
2021-02-15 17:06:49 +01:00
<span tal:condition="not: reply/author_name"
i18n:translate="label_anonymous">Anonymous</span>
2021-02-15 17:06:49 +01:00
<br />
2021-02-15 17:06:49 +01:00
<small class="text-muted"
tal:content="python:view.format_time(reply.modification_date)">
2021-02-15 17:06:49 +01:00
8/23/2001 12:40:44 PM
</small>
2021-02-15 17:06:49 +01:00
</div>
</div>
2021-02-15 17:06:49 +01:00
<!-- comment body -->
<div class="comment-body">
2021-02-15 17:06:49 +01:00
<span tal:replace="structure reply/getText" />
2021-02-15 17:06:49 +01:00
<!-- comment actions -->
<div class="d-flex flex-row justify-content-end mb-3">
2021-02-15 17:06:49 +01:00
<div class="comment-actions actions-edit"
tal:condition="python:isEditCommentAllowed and canEdit">
2021-02-15 17:06:49 +01:00
<!-- edit -->
<a class="pat-plone-modal context comment-action action-edit btn btn-primary btn-sm"
tal:condition="auth_token"
tal:attributes="href string:${reply/absolute_url}/@@edit-comment?_authenticator=${auth_token}"
i18n:translate="Edit">Edit</a>
2021-02-15 17:06:49 +01:00
<form name="edit"
action=""
method="get"
class="comment-action action-edit"
tal:condition="not: auth_token"
tal:attributes="action string:${reply/absolute_url}/@@edit-comment;
2021-02-15 17:06:49 +01:00
id string:edit-${comment_id}">
<button name="form.button.EditComment"
class="context btn btn-primary btn-sm"
type="submit"
value="Edit"
i18n:attributes="value label_edit;"
i18n:translate="label_edit">Edit</button>
2021-02-15 17:06:49 +01:00
</form>
2021-02-15 17:06:49 +01:00
</div>
2021-02-15 17:06:49 +01:00
<div class="comment-actions actions-delete"
tal:condition="python:canDelete">
2021-02-15 17:06:49 +01:00
<!-- delete own comment -->
<form name="delete"
action=""
method="post"
class="comment-action action-delete"
tal:condition="python:not canDelete and isDeleteOwnCommentAllowed and view.could_delete_own(reply)"
tal:attributes="action string:${reply/absolute_url}/@@delete-own-comment;
style python:view.can_delete_own(reply) and 'display: inline' or 'display: none';
id string:delete-${comment_id}">
<button name="form.button.DeleteComment"
2021-02-15 17:06:49 +01:00
class="destructive btn btn-danger btn-sm"
type="submit"
value="Delete"
i18n:attributes="value label_delete;"
i18n:translate="label_delete">Delete</button>
</form>
<!-- delete -->
<form name="delete"
action=""
method="post"
class="comment-action action-delete"
tal:condition="python:canDelete"
tal:attributes="action string:${reply/absolute_url}/@@moderate-delete-comment;
id string:delete-${comment_id}">
<button name="form.button.DeleteComment"
2021-02-15 17:06:49 +01:00
class="destructive btn btn-danger btn-sm"
type="submit"
value="Delete"
i18n:attributes="value label_delete;"
i18n:translate="label_delete">Delete</button>
</form>
</div>
<div class="comment-actions actions-workflow d-flex flex-row"
tal:condition="reply_dict/actions|nothing">
<form name=""
action=""
method="get"
class="comment-action action-${action/id}"
tal:condition="canReview"
tal:repeat="action reply_dict/actions|nothing"
tal:attributes="action string:${reply/absolute_url}/@@transmit-comment;
name action/id;
2021-02-15 17:06:49 +01:00
id string:${action/id}-${comment_id};
">
<input type="hidden"
name="workflow_action"
tal:attributes="value action/id" />
<button name="form.button.TransmitComment"
2021-02-15 17:06:49 +01:00
class="context btn btn-primary btn-sm"
type="submit"
i18n:translate="">${action/title}</button>
</form>
2021-02-15 17:06:49 +01:00
</div>
2021-02-15 17:06:49 +01:00
</div>
<!-- end comment actions -->
</div>
<button class="context reply-to-comment-button hide allowMultiSubmit btn btn-primary btn-sm"
2021-02-15 17:06:49 +01:00
tal:condition="python:isDiscussionAllowed and (isAnon and isAnonymousDiscussionAllowed or userHasReplyPermission)"
i18n:translate="label_reply">
Reply
</button>
2021-02-15 17:06:49 +01:00
</div>
</tal:getreplies>
2012-01-25 15:55:36 +01:00
<div tal:condition="python: has_replies and not isDiscussionAllowed"
class="discreet"
i18n:translate="label_commenting_disabled">
Commenting has been disabled.
</div>
2012-01-25 15:55:36 +01:00
</div>
<div class="reply"
tal:condition="python:has_replies and (isAnon and not isAnonymousDiscussionAllowed)">
<form tal:attributes="action view/login_action"
class="mb-3">
<button class="standalone loginbutton btn btn-primary"
type="submit"
value="Log in to add comments"
i18n:attributes="value label_login_to_add_comments;"
i18n:translate="label_login_to_add_comments">Log in to add comments</button>
</form>
</div>
2012-01-25 15:55:36 +01:00
<div id="commenting"
class="reply border p-3"
tal:condition="python:isDiscussionAllowed and (isAnon and isAnonymousDiscussionAllowed or userHasReplyPermission)">
<fieldset>
<legend i18n:translate="label_add_comment">Add comment</legend>
2021-02-15 17:06:49 +01:00
<p tal:content="view/comment_transform_message">
You can add a comment by filling out the form below. Plain text
formatting.
</p>
<div tal:replace="structure view/form/render" />
</fieldset>
</div>
</div>
</tal:block>