Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alecs_myu
erp5
Commits
854e8e3e
Commit
854e8e3e
authored
Feb 19, 2016
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_hal_json_style: listbox support field alias rules
parent
1cf36281
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
171 additions
and
4 deletions
+171
-4
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.xml
...tal_skins/erp5_hal_json_style/ERP5Document_getHateoas.xml
+10
-3
bt5/erp5_hal_json_style/TestTemplateItem/portal_components/test.erp5.testHalJsonStyle.py
...plateItem/portal_components/test.erp5.testHalJsonStyle.py
+12
-1
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_listbox_zuite/testFieldAliasRules.xml
...l_tests/renderjs_ui_listbox_zuite/testFieldAliasRules.xml
+149
-0
No files found.
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.xml
View file @
854e8e3e
...
@@ -83,6 +83,12 @@ def byteify(string):\n
...
@@ -83,6 +83,12 @@ def byteify(string):\n
\n
\n
def getProtectedProperty(document, select):\n
def getProtectedProperty(document, select):\n
try:\n
try:\n
#see https://lab.nexedi.com/nexedi/erp5/blob/master/product/ERP5Form/ListBox.py#L2293\n
try:\n
select = select[select.rindex(\'.\') + 1:]\n
except ValueError:\n
pass\n
\n
return document.getProperty(select, d=None)\n
return document.getProperty(select, d=None)\n
except (ConflictError, RuntimeError):\n
except (ConflictError, RuntimeError):\n
raise\n
raise\n
...
@@ -1025,9 +1031,10 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
...
@@ -1025,9 +1031,10 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
# XXX Proxy field are not correctly handled in traversed_document of web site\n
# XXX Proxy field are not correctly handled in traversed_document of web site\n
listbox_form = getattr(traversed_document, listbox_field.aq_parent.id)\n
listbox_form = getattr(traversed_document, listbox_field.aq_parent.id)\n
for select in select_list:\n
for select in select_list:\n
# See Listbox.py getEditableField method\n
# See Listbox.py getValueList -->
getEditableField
&
getColumnAliasList method\n
if listbox_form.has_field("%s_%s" % (listbox_field_id, select), include_disabled=1):\n
tmp = select.replace(\'.\', \'_\')\n
editable_field_dict[select] = listbox_form.get_field("%s_%s" % (listbox_field_id, select), include_disabled=1)\n
if listbox_form.has_field("%s_%s" % (listbox_field_id, tmp), include_disabled=1):\n
editable_field_dict[select] = listbox_form.get_field("%s_%s" % (listbox_field_id, tmp), include_disabled=1)\n
\n
\n
for sql_document in sql_list:\n
for sql_document in sql_list:\n
try:\n
try:\n
...
...
bt5/erp5_hal_json_style/TestTemplateItem/portal_components/test.erp5.testHalJsonStyle.py
View file @
854e8e3e
...
@@ -471,6 +471,17 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
...
@@ -471,6 +471,17 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
@
changeSkin
(
'Hal'
)
@
changeSkin
(
'Hal'
)
def
test_getHateoasDocument_default_view
(
self
):
def
test_getHateoasDocument_default_view
(
self
):
document
=
self
.
_makeDocument
()
document
=
self
.
_makeDocument
()
document
.
Foo_view
.
listbox
.
ListBox_setPropertyList
(
field_title
=
'Foo Lines'
,
field_list_method
=
'objectValues'
,
field_portal_types
=
'Foo Line | Foo Line'
,
field_stat_method
=
'portal_catalog'
,
field_stat_columns
=
'quantity | Foo_statQuantity'
,
field_editable
=
1
,
field_columns
=
'id|ID
\
n
title|Title
\
n
quantity|Quantity
\
n
start_date|Date
\
n
catalog.uid|Uid'
,
field_editable_columns
=
'id|ID
\
n
title|Title
\
n
quantity|quantity
\
n
start_date|Date'
,
field_search_columns
=
'id|ID
\
n
title|Title
\
n
quantity|Quantity
\
n
start_date|Date'
,)
parent
=
document
.
getParentValue
()
parent
=
document
.
getParentValue
()
fake_request
=
do_fake_request
(
"GET"
)
fake_request
=
do_fake_request
(
"GET"
)
result
=
self
.
portal
.
web_site_module
.
hateoas
.
ERP5Document_getHateoas
(
REQUEST
=
fake_request
,
mode
=
"traverse"
,
relative_url
=
document
.
getRelativeUrl
(),
view
=
"view"
)
result
=
self
.
portal
.
web_site_module
.
hateoas
.
ERP5Document_getHateoas
(
REQUEST
=
fake_request
,
mode
=
"traverse"
,
relative_url
=
document
.
getRelativeUrl
(),
view
=
"view"
)
...
@@ -551,7 +562,7 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
...
@@ -551,7 +562,7 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'listbox'
][
'list_method'
],
'objectValues'
)
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'listbox'
][
'list_method'
],
'objectValues'
)
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'listbox'
][
'query'
],
'urn:jio:allDocs?query='
)
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'listbox'
][
'query'
],
'urn:jio:allDocs?query='
)
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'listbox'
][
'portal_type'
],
[[
'Foo Line'
,
'Foo Line'
]])
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'listbox'
][
'portal_type'
],
[[
'Foo Line'
,
'Foo Line'
]])
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'listbox'
][
'column_list'
],
[[
'id'
,
'ID'
],
[
'title'
,
'Title'
],
[
'quantity'
,
'Quantity'
],
[
'start_date'
,
'Date'
]])
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'listbox'
][
'column_list'
],
[[
'id'
,
'ID'
],
[
'title'
,
'Title'
],
[
'quantity'
,
'Quantity'
],
[
'start_date'
,
'Date'
]
,
[
'catalog.uid'
,
'Uid'
]
])
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'listbox'
][
'search_column_list'
],
[[
'id'
,
'ID'
],
[
'title'
,
'Title'
],
[
'quantity'
,
'Quantity'
],
[
'start_date'
,
'Date'
]])
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'listbox'
][
'search_column_list'
],
[[
'id'
,
'ID'
],
[
'title'
,
'Title'
],
[
'quantity'
,
'Quantity'
],
[
'start_date'
,
'Date'
]])
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'listbox'
][
'editable_column_list'
],
[[
'id'
,
'ID'
],
[
'title'
,
'Title'
],
[
'quantity'
,
'quantity'
],
[
'start_date'
,
'Date'
]])
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'listbox'
][
'editable_column_list'
],
[[
'id'
,
'ID'
],
[
'title'
,
'Title'
],
[
'quantity'
,
'quantity'
],
[
'start_date'
,
'Date'
]])
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'listbox'
][
'sort_column_list'
],
[[
'id'
,
'ID'
],
[
'title'
,
'Title'
],
[
'quantity'
,
'Quantity'
],
[
'start_date'
,
'Date'
]])
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'listbox'
][
'sort_column_list'
],
[[
'id'
,
'ID'
],
[
'title'
,
'Title'
],
[
'quantity'
,
'Quantity'
],
[
'start_date'
,
'Date'
]])
...
...
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_listbox_zuite/testFieldAliasRules.xml
0 → 100644
View file @
854e8e3e
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ZopePageTemplate"
module=
"Products.PageTemplates.ZopePageTemplate"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_text
</string>
</key>
<value>
<unicode
encoding=
"cdata"
>
<![CDATA[
<html xmlns:tal="http://xml.zope.org/namespaces/tal"\n
xmlns:metal="http://xml.zope.org/namespaces/metal">
\n
<head>
\n
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
>
\n
<title>
Test RenderJS UI
</title>
\n
</head>
\n
<body>
\n
<table
cellpadding=
"1"
cellspacing=
"1"
border=
"1"
>
\n
<thead>
\n
<tr><td
rowspan=
"1"
colspan=
"3"
>
Test RenderJS UI
</td></tr>
\n
</thead><tbody>
\n
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplate/macros/init"
/>
\n
\n
<!-- Clean Up -->
\n
<tr>
\n
<td>
open
</td>
\n
<td>
${base_url}/bar_module/ListBoxZuite_reset
</td>
\n
<td></td>
\n
</tr>
\n
\n
<tr>
\n
<td>
assertTextPresent
</td>
\n
<td>
Reset Successfully.
</td>
\n
<td></td>
\n
</tr>
\n
\n
<tr>
\n
<td>
open
</td>
\n
<td>
${base_url}/foo_module/FooModule_createObjects
</td>
\n
<td></td>
\n
</tr>
\n
<tr>
\n
<td>
assertTextPresent
</td>
\n
<td>
Created Successfully.
</td>
\n
<td></td>
\n
</tr>
\n
\n
\n
<tr>
\n
<td>
open
</td>
\n
<td>
${base_url}/foo_module/FooModule_viewFooList/listbox/ListBox_setPropertyList?field_columns=id%7CID%0Atitle%7CTitle%0Adelivery.quantity%7CQuantity
</td>
\n
<td></td>
\n
</tr>
\n
\n
<tr>
\n
<td>
assertTextPresent
</td>
\n
<td>
Set Successfully.
</td>
\n
<td></td>
\n
</tr>
\n
\n
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplate/macros/wait_for_activities"
/>
\n
\n
\n
<!-- Initialize -->
\n
<tr>
\n
<td>
open
</td>
\n
<td>
${base_url}/web_site_module/renderjs_runner/#/foo_module
</td>
\n
<td></td>
\n
</tr>
\n
\n
<tr>
\n
<td>
waitForElementPresent
</td>
\n
<td>
//a[@data-i18n=\'Previous\']
</td>
\n
<td></td>
\n
</tr>
\n
\n
<!-- check quanlity is display correctly -->
\n
<tr>
\n
<td>
waitForElementPresent
</td>
\n
<td>
//a[@class=\'ui-link\' and text() =\'1\']
</td>
\n
<td></td>
\n
</tr>
\n
\n
\n
<tr>
\n
<td>
verifyElementPresent
</td>
\n
<td>
//a[@class=\'ui-link\' and text() =\'1\']
</td>
\n
<td></td>
\n
</tr>
\n
\n
\n
</tbody></table>
\n
</body>
\n
</html>
]]>
</unicode>
</value>
</item>
<item>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
text/html
</string>
</value>
</item>
<item>
<key>
<string>
expand
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
testFieldAliasRules
</string>
</value>
</item>
<item>
<key>
<string>
output_encoding
</string>
</key>
<value>
<string>
utf-8
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<unicode></unicode>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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