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
Alain Takoudjou
erp5
Commits
3acc54de
Commit
3acc54de
authored
Dec 08, 2017
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_web_renderjs_ui] Allow to display a document while keeping navigation history
command: display_with_history
parent
abf583ca
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
359 additions
and
6 deletions
+359
-6
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.js
...Item/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.js
+22
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.xml
...tem/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.xml
+2
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_router_js.js
...TemplateItem/web_page_module/rjs_gadget_erp5_router_js.js
+13
-0
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_router_js.xml
...emplateItem/web_page_module/rjs_gadget_erp5_router_js.xml
+2
-2
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_router_zuite/testCommandDisplayWithHistory.xml
...enderjs_ui_router_zuite/testCommandDisplayWithHistory.xml
+58
-0
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_router_zuite/testCommandDisplayWithHistory.zpt
...enderjs_ui_router_zuite/testCommandDisplayWithHistory.zpt
+115
-0
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_router_zuite/testCommandPushHistory.xml
...tests/renderjs_ui_router_zuite/testCommandPushHistory.xml
+58
-0
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_router_zuite/testCommandPushHistory.zpt
...tests/renderjs_ui_router_zuite/testCommandPushHistory.zpt
+89
-0
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.js
View file @
3acc54de
...
@@ -230,7 +230,11 @@
...
@@ -230,7 +230,11 @@
// by X-Location HTTP header placed by Base_redirect script
// by X-Location HTTP header placed by Base_redirect script
var
jio_key
=
new
URI
(
var
jio_key
=
new
URI
(
attachment
.
target
.
getResponseHeader
(
"
X-Location
"
)
attachment
.
target
.
getResponseHeader
(
"
X-Location
"
)
).
segment
(
2
);
).
segment
(
2
),
splitted_jio_key_list
,
splitted_current_jio_key_list
,
command
,
i
;
if
(
redirect_to_parent
)
{
if
(
redirect_to_parent
)
{
return
form_gadget
.
redirect
({
command
:
'
history_previous
'
});
return
form_gadget
.
redirect
({
command
:
'
history_previous
'
});
...
@@ -247,9 +251,25 @@
...
@@ -247,9 +251,25 @@
}
}
});
});
}
}
// Check if the redirection goes to a same parent's subdocument.
// In this case, do not add current document to the history
// example: when cloning, do not keep the original document in history
splitted_jio_key_list
=
jio_key
.
split
(
'
/
'
);
splitted_current_jio_key_list
=
form_gadget
.
state
.
jio_key
.
split
(
'
/
'
);
command
=
'
display_with_history
'
;
if
(
splitted_jio_key_list
.
length
===
splitted_current_jio_key_list
.
length
)
{
for
(
i
=
0
;
i
<
splitted_jio_key_list
.
length
-
1
;
i
+=
1
)
{
if
(
splitted_jio_key_list
[
i
]
!==
splitted_current_jio_key_list
[
i
])
{
command
=
'
push_history
'
;
}
}
}
else
{
command
=
'
push_history
'
;
}
// forced document change thus we update history
// forced document change thus we update history
return
form_gadget
.
redirect
({
return
form_gadget
.
redirect
({
command
:
'
push_history
'
,
command
:
command
,
options
:
{
options
:
{
"
jio_key
"
:
jio_key
"
jio_key
"
:
jio_key
// do not mingle with editable because it isn't necessary
// do not mingle with editable because it isn't necessary
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.xml
View file @
3acc54de
...
@@ -230,7 +230,7 @@
...
@@ -230,7 +230,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
96
2.55932.29202.54289
</string>
</value>
<value>
<string>
96
3.65326.20561.44834
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -248,7 +248,7 @@
...
@@ -248,7 +248,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
15
08331502.1
9
</float>
<float>
15
12740130.4
9
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_router_js.js
View file @
3acc54de
...
@@ -18,6 +18,8 @@
...
@@ -18,6 +18,8 @@
// Display a jio document with only the passed parameters
// Display a jio document with only the passed parameters
COMMAND_DISPLAY_STATE
=
"
display
"
,
COMMAND_DISPLAY_STATE
=
"
display
"
,
// Display a jio document with only the passed parameters + the history
COMMAND_KEEP_HISTORY_AND_DISPLAY_STATE
=
"
display_with_history
"
,
// Store the jio key for the person document of the user
// Store the jio key for the person document of the user
COMMAND_LOGIN
=
"
login
"
,
COMMAND_LOGIN
=
"
login
"
,
// Display a raw string URL
// Display a raw string URL
...
@@ -46,6 +48,7 @@
...
@@ -46,6 +48,7 @@
STICKY_PARAMETER_LIST
=
[
'
editable
'
];
STICKY_PARAMETER_LIST
=
[
'
editable
'
];
VALID_URL_COMMAND_DICT
[
COMMAND_DISPLAY_STATE
]
=
null
;
VALID_URL_COMMAND_DICT
[
COMMAND_DISPLAY_STATE
]
=
null
;
VALID_URL_COMMAND_DICT
[
COMMAND_KEEP_HISTORY_AND_DISPLAY_STATE
]
=
null
;
VALID_URL_COMMAND_DICT
[
COMMAND_DISPLAY_STORED_STATE
]
=
null
;
VALID_URL_COMMAND_DICT
[
COMMAND_DISPLAY_STORED_STATE
]
=
null
;
VALID_URL_COMMAND_DICT
[
COMMAND_CHANGE_STATE
]
=
null
;
VALID_URL_COMMAND_DICT
[
COMMAND_CHANGE_STATE
]
=
null
;
VALID_URL_COMMAND_DICT
[
COMMAND_STORE_AND_CHANGE_STATE
]
=
null
;
VALID_URL_COMMAND_DICT
[
COMMAND_STORE_AND_CHANGE_STATE
]
=
null
;
...
@@ -401,6 +404,13 @@
...
@@ -401,6 +404,13 @@
});
});
}
}
function
execKeepHistoryAndDisplayCommand
(
gadget
,
previous_options
,
next_options
)
{
next_options
.
selection
=
previous_options
.
selection
;
next_options
.
history
=
previous_options
.
history
;
copyStickyParameterDict
(
previous_options
,
next_options
);
return
execDisplayCommand
(
gadget
,
next_options
);
}
function
execSelectionNextCommand
(
gadget
,
previous_options
)
{
function
execSelectionNextCommand
(
gadget
,
previous_options
)
{
if
(
previous_options
.
selection
===
undefined
)
{
if
(
previous_options
.
selection
===
undefined
)
{
return
synchronousChangeState
(
return
synchronousChangeState
(
...
@@ -730,6 +740,9 @@
...
@@ -730,6 +740,9 @@
if
(
command_options
.
path
===
COMMAND_DISPLAY_STATE
)
{
if
(
command_options
.
path
===
COMMAND_DISPLAY_STATE
)
{
return
execDisplayCommand
(
gadget
,
next_options
);
return
execDisplayCommand
(
gadget
,
next_options
);
}
}
if
(
command_options
.
path
===
COMMAND_KEEP_HISTORY_AND_DISPLAY_STATE
)
{
return
execKeepHistoryAndDisplayCommand
(
gadget
,
previous_options
,
next_options
);
}
if
(
command_options
.
path
===
COMMAND_DISPLAY_STORED_STATE
)
{
if
(
command_options
.
path
===
COMMAND_DISPLAY_STORED_STATE
)
{
return
execDisplayStoredStateCommand
(
gadget
,
next_options
);
return
execDisplayStoredStateCommand
(
gadget
,
next_options
);
}
}
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_router_js.xml
View file @
3acc54de
...
@@ -232,7 +232,7 @@
...
@@ -232,7 +232,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
963.6
3967.25463.60364
</string>
</value>
<value>
<string>
963.6
5215.25184.4386
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -250,7 +250,7 @@
...
@@ -250,7 +250,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
1512
658596.82
</float>
<float>
1512
733510.73
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_router_zuite/testCommandDisplayWithHistory.xml
0 → 100644
View file @
3acc54de
<?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>
testCommandDisplayWithHistory
</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_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_router_zuite/testCommandDisplayWithHistory.zpt
0 → 100644
View file @
3acc54de
<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 Command Display With History
</title>
</head>
<body>
<table
cellpadding=
"1"
cellspacing=
"1"
border=
"1"
>
<thead>
<tr><td
rowspan=
"1"
colspan=
"3"
>
Test Command Display With History
</td></tr>
</thead><tbody>
<tal:block
metal:use-macro=
"here/PTZuite_CommonTemplate/macros/init"
/>
<tr>
<td>
open
</td>
<td>
${base_url}/web_site_module/renderjs_runner/#/foo_module
</td>
<td></td>
</tr>
<!-- Wait for gadget to be loaded -->
<tr>
<td>
waitForElementPresent
</td>
<td>
//div[@data-gadget-url='${base_url}/web_site_module/renderjs_runner/gadget_erp5_pt_form_list.html']
</td>
<td></td>
</tr>
<tr>
<td>
waitForTextPresent
</td>
<td>
Title 1
</td>
<td></td>
</tr>
<!-- Enter a search query to create a selection parameter -->
<tal:block
tal:define=
"parsed_query python: '';
search_query python: 'title'"
>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/search_in_form_list"
/>
</tal:block>
<tr>
<td>
click
</td>
<td>
//div[@data-gadget-scope='field_listbox']//a[text()='Title 1' and contains(@href, '#!index')]
</td>
<td></td>
</tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
//div[@data-gadget-url='${base_url}/web_site_module/renderjs_runner/gadget_erp5_pt_form_view.html']
</td>
<td></td>
</tr>
<tr>
<td>
waitForTextPresent
</td>
<td>
Actions
</td>
<td></td>
</tr>
<tr>
<td
colspan=
"3"
><b>
Clone the document
</b></td>
</tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
//div[@data-gadget-scope='header']//a[text()='Actions' and contains(@href, '#!change')]
</td>
<td></td>
</tr>
<tr>
<td>
click
</td>
<td>
//div[@data-gadget-scope='header']//a[text()='Actions' and contains(@href, '#!change')]
</td>
<td></td>
</tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
//div[@data-gadget-scope='m']//a[text()='Clone Document' and contains(@href, '#!change')]
</td>
<td></td>
</tr>
<tr>
<td>
click
</td>
<td>
//div[@data-gadget-scope='m']//a[text()='Clone Document' and contains(@href, '#!change')]
</td>
<td></td>
</tr>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog"
/>
<tr>
<td
colspan=
"3"
><b>
Ensure backlink redirect to module
</b></td>
</tr>
<tr>
<td>
waitForTextPresent
</td>
<td>
2
</td>
<td></td>
</tr>
<tr>
<td>
assertElementPresent
</td>
<td>
//div[@data-gadget-scope='header']//a[text()='Foo: Title 1' and contains(@href, '#!history_previous')]
</td>
<td></td>
</tr>
<tr>
<td>
click
</td>
<td>
//div[@data-gadget-scope='header']//a[text()='Foo: Title 1' and contains(@href, '#!history_previous')]
</td>
<td></td>
</tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
//div[@data-gadget-url='${base_url}/web_site_module/renderjs_runner/gadget_erp5_pt_form_list.html']
</td>
<td></td>
</tr>
<tr>
<td>
waitForTextPresent
</td>
<td>
Foos
</td>
<td></td>
</tr>
<tal:block
tal:define=
"parsed_query python: '';
search_query python: 'title'"
>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/check_search_in_form_list"
/>
</tal:block>
</tbody></table>
</body>
</html>
\ No newline at end of file
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_router_zuite/testCommandPushHistory.xml
0 → 100644
View file @
3acc54de
<?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>
testCommandPushHistory
</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_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_router_zuite/testCommandPushHistory.zpt
0 → 100644
View file @
3acc54de
<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 Command Display With History
</title>
</head>
<body>
<table
cellpadding=
"1"
cellspacing=
"1"
border=
"1"
>
<thead>
<tr><td
rowspan=
"1"
colspan=
"3"
>
Test Command Display With History
</td></tr>
</thead><tbody>
<tal:block
metal:use-macro=
"here/PTZuite_CommonTemplate/macros/init"
/>
<tr>
<td>
open
</td>
<td>
${base_url}/web_site_module/renderjs_runner/#/foo_module
</td>
<td></td>
</tr>
<!-- Wait for gadget to be loaded -->
<tr>
<td>
waitForElementPresent
</td>
<td>
//div[@data-gadget-url='${base_url}/web_site_module/renderjs_runner/gadget_erp5_pt_form_list.html']
</td>
<td></td>
</tr>
<tr>
<td>
waitForTextPresent
</td>
<td>
Title 1
</td>
<td></td>
</tr>
<!-- Enter a search query to create a selection parameter -->
<tal:block
tal:define=
"parsed_query python: '';
search_query python: 'title'"
>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/search_in_form_list"
/>
</tal:block>
<tr>
<td
colspan=
"3"
><b>
Add a document
</b></td>
</tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
//div[@data-gadget-scope='header']//a[text()='Add' and contains(@href, '#!change')]
</td>
<td></td>
</tr>
<tr>
<td>
click
</td>
<td>
//div[@data-gadget-scope='header']//a[text()='Add' and contains(@href, '#!change')]
</td>
<td></td>
</tr>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog"
/>
<tr>
<td
colspan=
"3"
><b>
Ensure backlink redirect to module
</b></td>
</tr>
<tr>
<td>
waitForTextPresent
</td>
<td>
2
</td>
<td></td>
</tr>
<tr>
<td>
assertElementPresent
</td>
<td>
//div[@data-gadget-scope='header']//a[text()='Foo: 2' and contains(@href, '#!history_previous')]
</td>
<td></td>
</tr>
<tr>
<td>
click
</td>
<td>
//div[@data-gadget-scope='header']//a[text()='Foo: 2' and contains(@href, '#!history_previous')]
</td>
<td></td>
</tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
//div[@data-gadget-url='${base_url}/web_site_module/renderjs_runner/gadget_erp5_pt_form_list.html']
</td>
<td></td>
</tr>
<tr>
<td>
waitForTextPresent
</td>
<td>
Foos
</td>
<td></td>
</tr>
<tal:block
tal:define=
"parsed_query python: '';
search_query python: 'title'"
>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/check_search_in_form_list"
/>
</tal:block>
</tbody></table>
</body>
</html>
\ No newline at end of file
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