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
Xavier Thompson
erp5
Commits
e95b12d2
Commit
e95b12d2
authored
Jul 02, 2019
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_core/erp5_hal_json_style] Allow to use template in ERP5JS
parent
88f24700
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
379 additions
and
13 deletions
+379
-13
bt5/erp5_accounting_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_accounting_report_zuite/testTemplatePreference.xml
...rjs_ui_accounting_report_zuite/testTemplatePreference.xml
+58
-0
bt5/erp5_accounting_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_accounting_report_zuite/testTemplatePreference.zpt
...rjs_ui_accounting_report_zuite/testTemplatePreference.zpt
+113
-0
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_doAction.py
...ateItem/portal_skins/erp5_hal_json_style/Base_doAction.py
+8
-9
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_getNewContentList.py
...ortal_skins/erp5_hal_json_style/Base_getNewContentList.py
+12
-0
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_getNewContentList.xml
...rtal_skins/erp5_hal_json_style/Base_getNewContentList.xml
+62
-0
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_viewNewContentDialog/your_select_action.xml
...on_style/Base_viewNewContentDialog/your_select_action.xml
+1
-1
product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/portal_actions/make_template.xml
...emplateItem/portal_types/portal_actions/make_template.xml
+2
-2
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_makeTemplateFromDocument.py
...m/portal_skins/erp5_core/Base_makeTemplateFromDocument.py
+1
-1
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_viewMakeTemplateFromDocumentDialog.xml
...ins/erp5_core/Base_viewMakeTemplateFromDocumentDialog.xml
+122
-0
No files found.
bt5/erp5_accounting_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_accounting_report_zuite/testTemplatePreference.xml
0 → 100644
View file @
e95b12d2
<?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>
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>
testTemplatePreference
</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>
bt5/erp5_accounting_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_accounting_report_zuite/testTemplatePreference.zpt
0 → 100644
View file @
e95b12d2
<html
xmlns:tal=
"http://xml.zope.org/namespaces/tal"
xmlns:metal=
"http://xml.zope.org/namespaces/metal"
>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
>
<title>
Test RenderJS UI
</title>
</head>
<body>
<table
cellpadding=
"1"
cellspacing=
"1"
border=
"1"
>
<thead>
<tr><td
rowspan=
"1"
colspan=
"3"
>
Test Template Preference
</td></tr>
</thead><tbody>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplate/macros/init"
/>
<!-- Initialize -->
<tr>
<td>
open
</td>
<td>
${base_url}/web_site_module/renderjs_runner/#/accounting_module
</td>
<td></td>
</tr>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded"
/>
<tal:block
tal:define=
"click_configuration python: {'text': 'Add'}"
>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_header_link"
/>
</tal:block>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded"
/>
<tr>
<td>
select
</td>
<td>
//select[@name='field_your_select_action']
</td>
<td>
label=Sale Invoice Transaction
</td>
</tr>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog"
/>
<tal:block
tal:define=
"notification_configuration python: {'class': 'success',
'text': 'Object created.'}"
>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification"
/>
</tal:block>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded"
/>
<tr>
<td>
store
</td>
<td
tal:content=
"python: 'My foobar document %s' % DateTime()"
></td>
<td>
original_title
</td>
</tr>
<tr>
<td>
type
</td>
<td>
name=field_my_title
</td>
<td>
${original_title}
</td>
</tr>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/save"
/>
<tal:block
tal:define=
"click_configuration python: {'text': 'Actions'}"
>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_header_link"
/>
</tal:block>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded"
/>
<tal:block
tal:define=
"click_configuration python: {'text': 'Make a Template'}"
>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_page_link"
/>
</tal:block>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded"
/>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog"
/>
<tal:block
tal:define=
"notification_configuration python: {'class': 'success',
'text': 'Templated created.'}"
>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification"
/>
</tal:block>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded"
/>
<!-- change the title to prevent possible confusion with the document created later -->
<tr>
<td>
type
</td>
<td>
name=field_my_title
</td>
<td>
${original_title} old
</td>
</tr>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/save"
/>
<!-- be sure the preference is indexed -->
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplate/macros/wait_for_activities"
/>
<!-- go to the module, and create a document from the template -->
<tr>
<td>
open
</td>
<td>
${base_url}/web_site_module/renderjs_runner/#/accounting_module
</td>
<td></td>
</tr>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded"
/>
<tal:block
tal:define=
"click_configuration python: {'text': 'Add'}"
>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_header_link"
/>
</tal:block>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded"
/>
<tr>
<td>
select
</td>
<td>
//select[@name='field_your_select_action']
</td>
<td>
label=${original_title}
</td>
</tr>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog"
/>
<tal:block
tal:define=
"notification_configuration python: {'class': 'success',
'text': 'Template created.'}"
>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification"
/>
</tal:block>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded"
/>
<tr>
<td>
assertValue
</td>
<td>
name=field_my_title
</td>
<td>
${original_title}
</td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_doAction.py
View file @
e95b12d2
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
request
=
context
.
REQUEST
Base_translateString
=
portal
.
Base_translateString
Base_translateString
=
portal
.
Base_translateString
preserved_parameter_dict
=
{}
preserved_parameter_dict
=
{}
...
@@ -10,8 +11,8 @@ kw['keep_items'] = preserved_parameter_dict
...
@@ -10,8 +11,8 @@ kw['keep_items'] = preserved_parameter_dict
if
doAction0
==
'add'
:
if
doAction0
==
'add'
:
return
context
.
Folder_create
(
' '
.
join
(
Base_doAction
[
1
:]),
**
kw
)
return
context
.
Folder_create
(
' '
.
join
(
Base_doAction
[
1
:]),
**
kw
)
# Otherwise, check if this is an automatic menu (template)
# Otherwise, check if this is an automatic menu (template)
"""
elif
doAction0
==
'template'
:
elif
doAction0
==
'template'
:
template_relative_url
=
' '
.
join
(
Base_doAction
[
1
:])
template_relative_url
=
' '
.
join
(
Base_doAction
[
1
:])
template
=
context
.
getPortalObject
().
restrictedTraverse
(
template_relative_url
)
template
=
context
.
getPortalObject
().
restrictedTraverse
(
template_relative_url
)
...
@@ -23,14 +24,12 @@ elif doAction0 == 'template':
...
@@ -23,14 +24,12 @@ elif doAction0 == 'template':
new_content
=
context
[
new_content_id
]
new_content
=
context
[
new_content_id
]
new_content
.
makeTemplateInstance
()
new_content
.
makeTemplateInstance
()
preserved_parameter_dict
[
'portal_status_message'
]
=
Base_translateString
(
"Template created."
)
preserved_parameter_dict
[
'portal_status_message'
]
=
Base_translateString
(
"Template created."
)
re
direct_url = new_content.absolute_url(
)
re
turn
new_content
.
Base_redirect
(
keep_items
=
preserved_parameter_dict
)
else
:
else
:
preserved_parameter_dict['portal_status_message']
= Base_translateString("Template does not exist.")
message
=
Base_translateString
(
"Template does not exist."
)
redirect_url = context.absolute_url()
else
:
else
:
redirect_url = request['ACTUAL_URL']
message
=
Base_translateString
(
'Error: the action "%s" is not recognised.'
%
(
doAction0
,
))
preserved_parameter_dict['portal_status_message'] =
"""
request
.
RESPONSE
.
setStatus
(
400
)
message
=
Base_translateString
(
'Error: the action "%s" is not recognised.'
%
(
doAction0
,
))
context
.
REQUEST
.
RESPONSE
.
setStatus
(
400
)
return
context
.
Base_renderForm
(
dialog_id
,
message
=
message
,
level
=
'error'
)
return
context
.
Base_renderForm
(
dialog_id
,
message
=
message
,
level
=
'error'
)
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_getNewContentList.py
0 → 100644
View file @
e95b12d2
translate
=
context
.
Base_translateString
result_list
=
[(
translate
(
x
),
'add %s'
%
x
)
for
x
in
context
.
getVisibleAllowedContentTypeList
()]
# Template
document_template_list
=
context
.
getDocumentTemplateList
()
if
document_template_list
:
result_list
.
append
((
'-- %s --'
%
translate
(
'Templates'
),
None
))
for
document_template
in
document_template_list
:
result_list
.
append
((
document_template
.
getTitle
(),
'template %s'
%
document_template
.
getRelativeUrl
()))
return
result_list
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_getNewContentList.xml
0 → 100644
View file @
e95b12d2
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<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_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<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>
_params
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Base_getNewContentList
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_viewNewContentDialog/your_select_action.xml
View file @
e95b12d2
...
@@ -269,7 +269,7 @@
...
@@ -269,7 +269,7 @@
<dictionary>
<dictionary>
<item>
<item>
<key>
<string>
_text
</string>
</key>
<key>
<string>
_text
</string>
</key>
<value>
<string>
python:
[(here.Base_translateString(x), \'add %s\' % x) for x in context.getVisibleAllowedContentTypeList()]
</string>
</value>
<value>
<string>
python:
here.Base_getNewContentList()
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/portal_actions/make_template.xml
View file @
e95b12d2
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
category
</string>
</key>
<key>
<string>
category
</string>
</key>
<value>
<string>
object_action
</string>
</value>
<value>
<string>
object_
jio_
action
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
condition
</string>
</key>
<key>
<string>
condition
</string>
</key>
...
@@ -65,7 +65,7 @@
...
@@ -65,7 +65,7 @@
<dictionary>
<dictionary>
<item>
<item>
<key>
<string>
text
</string>
</key>
<key>
<string>
text
</string>
</key>
<value>
<string>
string:${object_url}/Base_
makeTemplateFromDocument
</string>
</value>
<value>
<string>
string:${object_url}/Base_
viewMakeTemplateFromDocumentDialog
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_makeTemplateFromDocument.py
View file @
e95b12d2
...
@@ -32,6 +32,6 @@ template.makeTemplate()
...
@@ -32,6 +32,6 @@ template.makeTemplate()
context
.
portal_caches
.
clearCacheFactory
(
'erp5_ui_short'
)
context
.
portal_caches
.
clearCacheFactory
(
'erp5_ui_short'
)
kw
[
'keep_items'
]
=
dict
(
portal_status_message
=
message
)
return
context
.
Base_redirect
(
form_id
,
return
context
.
Base_redirect
(
form_id
,
keep_items
=
dict
(
portal_status_message
=
message
),
**
kw
)
**
kw
)
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_viewMakeTemplateFromDocumentDialog.xml
0 → 100644
View file @
e95b12d2
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ERP5 Form"
module=
"erp5.portal_type"
/>
</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/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_objects
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
Base_makeTemplateFromDocument
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
edit_order
</string>
</key>
<value>
<list/>
</value>
</item>
<item>
<key>
<string>
encoding
</string>
</key>
<value>
<string>
UTF-8
</string>
</value>
</item>
<item>
<key>
<string>
enctype
</string>
</key>
<value>
<string>
multipart/form-data
</string>
</value>
</item>
<item>
<key>
<string>
group_list
</string>
</key>
<value>
<list>
<string>
Default
</string>
</list>
</value>
</item>
<item>
<key>
<string>
groups
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
Default
</string>
</key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Base_viewMakeTemplateFromDocumentDialog
</string>
</value>
</item>
<item>
<key>
<string>
method
</string>
</key>
<value>
<string>
POST
</string>
</value>
</item>
<item>
<key>
<string>
name
</string>
</key>
<value>
<string>
Base_viewMakeTemplateFromDocumentDialog
</string>
</value>
</item>
<item>
<key>
<string>
pt
</string>
</key>
<value>
<string>
form_dialog
</string>
</value>
</item>
<item>
<key>
<string>
row_length
</string>
</key>
<value>
<int>
4
</int>
</value>
</item>
<item>
<key>
<string>
stored_encoding
</string>
</key>
<value>
<string>
UTF-8
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Make Template
</string>
</value>
</item>
<item>
<key>
<string>
unicode_mode
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
update_action
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
update_action_title
</string>
</key>
<value>
<string></string>
</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