Commit 46fc8be8 authored by Romain Courteaud's avatar Romain Courteaud

erp5_web_js_style: only include web section if configured in sitemap

parent 6245aa36
......@@ -46,7 +46,7 @@ result_list.append('</ul></nav>')
# Sitemap
result_list.append('<nav id="sitemap">')
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>')
return ''.join(result_list)
<?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>
<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
......@@ -119,28 +119,34 @@ portal.portal_workflow.doActionFor(web_page, 'publish_action')
configuration_dict = {
'nostyle': {
'title': 'No Style'
'title': 'No Style',
'site_map_section_parent': True
},
'nostyleform': {
'title': "No Style Form",
'custom_render_method_id': 'WebSite_viewJSStyleTestDialog'
'custom_render_method_id': 'WebSite_viewJSStyleTestDialog',
'site_map_section_parent': True
},
'section': {
'configuration_style_gadget_url': "jsstyle_demo.html",
'title': "Demo Style",
'site_map_section_parent': True
},
'not_loading': {
'configuration_style_gadget_url': "jsstyle_demo_not_loading.html",
'title': "Not Loading Style",
'site_map_section_parent': True
},
'favicon': {
'title': 'Favicon',
'configuration_favicon_url': "favicon.ico"
'configuration_favicon_url': "favicon.ico",
'site_map_section_parent': True
},
'faviconform':{
'title': 'Favicon Form',
'configuration_favicon_url': "favicon.ico",
'custom_render_method_id': 'WebSite_viewJSStyleTestDialog'
'custom_render_method_id': 'WebSite_viewJSStyleTestDialog',
'site_map_section_parent': True
},
'language': {
'configuration_style_gadget_url': "jsstyle_demo.html",
......@@ -149,12 +155,18 @@ configuration_dict = {
'language': "en",
'aggregate_value': module.restrictedTraverse(web_page_frontend_en_id),
'title': "Demo Style With Language",
'site_map_section_parent': True
},
'form': {
'configuration_style_gadget_url': "jsstyle_demo.html",
'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
......@@ -173,7 +185,8 @@ web_section = web_site.newContent(
id='%s1' % web_section_id_prefix,
aggregate_value=web_site.getAggregateValue(),
title="Demo Section 1",
visible=True
visible=True,
site_map_section_parent=True
)
web_section.newContent(
portal_type=web_section_portal_type,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment