Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

In the folder_contents view always set the base tag with a trailing slash. #4

Merged
merged 2 commits into from

2 participants

This page is out of date. Refresh to see the latest.
View
4 CHANGES.txt
@@ -4,7 +4,9 @@ Changelog
2.1.1 (unreleased)
------------------
-- Nothing changed yet.
+- In the folder_contents view, assume a folderish context and set the base tag
+ with a trailing slash. Fixes https://dev.plone.org/ticket/13487
+ [danjacka]
2.1 (2013-03-05)
View
3  plone/app/content/browser/folder_contents.pt
@@ -7,6 +7,9 @@
metal:use-macro="here/main_template/macros/master">
<head>
+ <metal:baseslot fill-slot="base">
+ <base tal:attributes="href view/renderBase" /><!--[if lt IE 7]></base><![endif]-->
+ </metal:baseslot>
<metal:block fill-slot="top_slot">
<tal:insert tal:replace="nothing"
tal:define="dummy python:request.set('enable_border', 1)" />
View
6 plone/app/content/browser/foldercontents.py
@@ -99,6 +99,12 @@ def parent_url(self):
except Unauthorized:
return None
+ def renderBase(self):
+ """Returns the URL used in the base tag.
+ """
+ # Assume a folderish context
+ return self.context.absolute_url() + '/'
+
class FolderContentsTable(object):
"""
View
16 plone/app/content/browser/tests/foldercontents.txt
@@ -341,3 +341,19 @@ Selecting the current page should make the entire folder selected
<BLANKLINE>
... All ... items in this folder are selected. ...
+
+Folder contents of non-folders
+------------------------------
+
+The folder contents view is available on all content items, including
+non-folders. Most non-folders have no content, but some (like
+plone.app.collection collections) support folder-like operations and need to be
+set up appropriately, e.g. with the correct base tag.
+
+ >>> _ = self.portal.invokeFactory('Document', 'doc')
+ >>> browser.open('http://nohost/plone/doc')
+ >>> '<base href="http://nohost/plone/doc" />' in browser.contents
+ True
+ >>> browser.open('http://nohost/plone/doc/@@folder_contents')
+ >>> '<base href="http://nohost/plone/doc/" />' in browser.contents
+ True
View
2  setup.py
@@ -23,7 +23,7 @@
zip_safe=False,
extras_require=dict(
test=[
- 'zope.testing',
+ 'plone.app.testing',
'Products.PloneTestCase',
]
),
Something went wrong with that request. Please try again.