Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for slides with no href PoC #42

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions locales/ca/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ msgstr ""
msgid "Add item"
msgstr "Afegir element"

#: components/schema
# defaultMessage: Custom image
msgid "Custom image"
msgstr ""

#: components/schema
# defaultMessage: Description
msgid "Description"
Expand All @@ -33,16 +38,6 @@ msgstr "Descripció"
msgid "Go to slide"
msgstr "Vés a slide"

#: components/schema
# defaultMessage: Headtitle
msgid "Headtitle"
msgstr "Títol de capçalera"

#: components/schema
# defaultMessage: Image override
msgid "Image override"
msgstr "Imatge"

#: components/schema
# defaultMessage: Item
msgid "Item"
Expand All @@ -53,16 +48,21 @@ msgstr "Element"
msgid "Items"
msgstr "Elements"

#: components/schema
# defaultMessage: Kicker
msgid "Kicker"
msgstr ""

#: components/DotsAndArrows
# defaultMessage: Next slide
msgid "Next slide"
msgstr "Següent slide"

#: components/DefaultBody
#: components/View
# defaultMessage: Please choose an existing content as source for this element
msgid "Please choose an existing content as source for this element"
msgstr "Si us plau, escolleixi un contingut existent per aquest element"
# defaultMessage: Please choose an existing content as target for this element or select a custom image
msgid "Please choose an existing content as target for this element or select a custom image"
msgstr ""

#: components/DotsAndArrows
# defaultMessage: Previous slide
Expand Down
26 changes: 13 additions & 13 deletions locales/de/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ msgstr ""
msgid "Add item"
msgstr "Element hinzufügen"

#: components/schema
# defaultMessage: Custom image
msgid "Custom image"
msgstr ""

#: components/schema
# defaultMessage: Description
msgid "Description"
Expand All @@ -31,16 +36,6 @@ msgstr "Beschreibung"
msgid "Go to slide"
msgstr "Gehe zu Slide"

#: components/schema
# defaultMessage: Headtitle
msgid "Headtitle"
msgstr "Kopftitel"

#: components/schema
# defaultMessage: Image override
msgid "Image override"
msgstr "Bild überschreiben"

#: components/schema
# defaultMessage: Item
msgid "Item"
Expand All @@ -51,16 +46,21 @@ msgstr "Element"
msgid "Items"
msgstr "Elemente"

#: components/schema
# defaultMessage: Kicker
msgid "Kicker"
msgstr ""

#: components/DotsAndArrows
# defaultMessage: Next slide
msgid "Next slide"
msgstr "Nächster Slide"

#: components/DefaultBody
#: components/View
# defaultMessage: Please choose an existing content as source for this element
msgid "Please choose an existing content as source for this element"
msgstr "Bitte wählen sie einen existierenden Inhalt als Quelle für dieses Element aus"
# defaultMessage: Please choose an existing content as target for this element or select a custom image
msgid "Please choose an existing content as target for this element or select a custom image"
msgstr ""

#: components/DotsAndArrows
# defaultMessage: Previous slide
Expand Down
24 changes: 12 additions & 12 deletions locales/en/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ msgstr ""
msgid "Add item"
msgstr ""

#: components/schema
# defaultMessage: Custom image
msgid "Custom image"
msgstr ""

#: components/schema
# defaultMessage: Description
msgid "Description"
Expand All @@ -26,16 +31,6 @@ msgstr ""
msgid "Go to slide"
msgstr ""

#: components/schema
# defaultMessage: Headtitle
msgid "Headtitle"
msgstr ""

#: components/schema
# defaultMessage: Image override
msgid "Image override"
msgstr ""

#: components/schema
# defaultMessage: Item
msgid "Item"
Expand All @@ -46,15 +41,20 @@ msgstr ""
msgid "Items"
msgstr ""

#: components/schema
# defaultMessage: Kicker
msgid "Kicker"
msgstr ""

#: components/DotsAndArrows
# defaultMessage: Next slide
msgid "Next slide"
msgstr ""

#: components/DefaultBody
#: components/View
# defaultMessage: Please choose an existing content as source for this element
msgid "Please choose an existing content as source for this element"
# defaultMessage: Please choose an existing content as target for this element or select a custom image
msgid "Please choose an existing content as target for this element or select a custom image"
msgstr ""

#: components/DotsAndArrows
Expand Down
26 changes: 13 additions & 13 deletions locales/es/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ msgstr ""
msgid "Add item"
msgstr "Añadir elemento"

#: components/schema
# defaultMessage: Custom image
msgid "Custom image"
msgstr ""

#: components/schema
# defaultMessage: Description
msgid "Description"
Expand All @@ -35,16 +40,6 @@ msgstr "Descripción"
msgid "Go to slide"
msgstr "Ver slide"

#: components/schema
# defaultMessage: Headtitle
msgid "Headtitle"
msgstr "Título principal"

#: components/schema
# defaultMessage: Image override
msgid "Image override"
msgstr "Sobre-escritura de imagen"

#: components/schema
# defaultMessage: Item
msgid "Item"
Expand All @@ -55,16 +50,21 @@ msgstr "Elemento"
msgid "Items"
msgstr "Elementos"

#: components/schema
# defaultMessage: Kicker
msgid "Kicker"
msgstr ""

#: components/DotsAndArrows
# defaultMessage: Next slide
msgid "Next slide"
msgstr "Siguiente slide"

#: components/DefaultBody
#: components/View
# defaultMessage: Please choose an existing content as source for this element
msgid "Please choose an existing content as source for this element"
msgstr "Elija un contenido existente como fuente para este elemento"
# defaultMessage: Please choose an existing content as target for this element or select a custom image
msgid "Please choose an existing content as target for this element or select a custom image"
msgstr ""

#: components/DotsAndArrows
# defaultMessage: Previous slide
Expand Down
26 changes: 13 additions & 13 deletions locales/nl/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ msgstr ""
msgid "Add item"
msgstr "Item toevoegen"

#: components/schema
# defaultMessage: Custom image
msgid "Custom image"
msgstr ""

#: components/schema
# defaultMessage: Description
msgid "Description"
Expand All @@ -30,16 +35,6 @@ msgstr "Omschrijving"
msgid "Go to slide"
msgstr ""

#: components/schema
# defaultMessage: Headtitle
msgid "Headtitle"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a breaking change, and we need to at least copy over the existing translations

msgstr "Kop"

#: components/schema
# defaultMessage: Image override
msgid "Image override"
msgstr "Afbeelding overschrijven"

#: components/schema
# defaultMessage: Item
msgid "Item"
Expand All @@ -50,16 +45,21 @@ msgstr "Item"
msgid "Items"
msgstr "Items"

#: components/schema
# defaultMessage: Kicker
msgid "Kicker"
msgstr ""

#: components/DotsAndArrows
# defaultMessage: Next slide
msgid "Next slide"
msgstr ""

#: components/DefaultBody
#: components/View
# defaultMessage: Please choose an existing content as source for this element
msgid "Please choose an existing content as source for this element"
msgstr "Kies een bestaand item als bron voor dit element"
# defaultMessage: Please choose an existing content as target for this element or select a custom image
msgid "Please choose an existing content as target for this element or select a custom image"
msgstr ""

#: components/DotsAndArrows
# defaultMessage: Previous slide
Expand Down
26 changes: 13 additions & 13 deletions locales/volto.pot
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: Plone\n"
"POT-Creation-Date: 2023-12-14T11:35:27.943Z\n"
"POT-Creation-Date: 2024-01-15T21:54:10.759Z\n"
"Last-Translator: Plone i18n <[email protected]>\n"
"Language-Team: Plone i18n <[email protected]>\n"
"MIME-Version: 1.0\n"
Expand All @@ -18,6 +18,11 @@ msgstr ""
msgid "Add item"
msgstr ""

#: components/schema
# defaultMessage: Custom image
msgid "Custom image"
msgstr ""

#: components/schema
# defaultMessage: Description
msgid "Description"
Expand All @@ -28,16 +33,6 @@ msgstr ""
msgid "Go to slide"
msgstr ""

#: components/schema
# defaultMessage: Headtitle
msgid "Headtitle"
msgstr ""

#: components/schema
# defaultMessage: Image override
msgid "Image override"
msgstr ""

#: components/schema
# defaultMessage: Item
msgid "Item"
Expand All @@ -48,15 +43,20 @@ msgstr ""
msgid "Items"
msgstr ""

#: components/schema
# defaultMessage: Kicker
msgid "Kicker"
msgstr ""

#: components/DotsAndArrows
# defaultMessage: Next slide
msgid "Next slide"
msgstr ""

#: components/DefaultBody
#: components/View
# defaultMessage: Please choose an existing content as source for this element
msgid "Please choose an existing content as source for this element"
# defaultMessage: Please choose an existing content as target for this element or select a custom image
msgid "Please choose an existing content as target for this element or select a custom image"
msgstr ""

#: components/DotsAndArrows
Expand Down
1 change: 1 addition & 0 deletions news/42.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow for slides to have no target link, as long as there is a custom image chosen. @danalvrz
16 changes: 8 additions & 8 deletions src/components/DefaultBody.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import config from '@plone/volto/registry';

const messages = defineMessages({
PleaseChooseContent: {
id: 'Please choose an existing content as source for this element',
id: 'Please choose an existing content as target for this element or select a custom image',
defaultMessage:
'Please choose an existing content as source for this element',
'Please choose an existing content as target for this element or select a custom image',
},
moreInfo: {
id: 'moreInfo',
Expand Down Expand Up @@ -67,11 +67,11 @@ const SliderBody = ({
return (
<div
className={cx('grid-teaser-item top', {
'empty-slide': !href && isEditMode,
'empty-slide': !href && !image && isEditMode,
'slide-visible': isActive,
})}
>
{!href && isEditMode && (
{!href && !image && isEditMode && (
<Message>
<div className="grid-teaser-item default">
<img src={imageBlockSVG} alt="" />
Expand All @@ -91,12 +91,12 @@ const SliderBody = ({
</div>
</Message>
)}
{href && (
{(href || image) && (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition is confusing, although meaning the same as the above one, it's not the same negated. Could we unify them? Or use a ternary.

<div className="teaser-item top">
<MaybeWrap
condition={!isEditMode}
condition={!isEditMode && href}
as={UniversalLink}
href={href['@id']}
href={href?.['@id']}
target={
data.openLinkInNewTab ||
(openExternalLinkInNewTab && !isInternalURL(href['@id']))
Expand All @@ -105,7 +105,7 @@ const SliderBody = ({
}
tabIndex={!isActive ? '-1' : null}
>
{(href?.hasPreviewImage || href.image_field || image) && (
{(href?.hasPreviewImage || href?.image_field || image) && (
<div className="highlight-image-wrapper gradient">
<Image
item={image || href}
Expand Down
4 changes: 2 additions & 2 deletions src/components/View.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import teaserTemplate from '../icons/teaser-template.svg';

const messages = defineMessages({
PleaseChooseContent: {
id: 'Please choose an existing content as source for this element',
id: 'Please choose an existing content as target for this element or select a custom image',
defaultMessage:
'Please choose an existing content as source for this element',
'Please choose an existing content as target for this element or select a custom image',
},
});

Expand Down
Loading