Skip to content

Commit e8c398d

Browse files
cekkmamico
andcommitted
Set a default view for Plone Site different by default_view because i… (#146)
* Set a default view for Plone Site different by default_view because in plone.restapi 9.15.2, layout is exposed and we don't need it because it broke agid layout * add view * test * zpretty * test for 3.9, 3.10 removed from gha --------- Co-authored-by: Mauro Amico <mauro.amico@gmail.com>
1 parent 18772d3 commit e8c398d

File tree

10 files changed

+179
-4
lines changed

10 files changed

+179
-4
lines changed

.github/workflows/tests.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ jobs:
1111
strategy:
1212
max-parallel: 4
1313
matrix:
14-
python: ["3.10", "3.11"]
14+
# python: ["3.8", "3.9", "3.10", "3.11"]
15+
# plone: ["52", "60"]
16+
python: ["3.11"]
1517
plone: ["60"]
1618
tz: ["UTC", "Europe/Rome"]
1719
steps:

CHANGES.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@ Changelog
33

44
5.5.13 (unreleased)
55
-------------------
6+
5.9.1 (unreleased)
7+
------------------
8+
- Exclude "teaser" to aavoid block mmodification by resolveuidseriializer
9+
[mamico]
10+
- Fix in resolveuid serializer if block is not a dict nor dict-like
11+
[mamico]
12+
- Make querystringsearch endpoint more customizable: now custom_query is defined in a separate method.
13+
[cekk]
14+
- fix file:/// as external link in summary
15+
[mamico]
16+
- Set a default view for Plone Site different by default_view because in plone.restapi 9.15.2 is exposed and we don't need it because it broke agid layout.
17+
[cekk]
618

719
- Nothing changed yet.
820

src/redturtle/volto/browser/configure.zcml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,13 @@
9696
permission="zope2.View"
9797
layer="redturtle.volto.interfaces.IRedturtleVoltoLayer"
9898
/>
99+
100+
<browser:page
101+
name="homepage_view"
102+
for="plone.base.interfaces.IPloneSiteRoot"
103+
class="plone.app.dexterity.browser.folder_listing.FolderView"
104+
template="templates/homepage_view.pt"
105+
permission="zope2.View"
106+
layer="redturtle.volto.interfaces.IRedturtleVoltoLayer"
107+
/>
99108
</configure>
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
<html xmlns="http://www.w3.org/1999/xhtml"
2+
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
3+
xmlns:metal="http://xml.zope.org/namespaces/metal"
4+
xmlns:tal="http://xml.zope.org/namespaces/tal" lang="en" metal:use-macro="context/@@main_template/macros/master" xml:lang="en" i18n:domain="plone">
5+
<body>
6+
7+
<metal:content-core fill-slot="content-core">
8+
<metal:block define-macro="content-core">
9+
10+
<metal:listingmacro define-macro="listing">
11+
<tal:results define="
12+
batch view/batch;
13+
">
14+
<tal:listing condition="batch">
15+
<div class="entries" metal:define-slot="entries">
16+
<tal:repeat metal:define-macro="entries" repeat="item batch">
17+
<tal:block tal:define="
18+
obj item/getObject;
19+
item_url item/getURL;
20+
item_id item/getId;
21+
item_title item/Title;
22+
item_description item/Description;
23+
item_type item/PortalType;
24+
item_modified item/ModificationDate;
25+
item_created item/CreationDate;
26+
item_type_class python:'contenttype-' + view.normalizeString(item_type);
27+
item_wf_state item/review_state;
28+
item_wf_state_class python:'state-' + view.normalizeString(item_wf_state);
29+
item_creator item/Creator;
30+
item_link python:item_type in view.use_view_action and item_url+'/view' or item_url;
31+
item_has_image python:item.getIcon;
32+
">
33+
<metal:block define-slot="entry">
34+
<article class="entry">
35+
<header metal:define-macro="listitem">
36+
<span class="summary" tal:attributes="
37+
title item_type;
38+
">
39+
<a tal:attributes="
40+
href item_link;
41+
">
42+
<img class="image-tile" tal:condition="item_has_image" tal:attributes="
43+
src string:$item_url/@@images/image/tile;
44+
" />
45+
</a>
46+
<a tal:content="python: item_title or item_id" tal:attributes="
47+
href item_link;
48+
class string:$item_type_class $item_wf_state_class url;
49+
title item_type;
50+
">
51+
52+
Item Title
53+
</a>
54+
</span>
55+
<metal:block metal:define-macro="document_byline">
56+
<div class="documentByLine">
57+
<tal:byline condition="view/show_about">
58+
&mdash;
59+
<tal:name tal:define="
60+
author python:view.pas_member.info(item_creator);
61+
creator_short_form author/username;
62+
creator_long_form string:?author=${author/username};
63+
creator_is_openid python:'/' in creator_short_form;
64+
creator_id python:(creator_short_form, creator_long_form)[creator_is_openid];
65+
" tal:condition="item_creator">
66+
<span i18n:translate="label_by_author">
67+
by
68+
<a tal:content="author/name_or_id" tal:omit-tag="not:author" tal:attributes="
69+
href string:${view/navigation_root_url}/author/${item_creator};
70+
" i18n:name="author">
71+
Bob Dobalina
72+
</a>
73+
</span>
74+
</tal:name>
75+
76+
<tal:modified>
77+
&mdash;
78+
<tal:mod i18n:translate="box_last_modified">last modified</tal:mod>
79+
<span tal:replace="python:view.toLocalizedTime(item_modified,long_format=1)">
80+
August 16, 2001 at 23:35:59
81+
</span>
82+
</tal:modified>
83+
84+
<metal:description define-slot="description_slot">
85+
<tal:comment replace="nothing">
86+
Place custom listing info for custom types here
87+
</tal:comment>
88+
</metal:description>
89+
</tal:byline>
90+
</div>
91+
</metal:block>
92+
</header>
93+
<p class="description discreet" tal:condition="item_description" tal:content="item_description">
94+
description
95+
</p>
96+
</article>
97+
</metal:block>
98+
</tal:block>
99+
</tal:repeat>
100+
</div>
101+
102+
<div metal:use-macro="context/batch_macros/macros/navigation"></div>
103+
104+
</tal:listing>
105+
106+
<metal:empty metal:define-slot="no_items_in_listing">
107+
<p class="discreet" tal:condition="not: view/batch" tal:content="view/no_items_message">
108+
There are currently no items in this folder.
109+
</p>
110+
</metal:empty>
111+
112+
</tal:results>
113+
</metal:listingmacro>
114+
115+
</metal:block>
116+
</metal:content-core>
117+
118+
</body>
119+
</html>

src/redturtle/volto/profiles/default/metadata.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<metadata>
3-
<version>4308</version>
3+
<version>4309</version>
44
<dependencies>
55
<dependency>profile-plone.volto:default</dependency>
66
<dependency>profile-plone.app.caching:with-caching-proxy</dependency>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0"?>
2+
<object
3+
i18n:domain="plone"
4+
meta_type="Dexterity FTI"
5+
name="Plone Site"
6+
xmlns:i18n="http://xml.zope.org/namespaces/i18n">
7+
8+
<property name="behaviors" purge="false">
9+
<element value="kitconcept.seo" />
10+
</property>
11+
12+
<!--
13+
these are needed because plone.restapi 9.15.2 add layout to SiteRoot serializer.
14+
This will broke agid-like themese because will render also title and description in homepage
15+
-->
16+
<property name="default_view">homepage_view</property>
17+
<property name="immediate_view">homepage_view</property>
18+
</object>
19+

src/redturtle/volto/upgrades.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,3 +594,9 @@ def should_reindex(blocks):
594594
logger.info(f"Reindex complete. Reindexed {len(reindexed)} contents:")
595595
for url in reindexed:
596596
logger.info(f"- {url}")
597+
598+
599+
def to_4309(context):
600+
portal_types = api.portal.get_tool(name="portal_types")
601+
portal_types["Plone Site"].default_view = "homepage_view"
602+
portal_types["Plone Site"].immediate_view = "homepage_view"

src/redturtle/volto/upgrades.zcml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,4 +256,12 @@
256256
destination="4308"
257257
handler=".upgrades.to_4308"
258258
/>
259+
<genericsetup:upgradeStep
260+
title="Set default and immediate view for Plone Site"
261+
description=""
262+
profile="redturtle.volto:default"
263+
source="4308"
264+
destination="4309"
265+
handler=".upgrades.to_4309"
266+
/>
259267
</configure>

test_plone52.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[buildout]
22

33
extends =
4-
https://raw.github.com/collective/buildout.plonetest/master/test-5.2.x.cfg
4+
https://raw.githubusercontent.com/collective/buildout.plonetest/refs/heads/master/test-5.2.x.cfg
55
https://raw.githubusercontent.com/collective/buildout.plonetest/master/qa.cfg
66
base.cfg
77

test_plone60.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[buildout]
22

33
extends =
4-
https://raw.github.com/collective/buildout.plonetest/master/test-6.0.x.cfg
4+
https://raw.githubusercontent.com/collective/buildout.plonetest/refs/heads/master/test-6.0.x.cfg
55
https://raw.githubusercontent.com/collective/buildout.plonetest/master/qa.cfg
66
https://raw.githubusercontent.com/RedTurtle/iocomune-backend/main/versions.cfg
77
base.cfg

0 commit comments

Comments
 (0)