-
Notifications
You must be signed in to change notification settings - Fork 3
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
Error while rendering plone.belowcontenttitle.contents when adding a Link or a File inside a nitf content and plone.app.contenttypes is installed #228
Comments
I think 2 above is the best approach.
<browser:viewlet
for="collective.nitf.content.INITF"
name="plone.belowcontenttitle.contents"
manager="plone.app.layout.viewlets.interfaces.IBelowContentBody"
class=".NITFBelowContentTitleContents"
view="plone.app.layout.globals.interfaces.IViewView"
permission="zope2.View"
/> This new class inherit class NITFBelowContentTitleContents(ContentRelatedItems):
def related_items(self):
catalog = api.portal.get_tool('portal_catalog')
path = '/'.join(self.context.getPhysicalPath())
brains = catalog(
Type=['Link', 'File'], path=path, sort_on='getObjPositionInParent',
)
return brains This way, we fix The disadvantage is that it may break some very specific layouts since the markup changed. But since it isn't working in the first pĺace if you have What do you think, @rodfersou and @hvelarde ? In a nutshell, we show "related items" but limited to the nitf children excluding images. |
Understand, agree with the changes. @agnogueira are we still using those layouts? Do you see any problem? |
@idgserpro I don't get it: the items inside the news article are not related items. |
I inferred the proposal from the comment on the original code If you don't want this approach, we can try to keep what's right now on the viewlet, but we need a way to have |
If I understand correctly you have a different use case that is not Plone default. So you should add a patch or override template into |
There's no different use case. What we did was show alternatives to fix the problem and based on comments around the code (like If you don't like the alternatives, we would like to know what you think that should be done to fix the problem. |
Okay, I didn't understand right than ;-) Really don't have a clue on how it should be fixed (sorry). |
Do a collective.nitf checkout. Add plone.app.contenttypes and bootstrap the project, creating a Plone Site. Add a nitf content and an image and a pdf and a Link inside the nitf. When rendering the nitf view, you get:
Error while rendering plone.belowcontenttitle.contents
And the traceback:
In
collective.nitf/src/collective/nitf/browser/templates/nitf_contents.pt
Line 4 in 729a624
But the snippet that works is from plone/app/dexterity/browser/container.pt:
But when using it,
contentFilter python:{'portal_type': ['File', 'Link']}"
doesn't work anymore and now all images of a nitf content are being shown as related when only Link and File should be.In the top of
collective.nitf/src/collective/nitf/browser/templates/nitf_contents.pt
Line 4 in 729a624
TODO: Fix format; see: plone/app/layout/viewlets/document_relateditems.pt
. So, the question is:plone/app/dexterity/browser/container.pt
, and read the documentation/source code to see if somehow it's possible to have a similarcontentFilter
functionality?TODO
and copy what's in https://github.com/plone/plone.app.layout/blob/66defc53c59426a45adde215f8d8c17e11c592db/plone/app/layout/viewlets/document_relateditems.pt or even create a new viewlet class forplone.belowcontenttitle.contents
incollective.nitf
that inherits from it?Workaround to remove the
Error while rendering plone.belowcontenttitle.contents
: you need to remove the files or links content types created as children for the nitf content.The text was updated successfully, but these errors were encountered: