Commit ee6119c7 authored by Romain Courteaud's avatar Romain Courteaud

erp5_web_js_style: use effective_date as document published date

Fallback to modification_date if a document does not have an effective_date.
parent 537aebad
......@@ -28,6 +28,7 @@ def generateDocumentListHTML(result_list, document_list):
if (document_list):
result_list.append('<aside id="document_list"><ul class="h-feed">')
for section in document_list:
publication_date = section['effective_date'] or section['modification_date']
result_list.append("""
<li class="h-entry">
<div class="e-content">
......@@ -41,8 +42,8 @@ def generateDocumentListHTML(result_list, document_list):
('<p class="p-summary">%s</p>' % _(section['description'])) if section.get('description') else '',
('<p class="p-author h-card">%s</p>' % _(section['document'].Document_getContributorTitleList()[0])),
__(section['url']),
__(section['modification_date'].HTML4()),
_(section['modification_date'].rfc822())
__(publication_date.HTML4()),
_(publication_date.rfc822())
))
result_list.append('</ul></aside>')
......@@ -75,6 +76,6 @@ result_list.append('</nav>')
# Documents
if include_document:
generateDocumentListHTML(result_list, web_section.WebSection_getSiteMapTree(include_subsection=False, exclude_default_document=True, depth=1, property_mapping=('translated_title', 'description', 'modification_date')))
generateDocumentListHTML(result_list, web_section.WebSection_getSiteMapTree(include_subsection=False, exclude_default_document=True, depth=1, property_mapping=('translated_title', 'description', 'effective_date', 'modification_date')))
return ''.join(result_list)
......@@ -90,7 +90,7 @@
</tr>
<tr>
<td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td>
<td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td>
</tr>
......
......@@ -83,7 +83,7 @@
</tr>
<tr>
<td>assertElementPresent</td>
<td>//aside[@id='document_list']//ul[@class="h-feed"]//li[@class="h-entry"]//a[@class="u-url" and @rel='permalink' and contains(@href, 'web_site_module/erp5_web_js_style_test_site/erp5_web_js_style_test_contentpage')]//time[@class="dt-published" and contains(@datetime, 'T')]</td>
<td>//aside[@id='document_list']//ul[@class="h-feed"]//li[@class="h-entry"]//a[@class="u-url" and @rel='permalink' and contains(@href, 'web_site_module/erp5_web_js_style_test_site/erp5_web_js_style_test_contentpage')]//time[@class="dt-published" and text()='Tue, 13 Dec 2011 11:22:33 +0500' and @datetime='2011-12-13T06:22:33Z']</td>
<td></td>
</tr>
......
......@@ -78,7 +78,7 @@
</tr>
<tr>
<td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td>
<td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td>
</tr>
......@@ -341,7 +341,7 @@
</tr>
<tr>
<td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td>
<td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td>
</tr>
......
......@@ -78,7 +78,7 @@
</tr>
<tr>
<td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td>
<td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td>
</tr>
......@@ -315,7 +315,7 @@
</tr>
<tr>
<td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td>
<td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td>
</tr>
......
......@@ -73,7 +73,7 @@
</tr>
<tr>
<td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td>
<td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td>
</tr>
......@@ -143,7 +143,7 @@
</tr>
<tr>
<td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td>
<td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td>
</tr>
......@@ -213,7 +213,7 @@
</tr>
<tr>
<td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td>
<td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td>
</tr>
......@@ -283,7 +283,7 @@
</tr>
<tr>
<td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td>
<td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td>
</tr>
......
......@@ -73,7 +73,7 @@
</tr>
<tr>
<td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td>
<td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td>
</tr>
......@@ -143,7 +143,7 @@
</tr>
<tr>
<td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td>
<td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td>
</tr>
......@@ -213,7 +213,7 @@
</tr>
<tr>
<td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td>
<td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td>
</tr>
......@@ -283,7 +283,7 @@
</tr>
<tr>
<td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td>
<td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td>
</tr>
......
......@@ -73,7 +73,7 @@
</tr>
<tr>
<td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td>
<td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td>
</tr>
......@@ -138,7 +138,7 @@
</tr>
<tr>
<td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td>
<td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td>
</tr>
......@@ -203,7 +203,7 @@
</tr>
<tr>
<td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td>
<td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td>
</tr>
......@@ -268,7 +268,7 @@
</tr>
<tr>
<td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td>
<td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td>
</tr>
......
......@@ -78,7 +78,7 @@
</tr>
<tr>
<td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td>
<td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td>
</tr>
......@@ -139,7 +139,7 @@
</tr>
<tr>
<td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td>
<td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td>
</tr>
......@@ -209,7 +209,7 @@
</tr>
<tr>
<td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td>
<td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td>
</tr>
......@@ -270,7 +270,7 @@
</tr>
<tr>
<td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td>
<td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td>
</tr>
......
......@@ -78,7 +78,7 @@
</tr>
<tr>
<td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td>
<td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td>
</tr>
......@@ -178,7 +178,7 @@
</tr>
<tr>
<td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td>
<td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td>
</tr>
......@@ -248,7 +248,7 @@
</tr>
<tr>
<td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td>
<td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td>
</tr>
......@@ -348,7 +348,7 @@
</tr>
<tr>
<td>assertElementPresent</td>
<td>//aside[@id='document_list']//p[contains(text(), 'Date: ') and contains(text(), 'GMT')]</td>
<td>//aside[@id='document_list']//p[text()='Date: Tue, 13 Dec 2011 06:22:33 GMT']</td>
<td></td>
</tr>
......
......@@ -34,6 +34,8 @@ web_page_content_en_id = "erp5_web_js_style_test_contentpage_en"
web_page_content_fr_id = "erp5_web_js_style_test_contentpage_fr"
web_page_content_zh_id = "erp5_web_js_style_test_contentpage_zh"
publicate_date = DateTime('2011/12/13 11:22:33 GMT+5')
### English web page
module = portal.getDefaultModule(web_page_portal_type)
if getattr(module, web_page_frontend_en_id, None) is not None:
......@@ -43,6 +45,7 @@ web_page = module.newContent(
id=web_page_frontend_en_id,
reference=web_page_frontend_reference,
contributor_value=contributor,
effective_date=publicate_date,
language="en",
version="001",
text_content="""
......@@ -61,6 +64,7 @@ web_page = module.newContent(
id=web_page_content_en_id,
reference=web_page_content_reference,
contributor_value=contributor,
effective_date=publicate_date,
title="%s title" % web_page_content_reference,
description="%s description" % web_page_content_reference,
language="en",
......@@ -79,6 +83,7 @@ web_page = module.newContent(
id=web_page_frontend_fr_id,
reference=web_page_frontend_reference,
contributor_value=contributor,
effective_date=publicate_date,
language="fr",
version="001",
text_content="""
......@@ -97,6 +102,7 @@ web_page = module.newContent(
id=web_page_content_fr_id,
reference=web_page_content_reference,
contributor_value=contributor,
effective_date=publicate_date,
title="%s title" % web_page_content_reference,
description="%s description" % web_page_content_reference,
language="fr",
......@@ -115,6 +121,7 @@ web_page = module.newContent(
id=web_page_frontend_zh_id,
reference=web_page_frontend_reference,
contributor_value=contributor,
effective_date=publicate_date,
language="zh",
version="001",
text_content="""
......@@ -133,6 +140,7 @@ web_page = module.newContent(
id=web_page_content_zh_id,
reference=web_page_content_reference,
contributor_value=contributor,
effective_date=publicate_date,
title="%s title" % web_page_content_reference,
description="%s description" % web_page_content_reference,
language="zh",
......
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