From 9227f3d37a43d0735ff408130b6b574f19e76588 Mon Sep 17 00:00:00 2001 From: 1letter <1letter@gmx.de> Date: Mon, 21 Oct 2024 21:01:47 +0200 Subject: [PATCH 1/5] switch to pat-contentbrowser widget in IConnectTranslation --- src/plone/app/multilingual/browser/interfaces.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plone/app/multilingual/browser/interfaces.py b/src/plone/app/multilingual/browser/interfaces.py index 8977a0e3..7190d911 100644 --- a/src/plone/app/multilingual/browser/interfaces.py +++ b/src/plone/app/multilingual/browser/interfaces.py @@ -2,7 +2,7 @@ from plone.app.multilingual import _ from plone.app.multilingual.browser.vocabularies import untranslated_languages from plone.app.multilingual.interfaces import ITranslationManager -from plone.app.z3cform.widget import RelatedItemsFieldWidget +from plone.app.z3cform.widgets.contentbrowser import ContentBrowserFieldWidget from plone.autoform import directives from plone.autoform.interfaces import IFormFieldProvider from plone.base.interfaces import IPloneSiteRoot @@ -98,7 +98,7 @@ class IConnectTranslation(model.Schema): ) directives.widget( "content", - RelatedItemsFieldWidget, + ContentBrowserFieldWidget, pattern_options={ "basePath": make_relation_root_path, }, From 5a56ab2d7849095d230226528a9967b95ae29220 Mon Sep 17 00:00:00 2001 From: 1letter <1letter@gmx.de> Date: Mon, 21 Oct 2024 21:02:13 +0200 Subject: [PATCH 2/5] Update robottest to check the pat-contentbrowser --- .../tests/robot/test_add_translation.robot | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/plone/app/multilingual/tests/robot/test_add_translation.robot b/src/plone/app/multilingual/tests/robot/test_add_translation.robot index 236a49dd..f75ade04 100644 --- a/src/plone/app/multilingual/tests/robot/test_add_translation.robot +++ b/src/plone/app/multilingual/tests/robot/test_add_translation.robot @@ -46,10 +46,10 @@ I link the document in English as a translation Get Element States //a[@id="_modify_translations"] contains visible Click //a[@id="_modify_translations"] Click //table[@id="translations-overview"]/tbody/tr[1]/td[3]/a[contains(@class,"connectTranslationAction")] - Click //div[@id="formfield-form-widgets-content"]//div[contains(@class,"pat-relateditems-container")]//button[contains(@class,"mode") and contains(@class,"search")] - Type Text //div[@id="formfield-form-widgets-content"]//input[contains(@class,"select2-input")] en - Click //span[contains(., 'An English Document')] - Click //*[contains(@class, 'modal-footer')]//button[@id='form-buttons-connect_translation'] + Click //div[@id="formfield-form-widgets-content"]//div[@class="content-browser-wrapper"]//button[contains(text(),"Select")] + Click item in column 2 2 + Click //div[contains(@class, "content-browser-wrapper")]//div[contains(@class, "levelColumns")]/div[contains(@class, "preview")]/div[contains(@class, "levelToolbar")]/button + Click //*[contains(@class, 'modal-footer')]//button[@name='form.buttons.connect_translation'] Get Text //table[@id="translations-overview"]/tbody/tr[1]/td[2]/h3[@class="translationTitle"] should be An English Document Click //table[@id="translations-overview"]//a[contains(text(),'/plone/ca/a-catalan-document')] Get Text //*[@id="content"]/header/h1 should be A Catalan Document @@ -63,3 +63,14 @@ I switch to English I can view the document in English Get Element //h1[1][contains(text(),'English Document')] Get Element //ul[@id='portal-languageselector']/li[contains(@class, 'currentLanguage')]/a[@title='English'] + + +# DRY + +Click item in column + [arguments] ${colnumber} ${itemposition} + Click //div[contains(@class, "content-browser-wrapper")]//div[contains(@class, "levelColumns")]/div[${colnumber}]/div[contains(@class, "levelItems")]/div[${itemposition}] + +Pause + Import library Dialogs + Pause execution \ No newline at end of file From 240e2bf014f3d79ff7b8a2286f302618b8787ac2 Mon Sep 17 00:00:00 2001 From: 1letter <1letter@gmx.de> Date: Mon, 21 Oct 2024 21:02:19 +0200 Subject: [PATCH 3/5] add news --- news/461.feature | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/461.feature diff --git a/news/461.feature b/news/461.feature new file mode 100644 index 00000000..6e24cb94 --- /dev/null +++ b/news/461.feature @@ -0,0 +1 @@ +use pat-contentbrowser as default widget for add translation form [@1letter] From b85dac4de570e7a94b4a4f9ae0531c9270c19098 Mon Sep 17 00:00:00 2001 From: 1letter <1letter@gmx.de> Date: Mon, 21 Oct 2024 22:13:48 +0200 Subject: [PATCH 4/5] Update config --- pyproject.toml | 2 +- setup.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 762cf44b..e8239a22 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -120,7 +120,7 @@ Zope = [ ] python-dateutil = ['dateutil'] pytest-plone = ['pytest', 'zope.pytestlayer', 'plone.testing', 'plone.app.testing'] -ignore-packages = ['Products.LinguaPlone'] +ignore-packages = ['Products.LinguaPlone', 'Products.CMFPlacefulWorkflow'] ## # Add extra configuration options in .meta.toml: diff --git a/setup.py b/setup.py index fa6db140..179e0022 100644 --- a/setup.py +++ b/setup.py @@ -62,6 +62,7 @@ "plone.rfc822", "plone.testing", "robotsuite", + "Products.CMFPlacefulWorkflow", ], }, entry_points=""" From 348aaeae4b9ba1a8d110ad4d86dba18b4b3ffbd1 Mon Sep 17 00:00:00 2001 From: 1letter <1letter@gmx.de> Date: Thu, 7 Nov 2024 12:43:37 +0100 Subject: [PATCH 5/5] fix robot test --- .../app/multilingual/tests/robot/test_add_translation.robot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plone/app/multilingual/tests/robot/test_add_translation.robot b/src/plone/app/multilingual/tests/robot/test_add_translation.robot index f75ade04..66d592b2 100644 --- a/src/plone/app/multilingual/tests/robot/test_add_translation.robot +++ b/src/plone/app/multilingual/tests/robot/test_add_translation.robot @@ -46,7 +46,7 @@ I link the document in English as a translation Get Element States //a[@id="_modify_translations"] contains visible Click //a[@id="_modify_translations"] Click //table[@id="translations-overview"]/tbody/tr[1]/td[3]/a[contains(@class,"connectTranslationAction")] - Click //div[@id="formfield-form-widgets-content"]//div[@class="content-browser-wrapper"]//button[contains(text(),"Select")] + Click //div[@id="formfield-form-widgets-content"]//div[@class="content-browser-wrapper"]//a[contains(text(),"Select")] Click item in column 2 2 Click //div[contains(@class, "content-browser-wrapper")]//div[contains(@class, "levelColumns")]/div[contains(@class, "preview")]/div[contains(@class, "levelToolbar")]/button Click //*[contains(@class, 'modal-footer')]//button[@name='form.buttons.connect_translation']