Skip to content

Commit

Permalink
[fc] Repository: plone.app.linkintegrity
Browse files Browse the repository at this point in the history
Branch: refs/heads/master
Date: 2016-07-16T22:24:38-05:00
Author: vangheem (vangheem) <vangheem@gmail.com>
Commit: plone/plone.app.linkintegrity@c686114

Fix object url in delete confirmation

Files changed:
M CHANGES.rst
M plone/app/linkintegrity/browser/delete_confirmation_info.pt
Repository: plone.app.linkintegrity
Branch: refs/heads/master
Date: 2016-08-03T16:15:17+02:00
Author: Jens W. Klein (jensens) <jk@kleinundpartner.at>
Commit: plone/plone.app.linkintegrity@1fcf20b

Merge pull request #41 from plone/fix-delete-confirm-url

Fix object url in delete confirmation

Files changed:
M CHANGES.rst
M plone/app/linkintegrity/browser/delete_confirmation_info.pt
  • Loading branch information
jensens committed Aug 3, 2016
1 parent 326168d commit 5d42432
Showing 1 changed file with 86 additions and 55 deletions.
141 changes: 86 additions & 55 deletions last_commit.txt
Original file line number Diff line number Diff line change
@@ -1,71 +1,102 @@
Repository: plone.app.content
Repository: plone.app.linkintegrity


Branch: refs/heads/master
Date: 2016-08-03T14:10:31+02:00
Author: Johannes Raggam (thet) <thetetet@gmail.com>
Commit: https://github.com/plone/plone.app.content/commit/ed9af98b3a51ee1637aafca1c7cb2dcd6e1511a2
Date: 2016-07-16T22:24:38-05:00
Author: vangheem (vangheem) <vangheem@gmail.com>
Commit: https://github.com/plone/plone.app.linkintegrity/commit/c686114151cefad4b2b1c669d826358275135eca

Add ``allow_upload`` JSON view.
Add ``@@allow_upload`` view, which returns a JSON string to indicate if File or Image uploads are allowed in the current container.
When the view is called with a ``path`` request parameter, then content at this path is used instead the content where the view is called.
Fix object url in delete confirmation

Files changed:
M CHANGES.rst
M plone/app/content/browser/file.py
M plone/app/content/tests/test_contents.py
M plone/app/linkintegrity/browser/delete_confirmation_info.pt

diff --git a/CHANGES.rst b/CHANGES.rst
index 03a3b57..8d6e75e 100644
index 043f49c..9ee4c35 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -11,6 +11,7 @@ Breaking changes:
New features:
@@ -14,6 +14,9 @@ New features:

- Add ``@@allow_upload`` view, which returns a JSON string to indicate if File or Image uploads are allowed in the current container.
+ When the view is called with a ``path`` request parameter, then content at this path is used instead the content where the view is called.
[thet]
Bug fixes:

- Factor out the available columns ignored list which can be used to narrow down the available columns list to a user friendly set.
diff --git a/plone/app/content/browser/file.py b/plone/app/content/browser/file.py
index d79f4e1..a783a46 100644
--- a/plone/app/content/browser/file.py
+++ b/plone/app/content/browser/file.py
@@ -205,7 +205,10 @@ def __call__(self):
self.request.response.setHeader(
'Content-Type', 'application/json; charset=utf-8'
)
- allowed_types = [t.getId() for t in self.context.allowedContentTypes()]
+ context = self.context
+ if self.request.form.get('path'):
+ context = context.restrictedTraverse(self.request.form.get('path'))
+ allowed_types = [t.getId() for t in context.allowedContentTypes()]
allow_images = u'Image' in allowed_types
allow_files = u'File' in allowed_types
return json.dumps({
diff --git a/plone/app/content/tests/test_contents.py b/plone/app/content/tests/test_contents.py
index 3a90c49..1a1d9ee 100644
--- a/plone/app/content/tests/test_contents.py
+++ b/plone/app/content/tests/test_contents.py
@@ -218,3 +218,19 @@ def test_allow_upload(self):
self.assertEqual(allow_upload['allowUpload'], True)
self.assertEqual(allow_upload['allowImages'], True)
self.assertEqual(allow_upload['allowFiles'], True)
+- Fix object url in delete confirmation
+ [vangheem]
+
+ # Test files allowed, path via request variable
+ self.type1_fti.allowed_content_types = ['File']
+ # First, test on Portal root to see the difference
+ allow_upload = self.portal.restrictedTraverse('@@allow_upload')
+ allow_upload = json.loads(allow_upload())
+ self.assertEqual(allow_upload['allowUpload'], True)
+ self.assertEqual(allow_upload['allowImages'], True)
+ self.assertEqual(allow_upload['allowFiles'], True)
+ # Then, with path set to sub item
+ allow_upload = self.portal.restrictedTraverse('@@allow_upload')
+ allow_upload.request.form['path'] = '/plone/it1'
+ allow_upload = json.loads(allow_upload())
+ self.assertEqual(allow_upload['allowUpload'], True)
+ self.assertEqual(allow_upload['allowImages'], False)
+ self.assertEqual(allow_upload['allowFiles'], True)
- Use zope.interface decorator.
[gforcada]

diff --git a/plone/app/linkintegrity/browser/delete_confirmation_info.pt b/plone/app/linkintegrity/browser/delete_confirmation_info.pt
index 8c0fd00..4f1fe50 100644
--- a/plone/app/linkintegrity/browser/delete_confirmation_info.pt
+++ b/plone/app/linkintegrity/browser/delete_confirmation_info.pt
@@ -16,7 +16,7 @@
<article tal:repeat="breach breaches" class="breach-container">

<tal:target tal:define="target breach/target">
- <header><a href="target/url" tal:content="target/title" /></header>
+ <header><a href="${target/url}" tal:content="target/title" /></header>
<p>
<span i18n:translate="linkintegrity_is_referenced">
This <span i18n:name="portal_type" tal:content="target/type_title" />
@@ -50,4 +50,4 @@

</div>
</div>
-</tal:block>
\ No newline at end of file
+</tal:block>


Repository: plone.app.linkintegrity


Branch: refs/heads/master
Date: 2016-08-03T16:15:17+02:00
Author: Jens W. Klein (jensens) <jk@kleinundpartner.at>
Commit: https://github.com/plone/plone.app.linkintegrity/commit/1fcf20b26167ee68186533b28c31ead3e9b2679e

Merge pull request #41 from plone/fix-delete-confirm-url

Fix object url in delete confirmation

Files changed:
M CHANGES.rst
M plone/app/linkintegrity/browser/delete_confirmation_info.pt

diff --git a/CHANGES.rst b/CHANGES.rst
index 043f49c..9ee4c35 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -14,6 +14,9 @@ New features:

Bug fixes:

+- Fix object url in delete confirmation
+ [vangheem]
+
- Use zope.interface decorator.
[gforcada]

diff --git a/plone/app/linkintegrity/browser/delete_confirmation_info.pt b/plone/app/linkintegrity/browser/delete_confirmation_info.pt
index 8c0fd00..4f1fe50 100644
--- a/plone/app/linkintegrity/browser/delete_confirmation_info.pt
+++ b/plone/app/linkintegrity/browser/delete_confirmation_info.pt
@@ -16,7 +16,7 @@
<article tal:repeat="breach breaches" class="breach-container">

<tal:target tal:define="target breach/target">
- <header><a href="target/url" tal:content="target/title" /></header>
+ <header><a href="${target/url}" tal:content="target/title" /></header>
<p>
<span i18n:translate="linkintegrity_is_referenced">
This <span i18n:name="portal_type" tal:content="target/type_title" />
@@ -50,4 +50,4 @@

</div>
</div>
-</tal:block>
\ No newline at end of file
+</tal:block>


0 comments on commit 5d42432

Please sign in to comment.