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
1
Issues
1
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
Roque
erp5
Commits
026cf7d4
Commit
026cf7d4
authored
Feb 02, 2018
by
Tomáš Peterka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[hal_json] Improve support for rendering Forms in callDialogMethod by inspecting the meta_type
parent
aaa8d69a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
21 deletions
+31
-21
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_callDialogMethod.py
...portal_skins/erp5_hal_json_style/Base_callDialogMethod.py
+31
-21
No files found.
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_callDialogMethod.py
View file @
026cf7d4
...
@@ -250,27 +250,37 @@ if True:
...
@@ -250,27 +250,37 @@ if True:
if
str
(
key
).
startswith
(
'field'
)
or
str
(
key
).
startswith
(
'subfield'
):
if
str
(
key
).
startswith
(
'field'
)
or
str
(
key
).
startswith
(
'subfield'
):
request
.
form
.
pop
(
key
,
None
)
request
.
form
.
pop
(
key
,
None
)
# now get dialog_method after skin re-selection and dialog_method mingling
# now get dialog_method after skin re-selection and dialog_method mingling
dialog_form
=
getattr
(
context
,
dialog_method
)
dialog_form
=
getattr
(
context
,
dialog_method
)
# XXX: this is a hack that should not be needed anymore with the new listbox.
# XXX: this is a hack that should not be needed anymore with the new listbox.
# set the URL in request, so that we can immediatly call method
# set the URL in request, so that we can immediatly call method
# that depend on it (eg. Show All). This is really related to
# that depend on it (eg. Show All). This is really related to
# current ListBox implementation which edit Selection's last_url
# current ListBox implementation which edit Selection's last_url
# with the content of REQUEST.URL
# with the content of REQUEST.URL
request
.
set
(
'URL'
,
'%s/%s'
%
(
context
.
absolute_url
(),
dialog_method
))
request
.
set
(
'URL'
,
'%s/%s'
%
(
context
.
absolute_url
(),
dialog_method
))
# RJS: If we are in deferred mode - call the form directly and return
# RJS: If we are in deferred mode - call the form directly and return
# dialog method is now `Base_activateSimpleView` - the only script in
# dialog method is now `Base_activateSimpleView` - the only script in
# deferred portal_skins folder
# deferred portal_skins folder
if
clean_kw
.
get
(
'deferred_style'
,
0
):
if
clean_kw
.
get
(
'deferred_style'
,
0
):
return
dialog_form
(
**
kw
)
# deferred form should return redirect with a message
return
dialog_form
(
**
kw
)
# deferred form should return redirect with a message
# RJS: If skin selection is different than Hal* then ERP5Document_getHateoas
# RJS: If skin selection is different than Hal* then ERP5Document_getHateoas
# does not exist and we call form method directly
# does not exist and we call form method directly
if
clean_kw
.
get
(
"portal_skin"
,
context
.
getPortalObject
().
portal_skins
.
getDefaultSkin
())
not
in
(
"Hal"
,
"HalRestricted"
):
# If update_method was clicked and the target is the original dialog form then we must not call dialog_form directly because it returns HTML
return
dialog_form
(
**
kw
)
if
clean_kw
.
get
(
"portal_skin"
,
context
.
getPortalObject
().
portal_skins
.
getDefaultSkin
())
not
in
(
"Hal"
,
"HalRestricted"
):
return
dialog_form
(
**
kw
)
# dialog_form can be anything from a pure python function, class method to ERP5 Form or Python Script
try
:
meta_type
=
dialog_form
.
meta_type
except
AttributeError
:
meta_type
=
""
if
meta_type
==
"ERP5 Form"
:
return
context
.
ERP5Document_getHateoas
(
REQUEST
=
request
,
form
=
dialog_form
,
mode
=
"form"
)
return
context
.
ERP5Document_getHateoas
(
REQUEST
=
request
,
form
=
dialog_form
,
mode
=
"form"
)
return
dialog_form
(
**
kw
)
return
getattr
(
context
,
dialog_method
)(
**
kw
)
return
getattr
(
context
,
dialog_method
)(
**
kw
)
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