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
1
Merge Requests
1
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
Titouan Soulard
erp5
Commits
292d2692
Commit
292d2692
authored
Jan 06, 2025
by
Romain Courteaud
🐸
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_web_js_style: display the page content even if the failover css style loading fails
parent
7832dc0c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
173 additions
and
7 deletions
+173
-7
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
+10
-7
bt5/erp5_web_js_style_test/PathTemplateItem/portal_tests/js_style_zuite/testJsStyleNotLoadingStyleAndNotLoadingDefaultCss.xml
...ite/testJsStyleNotLoadingStyleAndNotLoadingDefaultCss.xml
+62
-0
bt5/erp5_web_js_style_test/PathTemplateItem/portal_tests/js_style_zuite/testJsStyleNotLoadingStyleAndNotLoadingDefaultCss.zpt
...ite/testJsStyleNotLoadingStyleAndNotLoadingDefaultCss.zpt
+88
-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
+13
-0
No files found.
bt5/erp5_web_js_style/SkinTemplateItem/portal_skins/erp5_web_js_style_ui/jsstyle.js.js
View file @
292d2692
...
...
@@ -457,14 +457,17 @@
showPage
();
return
;
}
function
showContentAtAllCost
()
{
// Set again the page content after the css is loaded
// to prevent ugly rendering
// And if the css load fails,
// show the page content instead of a blank page
gadget
.
element
.
innerHTML
=
parsed_content
.
original_content
;
// Ensure the page is visible in case of error
showPage
();
}
return
new
RSVP
.
Queue
(
rJS
.
declareCSS
(
style_css_url
,
document
.
head
))
.
push
(
function
()
{
// Set again the page content after the css is loaded
// to prevent ugly rendering
gadget
.
element
.
innerHTML
=
parsed_content
.
original_content
;
// Ensure the page is visible in case of error
showPage
();
});
.
push
(
showContentAtAllCost
,
showContentAtAllCost
);
});
});
...
...
bt5/erp5_web_js_style_test/PathTemplateItem/portal_tests/js_style_zuite/testJsStyleNotLoadingStyleAndNotLoadingDefaultCss.xml
0 → 100644
View file @
292d2692
<?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=
"_reconstructor"
module=
"copy_reg"
/>
</klass>
<tuple>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
<global
name=
"object"
module=
"__builtin__"
/>
<none/>
</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>
testJsStyleNotLoadingStyleAndNotLoadingDefaultCss
</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/testJsStyleNotLoadingStyleAndNotLoadingDefaultCss.zpt
0 → 100644
View file @
292d2692
<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_loading_style_and_default_css
</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_loading.html']
</td>
<td></td>
</tr>
<tr>
<td>
assertElementPresent
</td>
<td>
css=html[hidden]
</td>
<td></td>
</tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
//head/link[@rel='stylesheet' and @href='jsstyle.css']
</td>
<td></td>
</tr>
<tr>
<td>
assertElementPresent
</td>
<td>
//head/link[@rel='stylesheet' and @href='jsstyle.css']
</td>
<td></td>
</tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
//nav[@id='sitemap']/a[text()='Not Loading Style And Default CSS']
</td>
<td></td>
</tr>
<tr>
<td>
assertElementNotPresent
</td>
<td>
css=html[hidden]
</td>
<td></td>
</tr>
<tr>
<td>
assertElementPresent
</td>
<td>
//nav[@id='sitemap']/a[text()='Not Loading Style And Default CSS']
</td>
<td></td>
</tr>
<tr>
<td>
assertElementPresent
</td>
<td>
//nav[@id='language']//a[@hreflang='en']
</td>
<td></td>
</tr>
<tr>
<td>
assertElementPresent
</td>
<td>
//div[@class='input']/span[@class='headline' and text()='Not Loading Style And Default CSS']
</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 @
292d2692
...
...
@@ -204,6 +204,12 @@ configuration_dict = {
'title'
:
"Not Loading Style"
,
'site_map_section_parent'
:
True
},
'not_loading_style_and_default_css'
:
{
'configuration_style_gadget_url'
:
"jsstyle_demo_not_loading.html"
,
'title'
:
"Not Loading Style And Default CSS"
,
'site_map_section_parent'
:
True
# create a web section with the css reference
},
'not_rendering'
:
{
'configuration_style_gadget_url'
:
"jsstyle_demo_not_rendering.html"
,
'title'
:
"Not Rendering Style"
,
...
...
@@ -330,4 +336,11 @@ if configuration in ('form', 'form_and_default_page'):
aggregate_value
=
web_site
.
getAggregateValue
()
)
if
configuration
in
(
'not_loading_style_and_default_css'
,
):
web_site
.
newContent
(
portal_type
=
web_section_portal_type
,
id
=
'jsstyle.css'
,
title
=
"This web section does not return CSS"
)
return
"Web Site created."
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