Skip to content

Commit

Permalink
Register contenttype icon. Add upgrade step for updating the icons.
Browse files Browse the repository at this point in the history
  • Loading branch information
mauritsvanrees committed Aug 19, 2024
1 parent 3c5f457 commit aac8b0f
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 4 deletions.
2 changes: 0 additions & 2 deletions news/+ignore.bugfix

This file was deleted.

3 changes: 3 additions & 0 deletions news/222.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Add missing icon on comments' `view` action
Register contenttype icon for comments.
[gforcada, maurits]
5 changes: 5 additions & 0 deletions plone/app/discussion/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@
for="plone.base.interfaces.IPloneSiteRoot"
directory="profiles/default"
/>
<utility
factory=".setuphandlers.HiddenProfiles"
provides="plone.base.interfaces.INonInstallable"
name="plone.app.discussion"
/>
<!-- For upgrade steps see upgrades.zcml. -->

<!-- Comments -->
Expand Down
2 changes: 1 addition & 1 deletion plone/app/discussion/profiles/default/metadata.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<version>2001</version>
<version>2002</version>
<dependencies>
<dependency>profile-plone.resource:default</dependency>
<dependency>profile-plone.app.registry:default</dependency>
Expand Down
6 changes: 6 additions & 0 deletions plone/app/discussion/profiles/default/registry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,10 @@
<value key="edit_comment_enabled">False</value>
<value key="delete_own_comment_enabled">False</value>
</records>
<record name="plone.icon.contenttype/discussion-item">
<field type="plone.registry.field.TextLine">
<title>Plone Image</title>
</field>
<value key="resource">++plone++bootstrap-icons/chat-left-text.svg</value>
</record>
</registry>
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<property name="description"
i18n:translate=""
>Comments added to a content item.</property>
<property name="content_icon">discussionitem_icon.png</property>
<property name="content_icon">++plone++bootstrap-icons/chat-left-text.svg</property>
<property name="content_meta_type">Discussion Item</property>
<property name="product" />
<property name="factory">plone.Comment</property>
Expand Down
9 changes: 9 additions & 0 deletions plone/app/discussion/profiles/to_2002/registry.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<registry>
<record name="plone.icon.contenttype/discussion-item">
<field type="plone.registry.field.TextLine">
<title>Plone Image</title>
</field>
<value key="resource">++plone++bootstrap-icons/chat-left-text.svg</value>
</record>
</registry>
26 changes: 26 additions & 0 deletions plone/app/discussion/profiles/to_2002/types/Discussion_Item.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<object xmlns:i18n="http://xml.zope.org/namespaces/i18n"
meta_type="Factory-based Type Information"
name="Discussion Item"
i18n:domain="plone"
>
<property name="content_icon">++plone++bootstrap-icons/chat-left-text.svg</property>
<alias from="(Default)"
to="@@view"
/>
<alias from="view"
to="@@view"
/>
<!-- Note: we cannot only set an icon_exp in this action:
the other settings would be reset to empty then. -->
<action action_id="view"
category="object"
condition_expr=""
title="View"
url_expr="string:${object_url}/@@view"
icon_expr="string:toolbar-action/view"
visible="True"
>
<permission value="View" />
</action>
</object>
10 changes: 10 additions & 0 deletions plone/app/discussion/setuphandlers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from plone.base.interfaces import INonInstallable
from zope.interface import implementer


@implementer(INonInstallable)
class HiddenProfiles:
def getNonInstallableProfiles(self):
return [
"plone.app.contenttypes:to_2002",
]
20 changes: 20 additions & 0 deletions plone/app/discussion/upgrades.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,24 @@
/>
</genericsetup:upgradeSteps>

<genericsetup:registerProfile
name="to_2002"
title="Upgrade: icons"
provides="Products.GenericSetup.interfaces.EXTENSION"
for="plone.base.interfaces.IMigratingPloneSiteRoot"
directory="profiles/to_2002"
/>
<!-- plone.app.discussion:to_2002 -->

<genericsetup:upgradeSteps
profile="plone.app.discussion:default"
source="2001"
destination="2002"
>
<genericsetup:upgradeDepends
title="Update icons"
import_profile="plone.app.discussion:to_2002"
/>
</genericsetup:upgradeSteps>

</configure>

0 comments on commit aac8b0f

Please sign in to comment.