reply-to-comment view and jquery forms added.
svn path=/plone.app.discussion/trunk/; revision=27127
This commit is contained in:
parent
2b0133aa64
commit
bda70af828
@ -3,6 +3,7 @@
|
|||||||
i18n:domain="plone">
|
i18n:domain="plone">
|
||||||
|
|
||||||
<div class="discussion">
|
<div class="discussion">
|
||||||
|
|
||||||
<tal:getreplies repeat="reply_dict replies">
|
<tal:getreplies repeat="reply_dict replies">
|
||||||
|
|
||||||
<div class="comment"
|
<div class="comment"
|
||||||
@ -31,6 +32,12 @@
|
|||||||
This is the body text of the comment.
|
This is the body text of the comment.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<a href="#" class="reply-to-comment-button" title="reply to this comment"
|
||||||
|
tal:attributes="onclick string:createReplyToCommentForm(${reply/id});
|
||||||
|
id string:reply-to-comment-${reply/id}-button">
|
||||||
|
<img src="++resource++plone.app.discussion.images/reply.gif" />
|
||||||
|
</a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</tal:getreplies>
|
</tal:getreplies>
|
||||||
|
@ -8,8 +8,7 @@ from Acquisition import aq_inner, aq_parent
|
|||||||
from Products.Five.browser import BrowserView
|
from Products.Five.browser import BrowserView
|
||||||
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
|
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
|
||||||
|
|
||||||
from plone.app.discussion.interfaces import IComment
|
from plone.app.discussion.interfaces import IComment, IReplies
|
||||||
|
|
||||||
from plone.app.discussion.conversation import conversationAdapterFactory
|
from plone.app.discussion.conversation import conversationAdapterFactory
|
||||||
|
|
||||||
from plone.app.discussion.comment import CommentFactory
|
from plone.app.discussion.comment import CommentFactory
|
||||||
@ -66,5 +65,36 @@ class AddComment(BrowserView):
|
|||||||
# Add comment to the conversation
|
# Add comment to the conversation
|
||||||
conversation.addComment(comment)
|
conversation.addComment(comment)
|
||||||
|
|
||||||
|
# Redirect to the document object page
|
||||||
|
self.request.response.redirect(aq_parent(aq_inner(self.context)).absolute_url())
|
||||||
|
|
||||||
|
class ReplyToComment(BrowserView):
|
||||||
|
"""Reply to a comment
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __call__(self):
|
||||||
|
|
||||||
|
if self.request.has_key('form.button.AddComment'):
|
||||||
|
|
||||||
|
reply_to_comment_id = self.request.get('form.reply_to_comment_id')
|
||||||
|
subject = self.request.get('subject')
|
||||||
|
text = self.request.get('body_text')
|
||||||
|
|
||||||
|
# The add-comment view is called on the conversation object
|
||||||
|
conversation = self.context
|
||||||
|
|
||||||
|
# Fetch the comment we want to reply to
|
||||||
|
comment_to_reply_to = conversation.get(reply_to_comment_id)
|
||||||
|
|
||||||
|
replies = IReplies(comment_to_reply_to)
|
||||||
|
|
||||||
|
# Create the comment
|
||||||
|
comment = CommentFactory()
|
||||||
|
comment.title = subject
|
||||||
|
comment.text = text
|
||||||
|
|
||||||
|
# Add the reply to the comment
|
||||||
|
new_re_id = replies.addComment(comment)
|
||||||
|
|
||||||
# TODO: Redirect to the document object page
|
# TODO: Redirect to the document object page
|
||||||
self.request.response.redirect(aq_parent(aq_inner(self.context)).absolute_url())
|
self.request.response.redirect(aq_parent(aq_inner(self.context)).absolute_url())
|
||||||
|
@ -27,4 +27,27 @@
|
|||||||
permission="zope2.View"
|
permission="zope2.View"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<!-- reply-to-comment view -->
|
||||||
|
<browser:view
|
||||||
|
name="reply-to-comment"
|
||||||
|
for="plone.app.discussion.interfaces.IConversation"
|
||||||
|
layer="..interfaces.IDiscussionLayer"
|
||||||
|
class=".comments.ReplyToComment"
|
||||||
|
permission="zope2.View"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- Resource directory for javascripts -->
|
||||||
|
<browser:resourceDirectory
|
||||||
|
name="plone.app.discussion.javascripts"
|
||||||
|
directory="javascripts"
|
||||||
|
layer="..interfaces.IDiscussionLayer"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- Resource directory for images -->
|
||||||
|
<browser:resourceDirectory
|
||||||
|
name="plone.app.discussion.images"
|
||||||
|
directory="images"
|
||||||
|
layer="..interfaces.IDiscussionLayer"
|
||||||
|
/>
|
||||||
|
|
||||||
</configure>
|
</configure>
|
||||||
|
Loading…
Reference in New Issue
Block a user