Skip to content

Commit 9f075b4

Browse files
committed
Merge branch 'main' into example-content-organisation
2 parents 02e7e11 + 3837f35 commit 9f075b4

54 files changed

Lines changed: 219 additions & 130 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

backend/news/+example_org.internal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add example content for organisational unit. @tisto

backend/news/+rss_example.internal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add RSS block example content @iRohitSingh

backend/news/139.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Move Location and Organisational Unit fields to Categorization fieldset. @davisagli

backend/src/kitconcept/intranet/behaviors/configure.zcml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,14 @@
2222
name="kitconcept.intranet.location"
2323
title="Location"
2424
description="Fields for Location"
25-
factory=".location.LocationAdapter"
2625
provides=".location.ILocationBehavior"
27-
for=".location.ILocationMarker"
28-
marker=".location.ILocationMarker"
2926
/>
3027

3128
<plone:behavior
3229
name="kitconcept.intranet.organisational_unit"
3330
title="Organisational Unit"
3431
description="Fields for Organisational Unit"
35-
factory=".organisational_unit.OrganisationalUnitAdapter"
3632
provides=".organisational_unit.IOrganisationalUnitBehavior"
37-
for=".organisational_unit.IOrganisationalUnitMarker"
38-
marker=".organisational_unit.IOrganisationalUnitMarker"
3933
/>
4034

4135
<plone:behavior
Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,19 @@
11
from kitconcept.intranet import _
2+
from plone.autoform.directives import order_after
23
from plone.autoform.interfaces import IFormFieldProvider
3-
from z3c.relationfield.relation import RelationValue
4+
from plone.supermodel import model
45
from z3c.relationfield.schema import RelationChoice
5-
from zope.interface import Interface
6-
from zope.interface import implementer
76
from zope.interface import provider
87

98

10-
class ILocationMarker(Interface):
11-
"""Marker interface for content items that use ILocationBehavior behavior."""
12-
13-
149
@provider(IFormFieldProvider)
15-
class ILocationBehavior(ILocationMarker):
10+
class ILocationBehavior(model.Schema):
1611
"""Behavior: Select a Location from a vocabulary."""
1712

13+
model.fieldset("categorization", fields=["location_reference"])
14+
order_after(location_reference="subjects")
1815
location_reference = RelationChoice(
1916
title=_("Location"),
2017
vocabulary="kitconcept.intranet.vocabularies.location_objects",
2118
required=False,
2219
)
23-
24-
25-
@implementer(ILocationBehavior)
26-
class LocationAdapter:
27-
"""Behavior class for location."""
28-
29-
def __init__(self, context):
30-
self.context = context
31-
32-
@property
33-
def location_reference(self) -> RelationValue | None:
34-
return self.context.location_reference
35-
36-
@location_reference.setter
37-
def location_reference(self, value: RelationValue | None):
38-
self.context.location_reference = value
Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,19 @@
11
from kitconcept.intranet import _
2+
from plone.autoform.directives import order_after
23
from plone.autoform.interfaces import IFormFieldProvider
3-
from z3c.relationfield.relation import RelationValue
4+
from plone.supermodel import model
45
from z3c.relationfield.schema import RelationChoice
5-
from zope.interface import Interface
6-
from zope.interface import implementer
76
from zope.interface import provider
87

98

10-
class IOrganisationalUnitMarker(Interface):
11-
"""Marker interface for content items that use IOrganisationalUnitBehavior
12-
behavior."""
13-
14-
159
@provider(IFormFieldProvider)
16-
class IOrganisationalUnitBehavior(IOrganisationalUnitMarker):
10+
class IOrganisationalUnitBehavior(model.Schema):
1711
"""Behavior: Select a OrganisationalUnit from a vocabulary."""
1812

13+
model.fieldset("categorization", fields=["organisational_unit_reference"])
14+
order_after(organisational_unit_reference="subjects")
1915
organisational_unit_reference = RelationChoice(
2016
title=_("Organisational Unit"),
2117
vocabulary="kitconcept.intranet.vocabularies.organisational_unit_objects",
2218
required=False,
2319
)
24-
25-
26-
@implementer(IOrganisationalUnitBehavior)
27-
class OrganisationalUnitAdapter:
28-
"""Behavior class for OrganisationalUnit."""
29-
30-
def __init__(self, context):
31-
self.context = context
32-
33-
@property
34-
def organisational_unit_reference(self) -> RelationValue | None:
35-
return self.context.organisational_unit_reference
36-
37-
@organisational_unit_reference.setter
38-
def organisational_unit_reference(self, value: RelationValue | None):
39-
self.context.organisational_unit_reference = value
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
{
2+
"@id": "/features/block/rss-block",
3+
"@type": "Document",
4+
"UID": "7c7cf1aae1a9431db3a706615a410cdc",
5+
"allow_discussion": null,
6+
"authors": null,
7+
"blocks": {
8+
"115a6976-02f3-4f7c-b0e1-23b73334d170": {
9+
"@type": "rssBlock",
10+
"feeds": [
11+
{
12+
"@id": "c2fed1f4-6dec-42d0-99e2-bca91e143afb",
13+
"source": "Conservation International",
14+
"url": "https://feeds.feedburner.com/ConservationInternationalBlog/ClimateChange"
15+
}
16+
],
17+
"limit": 10,
18+
"template": "default",
19+
"title": "RSS List"
20+
},
21+
"45754f5f-cdfb-4990-a55d-a821ac9ec84d": {
22+
"@type": "rssBlock",
23+
"feeds": [
24+
{
25+
"@id": "8381334e-49df-4c93-b257-94af73db68f7",
26+
"source": "NYT",
27+
"url": "https://rss.nytimes.com/services/xml/rss/nyt/ArtandDesign.xml"
28+
}
29+
],
30+
"limit": 4,
31+
"template": "grid",
32+
"title": "RSS grid"
33+
},
34+
"802d1e5b-0f68-467a-a412-b4c289081116": {
35+
"@type": "rssBlock",
36+
"feeds": [
37+
{
38+
"@id": "dd7f9392-d1b7-4b93-a7be-2360ff6b351d",
39+
"source": "NASA",
40+
"url": "https://www.nasa.gov/missions/station/feed/\""
41+
}
42+
],
43+
"limit": 10,
44+
"template": "summary",
45+
"title": "RSS List with image"
46+
},
47+
"bc8b4aca-7419-439c-af35-443a34996c2e": {
48+
"@type": "title"
49+
}
50+
},
51+
"blocks_layout": {
52+
"items": [
53+
"bc8b4aca-7419-439c-af35-443a34996c2e",
54+
"115a6976-02f3-4f7c-b0e1-23b73334d170",
55+
"45754f5f-cdfb-4990-a55d-a821ac9ec84d",
56+
"802d1e5b-0f68-467a-a412-b4c289081116"
57+
]
58+
},
59+
"changeNote": "",
60+
"contributors": [],
61+
"created": "2025-09-05T10:41:15+00:00",
62+
"creators": [
63+
"admin"
64+
],
65+
"description": "",
66+
"effective": "2025-09-05T11:04:57+00:00",
67+
"exclude_from_nav": false,
68+
"expires": null,
69+
"exportimport.constrains": {},
70+
"exportimport.conversation": [],
71+
"feedback_person": null,
72+
"head_title": null,
73+
"id": "rss-block",
74+
"is_folderish": true,
75+
"language": "##DEFAULT##",
76+
"layout": "document_view",
77+
"lock": {
78+
"locked": false,
79+
"stealable": true
80+
},
81+
"modified": "2025-09-05T11:04:57+00:00",
82+
"nav_title": null,
83+
"preview_caption_link": null,
84+
"responsible_person": null,
85+
"review_state": "published",
86+
"rights": "",
87+
"searchwords": [],
88+
"showinsearch": true,
89+
"subjects": [],
90+
"title": "RSS",
91+
"type_title": "Page",
92+
"version": "current",
93+
"versioning_enabled": true,
94+
"workflow_history": {
95+
"simple_intranet_workflow": [
96+
{
97+
"action": null,
98+
"actor": "admin",
99+
"comments": "",
100+
"review_state": "private",
101+
"time": "2025-09-05T10:41:15+00:00"
102+
},
103+
{
104+
"action": "publish",
105+
"actor": "admin",
106+
"comments": "",
107+
"review_state": "published",
108+
"time": "2025-09-05T11:04:57+00:00"
109+
}
110+
]
111+
},
112+
"working_copy": null,
113+
"working_copy_of": null
114+
}

backend/src/kitconcept/intranet/distributions/intranet/content/content/__metadata__.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
"6bd32a3367ea4254b295db642655b9d3/data.json",
7979
"4d844688c768462ab158fe0bdb80c098/data.json",
8080
"e090d954d0a448bca81c1a646e673a12/data.json",
81+
"7c7cf1aae1a9431db3a706615a410cdc/data.json",
8182
"928010d84e5d4df2b2282f3e179d6b1a/data.json",
8283
"546e82cce6c842d0a4046a0131539bd2/data.json",
8384
"ccba1307927b4407ac855f1947fd4c99/data.json",
@@ -232,6 +233,7 @@
232233
"7a3b5687ac534254a28381e7fa763ed5": {},
233234
"7ab9c48ede33415fa2a66a99549c8f70": {},
234235
"7adc12f0e7604982a6cdcb9437bccf66": {},
236+
"7c7cf1aae1a9431db3a706615a410cdc": {},
235237
"7d1436b2f10b4a1c8dbfc4ded4f77bd3": {},
236238
"7e0183099bc547efad04d031ac04c23a": {},
237239
"7fce8b9becbb43d091604ae5b3e84ac0": {},
@@ -815,6 +817,13 @@
815817
]
816818
}
817819
},
820+
"7c7cf1aae1a9431db3a706615a410cdc": {
821+
"local_roles": {
822+
"admin": [
823+
"Owner"
824+
]
825+
}
826+
},
818827
"7d1436b2f10b4a1c8dbfc4ded4f77bd3": {
819828
"local_roles": {
820829
"admin": [
@@ -1343,6 +1352,7 @@
13431352
"7a3b5687ac534254a28381e7fa763ed5": 1,
13441353
"7ab9c48ede33415fa2a66a99549c8f70": 0,
13451354
"7adc12f0e7604982a6cdcb9437bccf66": 2,
1355+
"7c7cf1aae1a9431db3a706615a410cdc": 21,
13461356
"7d1436b2f10b4a1c8dbfc4ded4f77bd3": 1,
13471357
"7e0183099bc547efad04d031ac04c23a": 1,
13481358
"7fce8b9becbb43d091604ae5b3e84ac0": 41,

backend/src/kitconcept/intranet/distributions/intranet/content/relations.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,16 @@
594594
"from_uuid": "cf01b46c0c954bfe8a391b7d3882fe7a",
595595
"to_uuid": "9b7fe240f0ac4234b5ce275243f25cda"
596596
},
597+
{
598+
"from_attribute": "isReferencing",
599+
"from_uuid": "cf01b46c0c954bfe8a391b7d3882fe7a",
600+
"to_uuid": "37d87d573b4448369afb431a0eb1f728"
601+
},
602+
{
603+
"from_attribute": "preview_image_link",
604+
"from_uuid": "cf01b46c0c954bfe8a391b7d3882fe7a",
605+
"to_uuid": "9b7fe240f0ac4234b5ce275243f25cda"
606+
},
597607
{
598608
"from_attribute": "isReferencing",
599609
"from_uuid": "d00c8de58ceb48cdba5512fc7af65d39",
@@ -694,6 +704,16 @@
694704
"from_uuid": "f340ac76393e4b8ca69db307bd2dcf18",
695705
"to_uuid": "7e0183099bc547efad04d031ac04c23a"
696706
},
707+
{
708+
"from_attribute": "isReferencing",
709+
"from_uuid": "f340ac76393e4b8ca69db307bd2dcf18",
710+
"to_uuid": "059feee144a44bf88a3b38fbe9deca65"
711+
},
712+
{
713+
"from_attribute": "preview_image_link",
714+
"from_uuid": "f340ac76393e4b8ca69db307bd2dcf18",
715+
"to_uuid": "7e0183099bc547efad04d031ac04c23a"
716+
},
697717
{
698718
"from_attribute": "isReferencing",
699719
"from_uuid": "f8cd4a2d8d7c4703b4e41d2093b21aed",

backend/src/kitconcept/intranet/indexers/location.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
from Acquisition import aq_base
2-
from kitconcept.intranet.behaviors.location import ILocationMarker
32
from plone import api
43
from plone.dexterity.content import DexterityContent
4+
from plone.dexterity.interfaces import IDexterityContent
55
from plone.indexer.decorator import indexer
66
from z3c.relationfield.relation import RelationValue
77

88

9-
@indexer(ILocationMarker)
9+
@indexer(IDexterityContent)
1010
def location_indexer(obj: DexterityContent) -> str:
1111
"""Indexer for location attribute from ILocation behavior."""
1212
base_obj = aq_base(obj)
1313
location_reference: RelationValue | None = getattr(
1414
base_obj, "location_reference", None
1515
)
1616
if location_reference is None:
17-
return ""
17+
# Don't store a value in the index
18+
raise AttributeError
19+
1820
# A relation field
1921
location = location_reference.to_object
2022
uid = api.content.get_uuid(location)

0 commit comments

Comments
 (0)