Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5-Boxiang
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
Hamza
erp5-Boxiang
Commits
df2cf859
Commit
df2cf859
authored
Oct 29, 2015
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_hal_json_style: add sort functionnality
parent
1b6fd549
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
9 deletions
+17
-9
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_restricted_style/ERP5Document_getHateoas.xml
...rp5_hal_json_restricted_style/ERP5Document_getHateoas.xml
+2
-1
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.xml
...tal_skins/erp5_hal_json_style/ERP5Document_getHateoas.xml
+14
-7
bt5/erp5_hal_json_style/TestTemplateItem/portal_components/test.erp5.testHalJsonStyle.py
...plateItem/portal_components/test.erp5.testHalJsonStyle.py
+1
-1
No files found.
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_restricted_style/ERP5Document_getHateoas.xml
View file @
df2cf859
...
...
@@ -73,13 +73,14 @@ return context.ERP5Document_getHateoas(\n
default_param_json=default_param_json,\n
form_relative_url=form_relative_url,\n
bulk_list=bulk_list,\n
sort_on=sort_on,\n
restricted=1\n
)\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
REQUEST=None, response=None, view=None, mode=\'root\', query=None, select_list=None, limit=10, form=None, relative_url=None, list_method=None, default_param_json=None, form_relative_url=None, bulk_list="[]"
</string>
</value>
<value>
<string>
REQUEST=None, response=None, view=None, mode=\'root\', query=None, select_list=None, limit=10, form=None, relative_url=None, list_method=None, default_param_json=None, form_relative_url=None, bulk_list="[]"
, sort_on=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.xml
View file @
df2cf859
...
...
@@ -75,18 +75,18 @@ url_template_dict = {\n
"traverse_template": "%(root_url)s/%(script_id)s?mode=traverse" + \\\n
"{&relative_url,view}",\n
"search_template": "%(root_url)s/%(script_id)s?mode=search" + \\\n
"{&query,select_list*,limit*}",\n
"{&query,select_list*,limit*
,sort_on*
}",\n
"custom_search_template": "%(root_url)s/%(script_id)s?mode=search" + \\\n
"&relative_url=%(relative_url)s" \\\n
"&form_relative_url=%(form_relative_url)s" \\\n
"&list_method=%(list_method)s" \\\n
"&default_param_json=%(default_param_json)s" \\\n
"{&query,select_list*,limit*}",\n
"{&query,select_list*,limit*
,sort_on*
}",\n
"custom_search_template_no_editable": "%(root_url)s/%(script_id)s?mode=search" + \\\n
"&relative_url=%(relative_url)s" \\\n
"&list_method=%(list_method)s" \\\n
"&default_param_json=%(default_param_json)s" \\\n
"{&query,select_list*,limit*}",\n
"{&query,select_list*,limit*
,sort_on*
}",\n
"new_content_action": "%(root_url)s/%(script_id)s?mode=newContent",\n
"bulk_action": "%(root_url)s/%(script_id)s?mode=bulk",\n
# XXX View is set by default to empty\n
...
...
@@ -901,11 +901,18 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
callable_list_method = portal.portal_catalog\n
else:\n
callable_list_method = getattr(traversed_document, list_method)\n
\n
tmp_sort_on = ()\n
if sort_on is not None:\n
for grain in sort_on:\n
if grain != "":\n
tmp_sort_on += (tuple([x for x in grain.split(",")]),)\n
\n
if query:\n
sql_list = callable_list_method(full_text=query, limit=limit, **catalog_kw)\n
sql_list = callable_list_method(full_text=query, limit=limit,
sort_on=tmp_sort_on,
**catalog_kw)\n
else:\n
sql_list = callable_list_method(limit=limit, **catalog_kw)\n
\n
sql_list = callable_list_method(limit=limit,
sort_on=tmp_sort_on,
**catalog_kw)\n
\n
result_list = []\n
\n
# if (select_list is None):\n
...
...
@@ -1061,7 +1068,7 @@ else:\n
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
REQUEST=None, response=None, view=None, mode=\'root\', query=None, select_list=None, limit=10, form=None, relative_url=None, restricted=0, list_method=None, default_param_json=None, form_relative_url=None, bulk_list="[]"
</string>
</value>
<value>
<string>
REQUEST=None, response=None, view=None, mode=\'root\', query=None, select_list=None, limit=10, form=None, relative_url=None, restricted=0, list_method=None, default_param_json=None, form_relative_url=None, bulk_list="[]"
, sort_on=()
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
bt5/erp5_hal_json_style/TestTemplateItem/portal_components/test.erp5.testHalJsonStyle.py
View file @
df2cf859
...
...
@@ -348,7 +348,7 @@ class TestERP5Document_getHateoas_mode_root(ERP5HALJSONStyleSkinsMixin):
self
.
assertEqual
(
result_dict
[
'_links'
][
'type'
][
'name'
],
document
.
getPortalType
())
self
.
assertEqual
(
result_dict
[
'_links'
][
'raw_search'
][
'href'
],
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=search{&query,select_list*,limit*}"
%
self
.
portal
.
absolute_url
())
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=search{&query,select_list*,limit*
,sort_on*
}"
%
self
.
portal
.
absolute_url
())
self
.
assertEqual
(
result_dict
[
'_links'
][
'raw_search'
][
'templated'
],
True
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'raw_search'
][
'name'
],
"Raw Search"
)
...
...
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