Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement pat contentbrowser #470

Merged
merged 5 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/461.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use pat-contentbrowser as default widget for add translation form [@1letter]
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"plone.rfc822",
"plone.testing",
"robotsuite",
"Products.CMFPlacefulWorkflow",
],
},
entry_points="""
Expand Down
4 changes: 2 additions & 2 deletions src/plone/app/multilingual/browser/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -98,7 +98,7 @@ class IConnectTranslation(model.Schema):
)
directives.widget(
"content",
RelatedItemsFieldWidget,
ContentBrowserFieldWidget,
pattern_options={
"basePath": make_relation_root_path,
},
Expand Down
19 changes: 15 additions & 4 deletions src/plone/app/multilingual/tests/robot/test_add_translation.robot
Original file line number Diff line number Diff line change
Expand Up @@ -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"]//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']
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
Expand All @@ -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