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
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Lu Xu
erp5
Commits
46fc8be8
Commit
46fc8be8
authored
Jun 28, 2021
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_web_js_style: only include web section if configured in sitemap
parent
6245aa36
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
163 additions
and
7 deletions
+163
-7
bt5/erp5_web_js_style/SkinTemplateItem/portal_skins/erp5_web_js_style_ui/WebSite_generateNavigationHTML.py
...ns/erp5_web_js_style_ui/WebSite_generateNavigationHTML.py
+1
-1
bt5/erp5_web_js_style_test/PathTemplateItem/portal_tests/js_style_zuite/testJsStyleWebSiteEmptySitemap.xml
...l_tests/js_style_zuite/testJsStyleWebSiteEmptySitemap.xml
+58
-0
bt5/erp5_web_js_style_test/PathTemplateItem/portal_tests/js_style_zuite/testJsStyleWebSiteEmptySitemap.zpt
...l_tests/js_style_zuite/testJsStyleWebSiteEmptySitemap.zpt
+85
-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
+19
-6
No files found.
bt5/erp5_web_js_style/SkinTemplateItem/portal_skins/erp5_web_js_style_ui/WebSite_generateNavigationHTML.py
View file @
46fc8be8
...
@@ -46,7 +46,7 @@ result_list.append('</ul></nav>')
...
@@ -46,7 +46,7 @@ result_list.append('</ul></nav>')
# Sitemap
# Sitemap
result_list
.
append
(
'<nav id="sitemap">'
)
result_list
.
append
(
'<nav id="sitemap">'
)
result_list
.
append
(
'<a href="%s">%s</a>'
%
(
__
(
web_site
.
absolute_url
()),
_
(
web_site
.
getTranslatedTitle
())))
result_list
.
append
(
'<a href="%s">%s</a>'
%
(
__
(
web_site
.
absolute_url
()),
_
(
web_site
.
getTranslatedTitle
())))
generateSectionListHTML
(
result_list
,
web_site
.
WebSection_getSiteMapTree
(
depth
=
99
,
include_subsection
=
1
))
generateSectionListHTML
(
result_list
,
web_site
.
WebSection_getSiteMapTree
(
depth
=
99
))
result_list
.
append
(
'</nav>'
)
result_list
.
append
(
'</nav>'
)
return
''
.
join
(
result_list
)
return
''
.
join
(
result_list
)
bt5/erp5_web_js_style_test/PathTemplateItem/portal_tests/js_style_zuite/testJsStyleWebSiteEmptySitemap.xml
0 → 100644
View file @
46fc8be8
<?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>
testJsStyleWebSiteEmptySitemap
</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/testJsStyleWebSiteEmptySitemap.zpt
0 → 100644
View file @
46fc8be8
<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=empty_sitemap
</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>
waitForElementPresent
</td>
<td>
//header/h1[text()='JS Style Demo']
</td>
<td></td>
</tr>
<tr>
<td
colspan=
"3"
><b>
Check the page content uses the web site
</b></td>
</tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
//header/h1[text()='JS Style Demo']
</td>
<td></td>
</tr>
<tr>
<td>
assertElementPresent
</td>
<td>
//main[text()='Empty Sitemap']
</td>
<td></td>
</tr>
<tr>
<td>
assertElementPresent
</td>
<td>
//p[@id='gadget_style_url'][contains(text(), 'erp5_web_js_style_test_site/jsstyle_demo.html')]
</td>
<td></td>
</tr>
<tr>
<td>
assertElementPresent
</td>
<td>
//p[@id='render_count'][contains(text(), '1')]
</td>
<td></td>
</tr>
<tr>
<td
colspan=
"3"
><b>
Check that sitemap is empty
</b></td>
</tr>
<tr>
<td>
assertElementPresent
</td>
<td>
//nav[@id='sitemap']//a[text()='Empty Sitemap']
</td>
<td></td>
</tr>
<tr>
<td>
assertElementNotPresent
</td>
<td>
//nav[@id='sitemap']//a[text()='Demo Section 1']
</td>
<td></td>
</tr>
<tr>
<td>
assertElementNotPresent
</td>
<td>
//nav[@id='sitemap']//a[text()='Demo Section 11']
</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 @
46fc8be8
...
@@ -119,28 +119,34 @@ portal.portal_workflow.doActionFor(web_page, 'publish_action')
...
@@ -119,28 +119,34 @@ portal.portal_workflow.doActionFor(web_page, 'publish_action')
configuration_dict
=
{
configuration_dict
=
{
'nostyle'
:
{
'nostyle'
:
{
'title'
:
'No Style'
'title'
:
'No Style'
,
'site_map_section_parent'
:
True
},
},
'nostyleform'
:
{
'nostyleform'
:
{
'title'
:
"No Style Form"
,
'title'
:
"No Style Form"
,
'custom_render_method_id'
:
'WebSite_viewJSStyleTestDialog'
'custom_render_method_id'
:
'WebSite_viewJSStyleTestDialog'
,
'site_map_section_parent'
:
True
},
},
'section'
:
{
'section'
:
{
'configuration_style_gadget_url'
:
"jsstyle_demo.html"
,
'configuration_style_gadget_url'
:
"jsstyle_demo.html"
,
'title'
:
"Demo Style"
,
'title'
:
"Demo Style"
,
'site_map_section_parent'
:
True
},
},
'not_loading'
:
{
'not_loading'
:
{
'configuration_style_gadget_url'
:
"jsstyle_demo_not_loading.html"
,
'configuration_style_gadget_url'
:
"jsstyle_demo_not_loading.html"
,
'title'
:
"Not Loading Style"
,
'title'
:
"Not Loading Style"
,
'site_map_section_parent'
:
True
},
},
'favicon'
:
{
'favicon'
:
{
'title'
:
'Favicon'
,
'title'
:
'Favicon'
,
'configuration_favicon_url'
:
"favicon.ico"
'configuration_favicon_url'
:
"favicon.ico"
,
'site_map_section_parent'
:
True
},
},
'faviconform'
:{
'faviconform'
:{
'title'
:
'Favicon Form'
,
'title'
:
'Favicon Form'
,
'configuration_favicon_url'
:
"favicon.ico"
,
'configuration_favicon_url'
:
"favicon.ico"
,
'custom_render_method_id'
:
'WebSite_viewJSStyleTestDialog'
'custom_render_method_id'
:
'WebSite_viewJSStyleTestDialog'
,
'site_map_section_parent'
:
True
},
},
'language'
:
{
'language'
:
{
'configuration_style_gadget_url'
:
"jsstyle_demo.html"
,
'configuration_style_gadget_url'
:
"jsstyle_demo.html"
,
...
@@ -149,12 +155,18 @@ configuration_dict = {
...
@@ -149,12 +155,18 @@ configuration_dict = {
'language'
:
"en"
,
'language'
:
"en"
,
'aggregate_value'
:
module
.
restrictedTraverse
(
web_page_frontend_en_id
),
'aggregate_value'
:
module
.
restrictedTraverse
(
web_page_frontend_en_id
),
'title'
:
"Demo Style With Language"
,
'title'
:
"Demo Style With Language"
,
'site_map_section_parent'
:
True
},
},
'form'
:
{
'form'
:
{
'configuration_style_gadget_url'
:
"jsstyle_demo.html"
,
'configuration_style_gadget_url'
:
"jsstyle_demo.html"
,
'title'
:
"Demo Form"
,
'title'
:
"Demo Form"
,
'custom_render_method_id'
:
'WebSite_viewJSStyleTestDialog'
'custom_render_method_id'
:
'WebSite_viewJSStyleTestDialog'
,
'site_map_section_parent'
:
True
},
},
'empty_sitemap'
:
{
'title'
:
'Empty Sitemap'
,
'configuration_style_gadget_url'
:
"jsstyle_demo.html"
}
}
}
### Web site
### Web site
...
@@ -173,7 +185,8 @@ web_section = web_site.newContent(
...
@@ -173,7 +185,8 @@ web_section = web_site.newContent(
id
=
'%s1'
%
web_section_id_prefix
,
id
=
'%s1'
%
web_section_id_prefix
,
aggregate_value
=
web_site
.
getAggregateValue
(),
aggregate_value
=
web_site
.
getAggregateValue
(),
title
=
"Demo Section 1"
,
title
=
"Demo Section 1"
,
visible
=
True
visible
=
True
,
site_map_section_parent
=
True
)
)
web_section
.
newContent
(
web_section
.
newContent
(
portal_type
=
web_section_portal_type
,
portal_type
=
web_section_portal_type
,
...
...
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