Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
zope-container
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
zope-container
Commits
047c9a37
Commit
047c9a37
authored
Jun 13, 2008
by
Christophe Combelles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #221025 : adding menu is sorted with translated items
parent
c67f4864
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
9 deletions
+13
-9
setup.py
setup.py
+1
-0
src/zope/app/container/browser/adding.py
src/zope/app/container/browser/adding.py
+4
-1
src/zope/app/container/browser/commontasks.pt
src/zope/app/container/browser/commontasks.pt
+4
-4
src/zope/app/container/browser/tests/test_adding.py
src/zope/app/container/browser/tests/test_adding.py
+4
-4
No files found.
setup.py
View file @
047c9a37
...
@@ -84,6 +84,7 @@ setup(name='zope.app.container',
...
@@ -84,6 +84,7 @@ setup(name='zope.app.container',
'zope.app.broken'
,
'zope.app.broken'
,
'zope.copypastemove'
,
'zope.copypastemove'
,
'ZODB3'
,
'ZODB3'
,
'zope.i18n'
,
],
],
include_package_data
=
True
,
include_package_data
=
True
,
zip_safe
=
False
,
zip_safe
=
False
,
...
...
src/zope/app/container/browser/adding.py
View file @
047c9a37
...
@@ -43,7 +43,7 @@ from zope.app.container.interfaces import IAdding, INameChooser
...
@@ -43,7 +43,7 @@ from zope.app.container.interfaces import IAdding, INameChooser
from
zope.app.container.interfaces
import
IContainerNamesContainer
from
zope.app.container.interfaces
import
IContainerNamesContainer
from
zope.app.pagetemplate.viewpagetemplatefile
import
ViewPageTemplateFile
from
zope.app.pagetemplate.viewpagetemplatefile
import
ViewPageTemplateFile
from
zope.app.publisher.browser.menu
import
getMenu
from
zope.app.publisher.browser.menu
import
getMenu
from
zope.i18n
import
translate
class
Adding
(
BrowserView
):
class
Adding
(
BrowserView
):
implements
(
IAdding
,
IPublishTraverse
)
implements
(
IAdding
,
IPublishTraverse
)
...
@@ -182,6 +182,9 @@ class Adding(BrowserView):
...
@@ -182,6 +182,9 @@ class Adding(BrowserView):
continue
continue
elif
item
[
'extra'
][
'factory'
]
!=
item
[
'action'
]:
elif
item
[
'extra'
][
'factory'
]
!=
item
[
'action'
]:
item
[
'has_custom_add_view'
]
=
True
item
[
'has_custom_add_view'
]
=
True
# translate here to have a localized sorting
item
[
'title'
]
=
zope
.
i18n
.
translate
(
item
[
'title'
],
context
=
self
.
request
)
result
.
append
(
item
)
result
.
append
(
item
)
result
.
sort
(
lambda
a
,
b
:
cmp
(
a
[
'title'
],
b
[
'title'
]))
result
.
sort
(
lambda
a
,
b
:
cmp
(
a
[
'title'
],
b
[
'title'
]))
...
...
src/zope/app/container/browser/commontasks.pt
View file @
047c9a37
<tal:block define="addingInfo context/@@+/addingInfo|nothing"
<tal:block define="addingInfo context/@@+/addingInfo|nothing"
condition="addingInfo"
i18n:domain="zope"
>
condition="addingInfo">
<tal:block repeat="info addingInfo"
<tal:block repeat="info addingInfo"
define="namesRequired context/@@+/nameAllowed">
define="namesRequired context/@@+/nameAllowed">
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
tal:attributes="
tal:attributes="
href string:${baseurl}/@@contents.html?type_name=${info/action};
href string:${baseurl}/@@contents.html?type_name=${info/action};
class info/selected"
class info/selected"
tal:content="info/title"
i18n:translate=""
>Folder
tal:content="info/title">Folder
</a>
</a>
<a href="#"
<a href="#"
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
tal:attributes="
tal:attributes="
href string:${baseurl}/@@+/action.html?type_name=${info/action};
href string:${baseurl}/@@+/action.html?type_name=${info/action};
class info/selected"
class info/selected"
tal:content="info/title"
i18n:translate=""
>Folder
tal:content="info/title">Folder
</a>
</a>
<a href="#"
<a href="#"
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
tal:attributes="
tal:attributes="
href python: info['action'][3:];
href python: info['action'][3:];
class info/selected"
class info/selected"
tal:content="info/title"
i18n:translate=""
>Folder
tal:content="info/title">Folder
</a>
</a>
</div>
</div>
</tal:block>
</tal:block>
...
...
src/zope/app/container/browser/tests/test_adding.py
View file @
047c9a37
...
@@ -264,18 +264,18 @@ def test_constraint_driven_addingInfo():
...
@@ -264,18 +264,18 @@ def test_constraint_driven_addingInfo():
>>> len(items)
>>> len(items)
1
1
>>> items[0]['title']
>>> items[0]['title']
'item3'
u
'item3'
>>> adding.menu_id = 'TestMenu'
>>> adding.menu_id = 'TestMenu'
>>> items = adding.addingInfo()
>>> items = adding.addingInfo()
>>> len(items)
>>> len(items)
3
3
>>> items[0]['title']
>>> items[0]['title']
'item1'
u
'item1'
>>> items[1]['title']
>>> items[1]['title']
'item2'
u
'item2'
>>> items[2]['title']
>>> items[2]['title']
'item3'
u
'item3'
"""
"""
def
test_constraint_driven_add
():
def
test_constraint_driven_add
():
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment