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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sebastien Robin
erp5
Commits
388a882e
Commit
388a882e
authored
Feb 15, 2023
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_web_js_style: ensure the page is visible in case of loading/rendering error
parent
38f1b59a
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
242 additions
and
0 deletions
+242
-0
bt5/erp5_web_js_style/SkinTemplateItem/portal_skins/erp5_web_js_style_ui/jsstyle.js.js
...plateItem/portal_skins/erp5_web_js_style_ui/jsstyle.js.js
+4
-0
bt5/erp5_web_js_style_test/PathTemplateItem/portal_tests/js_style_zuite/testJsStyleDemoStyle.zpt
...Item/portal_tests/js_style_zuite/testJsStyleDemoStyle.zpt
+10
-0
bt5/erp5_web_js_style_test/PathTemplateItem/portal_tests/js_style_zuite/testJsStyleNotLoadingStyle.zpt
...ortal_tests/js_style_zuite/testJsStyleNotLoadingStyle.zpt
+10
-0
bt5/erp5_web_js_style_test/PathTemplateItem/portal_tests/js_style_zuite/testJsStyleRenderErrorStyle.xml
...rtal_tests/js_style_zuite/testJsStyleRenderErrorStyle.xml
+58
-0
bt5/erp5_web_js_style_test/PathTemplateItem/portal_tests/js_style_zuite/testJsStyleRenderErrorStyle.zpt
...rtal_tests/js_style_zuite/testJsStyleRenderErrorStyle.zpt
+71
-0
bt5/erp5_web_js_style_test/SkinTemplateItem/portal_skins/erp5_web_js_style_test/ERP5Site_createWebJSStyleZuiteTestData.py
...b_js_style_test/ERP5Site_createWebJSStyleZuiteTestData.py
+5
-0
bt5/erp5_web_js_style_test/SkinTemplateItem/portal_skins/erp5_web_js_style_test/jsstyle_demo_not_rendering.html.html
...p5_web_js_style_test/jsstyle_demo_not_rendering.html.html
+9
-0
bt5/erp5_web_js_style_test/SkinTemplateItem/portal_skins/erp5_web_js_style_test/jsstyle_demo_not_rendering.html.xml
...rp5_web_js_style_test/jsstyle_demo_not_rendering.html.xml
+32
-0
bt5/erp5_web_js_style_test/SkinTemplateItem/portal_skins/erp5_web_js_style_test/jsstyle_demo_not_rendering.js.js
...s/erp5_web_js_style_test/jsstyle_demo_not_rendering.js.js
+11
-0
bt5/erp5_web_js_style_test/SkinTemplateItem/portal_skins/erp5_web_js_style_test/jsstyle_demo_not_rendering.js.xml
.../erp5_web_js_style_test/jsstyle_demo_not_rendering.js.xml
+32
-0
No files found.
bt5/erp5_web_js_style/SkinTemplateItem/portal_skins/erp5_web_js_style_ui/jsstyle.js.js
View file @
388a882e
...
@@ -453,6 +453,8 @@
...
@@ -453,6 +453,8 @@
if
(
style_css_url
===
null
)
{
if
(
style_css_url
===
null
)
{
// Compatibility with old html format (like in google cache)
// Compatibility with old html format (like in google cache)
gadget
.
element
.
innerHTML
=
parsed_content
.
original_content
;
gadget
.
element
.
innerHTML
=
parsed_content
.
original_content
;
// Ensure the page is visible in case of error
showPage
();
return
;
return
;
}
}
return
new
RSVP
.
Queue
(
rJS
.
declareCSS
(
style_css_url
,
document
.
head
))
return
new
RSVP
.
Queue
(
rJS
.
declareCSS
(
style_css_url
,
document
.
head
))
...
@@ -460,6 +462,8 @@
...
@@ -460,6 +462,8 @@
// Set again the page content after the css is loaded
// Set again the page content after the css is loaded
// to prevent ugly rendering
// to prevent ugly rendering
gadget
.
element
.
innerHTML
=
parsed_content
.
original_content
;
gadget
.
element
.
innerHTML
=
parsed_content
.
original_content
;
// Ensure the page is visible in case of error
showPage
();
});
});
});
});
});
});
...
...
bt5/erp5_web_js_style_test/PathTemplateItem/portal_tests/js_style_zuite/testJsStyleDemoStyle.zpt
View file @
388a882e
...
@@ -37,12 +37,22 @@
...
@@ -37,12 +37,22 @@
<td>
//head/link[@rel='prerender' and @href='jsstyle_demo.html']
</td>
<td>
//head/link[@rel='prerender' and @href='jsstyle_demo.html']
</td>
<td></td>
<td></td>
</tr>
</tr>
<tr>
<td>
assertElementPresent
</td>
<td>
css=html[hidden]
</td>
<td></td>
</tr>
<tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
waitForElementPresent
</td>
<td>
//header/h1[text()='JS Style Demo']
</td>
<td>
//header/h1[text()='JS Style Demo']
</td>
<td></td>
<td></td>
</tr>
</tr>
<tr>
<td>
assertElementNotPresent
</td>
<td>
css=html[hidden]
</td>
<td></td>
</tr>
<tr>
<tr>
<td>
assertElementPresent
</td>
<td>
assertElementPresent
</td>
<td>
//header/h1[text()='JS Style Demo']
</td>
<td>
//header/h1[text()='JS Style Demo']
</td>
...
...
bt5/erp5_web_js_style_test/PathTemplateItem/portal_tests/js_style_zuite/testJsStyleNotLoadingStyle.zpt
View file @
388a882e
...
@@ -37,6 +37,11 @@
...
@@ -37,6 +37,11 @@
<td>
//head/link[@rel='prerender' and @href='jsstyle_demo_not_loading.html']
</td>
<td>
//head/link[@rel='prerender' and @href='jsstyle_demo_not_loading.html']
</td>
<td></td>
<td></td>
</tr>
</tr>
<tr>
<td>
assertElementPresent
</td>
<td>
css=html[hidden]
</td>
<td></td>
</tr>
<tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
waitForElementPresent
</td>
...
@@ -55,6 +60,11 @@
...
@@ -55,6 +60,11 @@
<td>
//nav[@id='sitemap']/a[text()='Not Loading Style']
</td>
<td>
//nav[@id='sitemap']/a[text()='Not Loading Style']
</td>
<td></td>
<td></td>
</tr>
</tr>
<tr>
<td>
assertElementNotPresent
</td>
<td>
css=html[hidden]
</td>
<td></td>
</tr>
<tr>
<tr>
<td>
assertElementPresent
</td>
<td>
assertElementPresent
</td>
<td>
//nav[@id='sitemap']/a[text()='Not Loading Style']
</td>
<td>
//nav[@id='sitemap']/a[text()='Not Loading Style']
</td>
...
...
bt5/erp5_web_js_style_test/PathTemplateItem/portal_tests/js_style_zuite/testJsStyleRenderErrorStyle.xml
0 → 100644
View file @
388a882e
<?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>
testJsStyleRenderErrorStyle
</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_js_style_test/PathTemplateItem/portal_tests/js_style_zuite/testJsStyleRenderErrorStyle.zpt
0 → 100644
View file @
388a882e
<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 JS Style Demo Style
</title>
</head>
<body>
<table
cellpadding=
"1"
cellspacing=
"1"
border=
"1"
>
<thead>
<tr><td
rowspan=
"1"
colspan=
"3"
>
Test JS Style Demo Style
</td></tr>
</thead><tbody>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplate/macros/init"
/>
<tr>
<td>
open
</td>
<td>
${base_url}/ERP5Site_createWebJSStyleZuiteTestData?configuration=not_rendering
</td>
<td></td>
</tr>
<tr>
<td>
assertTextPresent
</td>
<td>
Web Site created.
</td>
<td></td>
</tr>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplate/macros/wait_for_activities"
/>
<!-- Initialize -->
<tr>
<td>
open
</td>
<td>
${base_url}/web_site_module/erp5_web_js_style_test_site/
</td>
<td></td>
</tr>
<tr>
<td>
assertElementPresent
</td>
<td>
//head/link[@rel='prerender' and @href='jsstyle_demo_not_rendering.html']
</td>
<td></td>
</tr>
<tr>
<td>
assertElementPresent
</td>
<td>
css=html[hidden]
</td>
<td></td>
</tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
//h1[text()='Unhandled Error']
</td>
<td></td>
</tr>
<tr>
<td>
assertElementPresent
</td>
<td>
//h1[text()='Unhandled Error']
</td>
<td></td>
</tr>
<tr>
<td>
assertElementNotPresent
</td>
<td>
css=html[hidden]
</td>
<td></td>
</tr>
<tr>
<td>
assertElementPresent
</td>
<td>
//h2[text()='Demo error during render']
</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
bt5/erp5_web_js_style_test/SkinTemplateItem/portal_skins/erp5_web_js_style_test/ERP5Site_createWebJSStyleZuiteTestData.py
View file @
388a882e
...
@@ -199,6 +199,11 @@ configuration_dict = {
...
@@ -199,6 +199,11 @@ configuration_dict = {
'title'
:
"Not Loading Style"
,
'title'
:
"Not Loading Style"
,
'site_map_section_parent'
:
True
'site_map_section_parent'
:
True
},
},
'not_rendering'
:
{
'configuration_style_gadget_url'
:
"jsstyle_demo_not_rendering.html"
,
'title'
:
"Not Rendering Style"
,
'site_map_section_parent'
:
True
},
'favicon'
:
{
'favicon'
:
{
'title'
:
'Favicon'
,
'title'
:
'Favicon'
,
'configuration_favicon_url'
:
"favicon.ico"
,
'configuration_favicon_url'
:
"favicon.ico"
,
...
...
bt5/erp5_web_js_style_test/SkinTemplateItem/portal_skins/erp5_web_js_style_test/jsstyle_demo_not_rendering.html.html
0 → 100644
View file @
388a882e
<html>
<head>
<script
src=
"portal_skins/erp5_xhtml_style/rsvp.js"
></script>
<script
src=
"portal_skins/erp5_xhtml_style/renderjs.js"
></script>
<script
src=
"jsstyle_demo_not_rendering.js"
></script>
</head>
<body>
</body>
</html>
\ No newline at end of file
bt5/erp5_web_js_style_test/SkinTemplateItem/portal_skins/erp5_web_js_style_test/jsstyle_demo_not_rendering.html.xml
0 → 100644
View file @
388a882e
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"File"
module=
"OFS.Image"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_Cacheable__manager_id
</string>
</key>
<value>
<string>
http_cache
</string>
</value>
</item>
<item>
<key>
<string>
__name__
</string>
</key>
<value>
<string>
jsstyle_demo_not_rendering.html
</string>
</value>
</item>
<item>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
text/html
</string>
</value>
</item>
<item>
<key>
<string>
precondition
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_web_js_style_test/SkinTemplateItem/portal_skins/erp5_web_js_style_test/jsstyle_demo_not_rendering.js.js
0 → 100644
View file @
388a882e
/*globals window, rJS*/
/*jslint indent: 2, maxlen: 80*/
(
function
(
window
,
rJS
)
{
"
use strict
"
;
rJS
(
window
)
.
declareMethod
(
"
render
"
,
function
()
{
throw
new
Error
(
'
Demo error during render
'
);
});
}(
window
,
rJS
));
\ No newline at end of file
bt5/erp5_web_js_style_test/SkinTemplateItem/portal_skins/erp5_web_js_style_test/jsstyle_demo_not_rendering.js.xml
0 → 100644
View file @
388a882e
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"File"
module=
"OFS.Image"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_Cacheable__manager_id
</string>
</key>
<value>
<string>
http_cache
</string>
</value>
</item>
<item>
<key>
<string>
__name__
</string>
</key>
<value>
<string>
jsstyle_demo_not_rendering.js
</string>
</value>
</item>
<item>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
application/javascript
</string>
</value>
</item>
<item>
<key>
<string>
precondition
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
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