From 68665b6f2b9cb96f958a7f628e01e38b3daedd23 Mon Sep 17 00:00:00 2001 From: vangheem Date: Sat, 30 May 2015 11:45:02 -0500 Subject: [PATCH 1/3] Only use edit overlay if available for editing comments. We will need a plone 5 alternative --- CHANGES.rst | 3 ++- .../app/discussion/browser/javascripts/comments.js | 14 ++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 41afb28..03e8de3 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,7 +4,8 @@ Changelog 2.4.3 (unreleased) ------------------ -- Nothing changed yet. +- Only use edit overlay if available for editing comments + [vangheem] 2.4.2 (2015-05-04) diff --git a/plone/app/discussion/browser/javascripts/comments.js b/plone/app/discussion/browser/javascripts/comments.js index 0b56d51..32eb30a 100644 --- a/plone/app/discussion/browser/javascripts/comments.js +++ b/plone/app/discussion/browser/javascripts/comments.js @@ -189,12 +189,14 @@ require([ // jshint ignore:line /********************************************************************** * Edit a comment **********************************************************************/ - $('form[name="edit"]').prepOverlay({ - cssclass: 'overlay-edit-comment', - width: '60%', - subtype: 'ajax', - filter: '#content>*' - }); + if($.fn.prepOverlay){ + $('form[name="edit"]').prepOverlay({ + cssclass: 'overlay-edit-comment', + width: '60%', + subtype: 'ajax', + filter: '#content>*' + }); + } /********************************************************************** * Delete a comment and its answers. From e2192e59737e8b201d6c21e87fdaea58476d3675 Mon Sep 17 00:00:00 2001 From: vangheem Date: Sat, 30 May 2015 15:20:32 -0500 Subject: [PATCH 2/3] use modal pattern for comment edit --- plone/app/discussion/browser/comments.pt | 36 +++++++++++++++--------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/plone/app/discussion/browser/comments.pt b/plone/app/discussion/browser/comments.pt index 8e69b15..03c3a79 100644 --- a/plone/app/discussion/browser/comments.pt +++ b/plone/app/discussion/browser/comments.pt @@ -9,7 +9,8 @@ has_replies python:view.has_replies(canReview); showCommenterImage view/show_commenter_image; 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" i18n:domain="plone"> @@ -115,19 +116,26 @@ /> -
- -
+ + + Edit +
+ +
+
From 4bd649e021cf5ab4cc4690d5ee055a90ea77356d Mon Sep 17 00:00:00 2001 From: vangheem Date: Sat, 30 May 2015 19:28:22 -0500 Subject: [PATCH 3/3] fix test --- .../discussion/tests/functional_test_comments.txt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/plone/app/discussion/tests/functional_test_comments.txt b/plone/app/discussion/tests/functional_test_comments.txt index 1d85365..56b8736 100644 --- a/plone/app/discussion/tests/functional_test_comments.txt +++ b/plone/app/discussion/tests/functional_test_comments.txt @@ -269,14 +269,15 @@ Use the Plone control panel to enable comment editing. Extract the edit comment url from the first "edit comment" button + >>> from Products.CMFPlone import __version__ >>> browser.open(urldoc1) - >>> form = browser.getForm(name='edit', index=0) - >>> '@@edit-comment' in form.action + >>> url = __version__[0] == '5' and browser.getLink(url='@@edit-comment').url or browser.getForm(name='edit', index=0).action + >>> '@@edit-comment' in url True Open the edit comment view - >>> browser.open(form.action) + >>> browser.open(url) >>> ctrl = browser.getControl('Comment') >>> ctrl.value 'Comment from admin' @@ -298,10 +299,10 @@ Check it ain't so. Opening the edit comment view, then cancel, does nothing. - >>> form = browser.getForm(name='edit', index=0) - >>> '@@edit-comment' in form.action + >>> url = __version__[0] == '5' and browser.getLink(url='@@edit-comment').url or browser.getForm(name='edit', index=0).action + >>> '@@edit-comment' in url True - >>> browser.open(form.action) + >>> browser.open(url) >>> browser.getControl('Cancel').click() >>> browser.url.startswith('http://nohost/plone/doc1') True