-
-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fc] Repository: plone.formwidget.contenttree
Branch: refs/heads/master Date: 2015-10-20T18:28:43+02:00 Author: Gaudenz Steinlin () <gaudenz.steinlin@cirrax.com> Commit: plone/plone.formwidget.contenttree@da75494 Fix HTML entities in browse button title With plone.protect auto protection enabled all non-ascii characters in the output get replaced by their HTML entities. But when setting an attribute with the jQuery attr method HTML entities are not resolved. See http://bugs.jquery.com/ticket/6780 for more information about this issue. This commit works around this by changeing the JS code to not use the attr method the set the button title. Files changed: M docs/HISTORY.rst M plone/formwidget/contenttree/widget.py Repository: plone.formwidget.contenttree Branch: refs/heads/master Date: 2015-10-20T22:27:42+02:00 Author: Gaudenz Steinlin () <gaudenz.steinlin@cirrax.com> Commit: plone/plone.formwidget.contenttree@23cd9cf Implement __len__ for PathSource PathSource implements IContentSource which derives from IIterableVocabulary. Thus it must implement __len__. As the number of valid terms for a PathSource is not known this always returns len(self._default_terms) analogous to the __iter__ method. Files changed: M docs/HISTORY.rst M plone/formwidget/contenttree/source.py Repository: plone.formwidget.contenttree Branch: refs/heads/master Date: 2015-12-01T16:02:25Z Author: Matthew Wilkes (MatthewWilkes) <git@matthewwilkes.name> Commit: plone/plone.formwidget.contenttree@75e9628 Merge pull request #21 from plone/fix-csrf-protection-encoding Fix csrf protection encoding Files changed: M docs/HISTORY.rst M plone/formwidget/contenttree/source.py M plone/formwidget/contenttree/widget.py
- Loading branch information
1 parent
f8e8e25
commit 5041c41
Showing
1 changed file
with
150 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,175 @@ | ||
Repository: plone.api | ||
Repository: plone.formwidget.contenttree | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2015-12-01T15:52:34+01:00 | ||
Author: Gil Forcada Codinachs (gforcada) <gil.forcada@freitag.de> | ||
Commit: https://github.com/plone/plone.api/commit/2a59a81dd094605c04979c3eace560cc31689d93 | ||
Date: 2015-10-20T18:28:43+02:00 | ||
Author: Gaudenz Steinlin () <gaudenz.steinlin@cirrax.com> | ||
Commit: https://github.com/plone/plone.formwidget.contenttree/commit/da75494638e04efcd80828a74c6aeb44349b7305 | ||
|
||
Typo: role is 'Reader' not 'Readers' | ||
Fix HTML entities in browse button title | ||
|
||
Reported by @zopyx | ||
With plone.protect auto protection enabled all non-ascii characters in | ||
the output get replaced by their HTML entities. But when setting an | ||
attribute with the jQuery attr method HTML entities are not resolved. | ||
See http://bugs.jquery.com/ticket/6780 for more information about this | ||
issue. | ||
|
||
Fixes https://github.com/plone/plone.api/issues/288 | ||
This commit works around this by changeing the JS code to not use the | ||
attr method the set the button title. | ||
|
||
Files changed: | ||
M docs/group.rst | ||
|
||
diff --git a/docs/group.rst b/docs/group.rst | ||
index 0675137..e915dfd 100644 | ||
--- a/docs/group.rst | ||
+++ b/docs/group.rst | ||
@@ -41,7 +41,7 @@ When creating groups ``title``, ``description``, ``roles`` and ``groups`` are op | ||
groupname='board_members', | ||
title='Board members', | ||
description='Just a description', | ||
- roles=['Readers', ], | ||
+ roles=['Reader', ], | ||
groups=['Site Administrators', ], | ||
) | ||
M docs/HISTORY.rst | ||
M plone/formwidget/contenttree/widget.py | ||
|
||
diff --git a/docs/HISTORY.rst b/docs/HISTORY.rst | ||
index 92981cd..c9328a2 100644 | ||
--- a/docs/HISTORY.rst | ||
+++ b/docs/HISTORY.rst | ||
@@ -7,6 +7,8 @@ Changelog | ||
- Remove unnecessary test setup. | ||
[timo] | ||
|
||
@@ -50,7 +50,7 @@ When creating groups ``title``, ``description``, ``roles`` and ``groups`` are op | ||
self.assertEqual(group.id, 'board_members') | ||
self.assertEqual(group.getProperty('title'), 'Board members') | ||
self.assertEqual(group.getProperty('description'), 'Just a description') | ||
- self.assertTrue('Readers' in group.getRoles()) | ||
+ self.assertTrue('Reader' in group.getRoles()) | ||
self.assertTrue('Site Administrators' in group.getMemberIds()) | ||
+- Fix HTML entities in browse button title | ||
+ [gaudenz] | ||
|
||
1.0.11 (2015-02-09) | ||
------------------- | ||
diff --git a/plone/formwidget/contenttree/widget.py b/plone/formwidget/contenttree/widget.py | ||
index bea4597..e1de64a 100644 | ||
--- a/plone/formwidget/contenttree/widget.py | ||
+++ b/plone/formwidget/contenttree/widget.py | ||
@@ -123,13 +123,7 @@ def __call__(self): | ||
if ($(this).siblings('input.searchButton').length != 0) { | ||
return; | ||
} | ||
- var input = document.createElement('input'); | ||
- $(input) | ||
- .attr({ | ||
- 'type': 'button', | ||
- 'value': '%(button_val)s' | ||
- }) | ||
- .addClass('searchButton') | ||
+ $('<input type="button" value="%(button_val)s" class="searchButton">') | ||
.click(function () { | ||
var parent = $(this).parents("*[id$='-autocomplete']"); | ||
var window = parent.siblings("*[id$='-contenttree-window']"); | ||
|
||
|
||
Repository: plone.formwidget.contenttree | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2015-10-20T22:27:42+02:00 | ||
Author: Gaudenz Steinlin () <gaudenz.steinlin@cirrax.com> | ||
Commit: https://github.com/plone/plone.formwidget.contenttree/commit/23cd9cf6a4513340527b7d4c5767cc83e150eac0 | ||
|
||
Implement __len__ for PathSource | ||
|
||
PathSource implements IContentSource which derives from | ||
IIterableVocabulary. Thus it must implement __len__. | ||
|
||
As the number of valid terms for a PathSource is not known this always | ||
returns len(self._default_terms) analogous to the __iter__ method. | ||
|
||
Files changed: | ||
M docs/HISTORY.rst | ||
M plone/formwidget/contenttree/source.py | ||
|
||
diff --git a/docs/HISTORY.rst b/docs/HISTORY.rst | ||
index c9328a2..46ea6bb 100644 | ||
--- a/docs/HISTORY.rst | ||
+++ b/docs/HISTORY.rst | ||
@@ -10,6 +10,9 @@ Changelog | ||
- Fix HTML entities in browse button title | ||
[gaudenz] | ||
|
||
+- Implement __len__ for PathSource | ||
+ [gaudenz] | ||
+ | ||
1.0.11 (2015-02-09) | ||
------------------- | ||
|
||
diff --git a/plone/formwidget/contenttree/source.py b/plone/formwidget/contenttree/source.py | ||
index eb2e520..6ae80b0 100644 | ||
--- a/plone/formwidget/contenttree/source.py | ||
+++ b/plone/formwidget/contenttree/source.py | ||
@@ -106,6 +106,9 @@ def __init__(self, context, selectable_filter, navigation_tree_query=None, defau | ||
def __iter__(self): | ||
return iter(self._default_terms) | ||
|
||
+ def __len__(self): | ||
+ return len(self._default_terms) | ||
+ | ||
def __contains__(self, value): | ||
try: | ||
brain = self._getBrainByValue(value) | ||
|
||
|
||
Repository: plone.api | ||
Repository: plone.formwidget.contenttree | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2015-12-01T15:14:34Z | ||
Author: Adam Forsythe-Cheasley (adamcheasley) <adam@netsight.co.uk> | ||
Commit: https://github.com/plone/plone.api/commit/7c54801a38e375cbbb740180453800e08ee4da0b | ||
Date: 2015-12-01T16:02:25Z | ||
Author: Matthew Wilkes (MatthewWilkes) <git@matthewwilkes.name> | ||
Commit: https://github.com/plone/plone.formwidget.contenttree/commit/75e96285298ceedb5f928d8545d82a1471399f26 | ||
|
||
Merge pull request #289 from plone/gforcada-patch-1 | ||
Merge pull request #21 from plone/fix-csrf-protection-encoding | ||
|
||
Typo: role is 'Reader' not 'Readers' | ||
Fix csrf protection encoding | ||
|
||
Files changed: | ||
M docs/group.rst | ||
|
||
diff --git a/docs/group.rst b/docs/group.rst | ||
index 0675137..e915dfd 100644 | ||
--- a/docs/group.rst | ||
+++ b/docs/group.rst | ||
@@ -41,7 +41,7 @@ When creating groups ``title``, ``description``, ``roles`` and ``groups`` are op | ||
groupname='board_members', | ||
title='Board members', | ||
description='Just a description', | ||
- roles=['Readers', ], | ||
+ roles=['Reader', ], | ||
groups=['Site Administrators', ], | ||
) | ||
M docs/HISTORY.rst | ||
M plone/formwidget/contenttree/source.py | ||
M plone/formwidget/contenttree/widget.py | ||
|
||
diff --git a/docs/HISTORY.rst b/docs/HISTORY.rst | ||
index 92981cd..46ea6bb 100644 | ||
--- a/docs/HISTORY.rst | ||
+++ b/docs/HISTORY.rst | ||
@@ -7,6 +7,11 @@ Changelog | ||
- Remove unnecessary test setup. | ||
[timo] | ||
|
||
@@ -50,7 +50,7 @@ When creating groups ``title``, ``description``, ``roles`` and ``groups`` are op | ||
self.assertEqual(group.id, 'board_members') | ||
self.assertEqual(group.getProperty('title'), 'Board members') | ||
self.assertEqual(group.getProperty('description'), 'Just a description') | ||
- self.assertTrue('Readers' in group.getRoles()) | ||
+ self.assertTrue('Reader' in group.getRoles()) | ||
self.assertTrue('Site Administrators' in group.getMemberIds()) | ||
+- Fix HTML entities in browse button title | ||
+ [gaudenz] | ||
+ | ||
+- Implement __len__ for PathSource | ||
+ [gaudenz] | ||
|
||
1.0.11 (2015-02-09) | ||
------------------- | ||
diff --git a/plone/formwidget/contenttree/source.py b/plone/formwidget/contenttree/source.py | ||
index eb2e520..6ae80b0 100644 | ||
--- a/plone/formwidget/contenttree/source.py | ||
+++ b/plone/formwidget/contenttree/source.py | ||
@@ -106,6 +106,9 @@ def __init__(self, context, selectable_filter, navigation_tree_query=None, defau | ||
def __iter__(self): | ||
return iter(self._default_terms) | ||
|
||
+ def __len__(self): | ||
+ return len(self._default_terms) | ||
+ | ||
def __contains__(self, value): | ||
try: | ||
brain = self._getBrainByValue(value) | ||
diff --git a/plone/formwidget/contenttree/widget.py b/plone/formwidget/contenttree/widget.py | ||
index bea4597..e1de64a 100644 | ||
--- a/plone/formwidget/contenttree/widget.py | ||
+++ b/plone/formwidget/contenttree/widget.py | ||
@@ -123,13 +123,7 @@ def __call__(self): | ||
if ($(this).siblings('input.searchButton').length != 0) { | ||
return; | ||
} | ||
- var input = document.createElement('input'); | ||
- $(input) | ||
- .attr({ | ||
- 'type': 'button', | ||
- 'value': '%(button_val)s' | ||
- }) | ||
- .addClass('searchButton') | ||
+ $('<input type="button" value="%(button_val)s" class="searchButton">') | ||
.click(function () { | ||
var parent = $(this).parents("*[id$='-autocomplete']"); | ||
var window = parent.siblings("*[id$='-contenttree-window']"); | ||
|
||
|