Skip to content

Commit

Permalink
Refactor / Improved target blank likns (files, links and so on)
Browse files Browse the repository at this point in the history
  • Loading branch information
boulch committed Feb 21, 2025
1 parent 6675673 commit eabfe13
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/imio/smartweb/core/behaviors/new_tab.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-

from imio.smartweb.locales import SmartwebMessageFactory as _
from plone.autoform import directives
from plone.autoform.interfaces import IFormFieldProvider
from plone.supermodel import model
from zope import schema
from zope.interface import provider


@provider(IFormFieldProvider)
class INewTab(model.Schema):

directives.order_after(open_in_new_tab="remoteUrl")
open_in_new_tab = schema.Bool(
title=_("Open in a new tab"),
required=False,
default=False,
)
13 changes: 13 additions & 0 deletions src/imio/smartweb/core/profiles/default/types/Link.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<object xmlns:i18n="http://xml.zope.org/namespaces/i18n"
meta_type="Dexterity FTI"
name="Link"
i18n:domain="plone"
>

<!-- Enabled behaviors -->
<property name="behaviors" purge="false">
<element value="imio.smartweb.new_tab" />
</property>

</object>
11 changes: 11 additions & 0 deletions src/imio/smartweb/core/upgrades/profiles/1062_to_1063/registry.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0"?>
<registry
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
i18n:domain="imio.smartweb">

<records interface="Products.CMFPlone.interfaces.controlpanel.ILinkSchema"
prefix="plone">
<value key="external_links_open_new_window">False</value>
</records>

</registry>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version='1.0' encoding='UTF-8'?>
<object name="portal_types" meta_type="Plone Types Tool">
<object meta_type="Dexterity FTI" name="imio.smartweb.SectionTimestampedPublications"/>
</object>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<object xmlns:i18n="http://xml.zope.org/namespaces/i18n"
name="Link"
meta_type="Dexterity FTI"
i18n:domain="plone">

<property name="behaviors" purge="false">
<element value="imio.smartweb.new_tab" />
</property>

</object>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0"?>
<object xmlns:i18n="http://xml.zope.org/namespaces/i18n"
name="imio.smartweb.BlockLink"
meta_type="Dexterity FTI"
i18n:domain="imio.smartweb">

<property name="behaviors" purge="false">
<element value="imio.smartweb.new_tab" />
</property>

</object>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0"?>
<object xmlns:i18n="http://xml.zope.org/namespaces/i18n"
name="imio.smartweb.SectionSlide"
meta_type="Dexterity FTI"
i18n:domain="imio.smartweb">

<property name="behaviors" purge="false">
<element value="imio.smartweb.new_tab" />
</property>

</object>

0 comments on commit eabfe13

Please sign in to comment.