Merge branch 'master' of https://github.com/plone-ve/plone.app.discussion
This commit is contained in:
commit
71bb802118
@ -4,7 +4,8 @@ Changelog
|
|||||||
2.4.3 (unreleased)
|
2.4.3 (unreleased)
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
- Nothing changed yet.
|
- Only use edit overlay if available for editing comments
|
||||||
|
[vangheem]
|
||||||
|
|
||||||
|
|
||||||
2.4.2 (2015-05-04)
|
2.4.2 (2015-05-04)
|
||||||
|
@ -9,7 +9,8 @@
|
|||||||
has_replies python:view.has_replies(canReview);
|
has_replies python:view.has_replies(canReview);
|
||||||
showCommenterImage view/show_commenter_image;
|
showCommenterImage view/show_commenter_image;
|
||||||
errors options/state/getErrors|nothing;
|
errors options/state/getErrors|nothing;
|
||||||
wtool context/@@plone_tools/workflow;"
|
wtool context/@@plone_tools/workflow;
|
||||||
|
auth_token context/@@authenticator/token|nothing"
|
||||||
tal:condition="python:isDiscussionAllowed or has_replies"
|
tal:condition="python:isDiscussionAllowed or has_replies"
|
||||||
i18n:domain="plone">
|
i18n:domain="plone">
|
||||||
|
|
||||||
@ -115,11 +116,17 @@
|
|||||||
/>
|
/>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<tal:edit tal:condition="python:isEditCommentAllowed and canEdit">
|
||||||
|
<!-- plone 5 will have auth_token available
|
||||||
|
so we'll use modal pattern -->
|
||||||
|
<a class="commentactionsform pat-plone-modal"
|
||||||
|
tal:condition="auth_token"
|
||||||
|
tal:attributes="href string:${reply/absolute_url}/@@edit-comment?_authenticator=${auth_token}">Edit</a>
|
||||||
<form name="edit"
|
<form name="edit"
|
||||||
action=""
|
action=""
|
||||||
method="get"
|
method="get"
|
||||||
class="commentactionsform"
|
class="commentactionsform"
|
||||||
tal:condition="python:isEditCommentAllowed and canEdit"
|
tal:condition="not: auth_token"
|
||||||
tal:attributes="action string:${reply/absolute_url}/@@edit-comment">
|
tal:attributes="action string:${reply/absolute_url}/@@edit-comment">
|
||||||
<input name="form.button.EditComment"
|
<input name="form.button.EditComment"
|
||||||
class="context"
|
class="context"
|
||||||
@ -128,6 +135,7 @@
|
|||||||
i18n:attributes="value label_edit;"
|
i18n:attributes="value label_edit;"
|
||||||
/>
|
/>
|
||||||
</form>
|
</form>
|
||||||
|
</tal:edit>
|
||||||
|
|
||||||
|
|
||||||
<!-- Workflow actions (e.g. 'publish') -->
|
<!-- Workflow actions (e.g. 'publish') -->
|
||||||
|
@ -189,12 +189,14 @@ require([ // jshint ignore:line
|
|||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* Edit a comment
|
* Edit a comment
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
if($.fn.prepOverlay){
|
||||||
$('form[name="edit"]').prepOverlay({
|
$('form[name="edit"]').prepOverlay({
|
||||||
cssclass: 'overlay-edit-comment',
|
cssclass: 'overlay-edit-comment',
|
||||||
width: '60%',
|
width: '60%',
|
||||||
subtype: 'ajax',
|
subtype: 'ajax',
|
||||||
filter: '#content>*'
|
filter: '#content>*'
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* Delete a comment and its answers.
|
* Delete a comment and its answers.
|
||||||
|
@ -269,14 +269,15 @@ Use the Plone control panel to enable comment editing.
|
|||||||
|
|
||||||
Extract the edit comment url from the first "edit comment" button
|
Extract the edit comment url from the first "edit comment" button
|
||||||
|
|
||||||
|
>>> from Products.CMFPlone import __version__
|
||||||
>>> browser.open(urldoc1)
|
>>> browser.open(urldoc1)
|
||||||
>>> form = browser.getForm(name='edit', index=0)
|
>>> url = __version__[0] == '5' and browser.getLink(url='@@edit-comment').url or browser.getForm(name='edit', index=0).action
|
||||||
>>> '@@edit-comment' in form.action
|
>>> '@@edit-comment' in url
|
||||||
True
|
True
|
||||||
|
|
||||||
Open the edit comment view
|
Open the edit comment view
|
||||||
|
|
||||||
>>> browser.open(form.action)
|
>>> browser.open(url)
|
||||||
>>> ctrl = browser.getControl('Comment')
|
>>> ctrl = browser.getControl('Comment')
|
||||||
>>> ctrl.value
|
>>> ctrl.value
|
||||||
'Comment from admin'
|
'Comment from admin'
|
||||||
@ -298,10 +299,10 @@ Check it ain't so.
|
|||||||
|
|
||||||
Opening the edit comment view, then cancel, does nothing.
|
Opening the edit comment view, then cancel, does nothing.
|
||||||
|
|
||||||
>>> form = browser.getForm(name='edit', index=0)
|
>>> url = __version__[0] == '5' and browser.getLink(url='@@edit-comment').url or browser.getForm(name='edit', index=0).action
|
||||||
>>> '@@edit-comment' in form.action
|
>>> '@@edit-comment' in url
|
||||||
True
|
True
|
||||||
>>> browser.open(form.action)
|
>>> browser.open(url)
|
||||||
>>> browser.getControl('Cancel').click()
|
>>> browser.getControl('Cancel').click()
|
||||||
>>> browser.url.startswith('http://nohost/plone/doc1')
|
>>> browser.url.startswith('http://nohost/plone/doc1')
|
||||||
True
|
True
|
||||||
|
Loading…
Reference in New Issue
Block a user