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

feat: video gallery option for caption #747

Merged
merged 10 commits into from
Sep 4, 2024
6 changes: 6 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@
- ...
-->

## Versione 7.30.5 (27/08/2024)

### Migliorie

- Aggiunta una opzione scegliere se mostrare la didascalia nel blocco Video Gallery

## Versione 7.30.4 (26/08/2024)

### Fix
Expand Down
12 changes: 6 additions & 6 deletions locales/de/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -2051,15 +2051,10 @@ msgid "gallery_close_preview"
msgstr ""

#: components/ItaliaTheme/Blocks/VideoGallery/Sidebar
# defaultMessage: Titolo del video
# defaultMessage: Didascalia del video
msgid "gallery_video_title"
msgstr ""

#: components/ItaliaTheme/Blocks/VideoGallery/Sidebar
# defaultMessage: Non viene mostrato. Serve al redattore per identificare meglio il video all'interno della gallery.
msgid "gallery_video_title_description"
msgstr ""

#: components/ItaliaTheme/Blocks/VideoGallery/Sidebar
# defaultMessage: Video URL
msgid "gallery_video_url"
Expand Down Expand Up @@ -3272,6 +3267,11 @@ msgstr ""
msgid "share"
msgstr ""

#: components/ItaliaTheme/Blocks/VideoGallery/Sidebar
# defaultMessage: Mostra didascalie
msgid "showVideoCaption"
msgstr ""

#: config/Blocks/ListingOptions/bandiInEvidenceTemplate
# defaultMessage: Mostra la data di ultima modifica
msgid "show_data_ultima_modifica"
Expand Down
12 changes: 6 additions & 6 deletions locales/en/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -2036,15 +2036,10 @@ msgid "gallery_close_preview"
msgstr "Close preview"

#: components/ItaliaTheme/Blocks/VideoGallery/Sidebar
# defaultMessage: Titolo del video
# defaultMessage: Didascalia del video
msgid "gallery_video_title"
msgstr ""

#: components/ItaliaTheme/Blocks/VideoGallery/Sidebar
# defaultMessage: Non viene mostrato. Serve al redattore per identificare meglio il video all'interno della gallery.
msgid "gallery_video_title_description"
msgstr ""

#: components/ItaliaTheme/Blocks/VideoGallery/Sidebar
# defaultMessage: Video URL
msgid "gallery_video_url"
Expand Down Expand Up @@ -3257,6 +3252,11 @@ msgstr "Arrange on 4 columns"
msgid "share"
msgstr "Share"

#: components/ItaliaTheme/Blocks/VideoGallery/Sidebar
# defaultMessage: Mostra didascalie
msgid "showVideoCaption"
msgstr ""

#: config/Blocks/ListingOptions/bandiInEvidenceTemplate
# defaultMessage: Mostra la data di ultima modifica
msgid "show_data_ultima_modifica"
Expand Down
12 changes: 6 additions & 6 deletions locales/es/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -2045,15 +2045,10 @@ msgid "gallery_close_preview"
msgstr "Cerrar vista previa"

#: components/ItaliaTheme/Blocks/VideoGallery/Sidebar
# defaultMessage: Titolo del video
# defaultMessage: Didascalia del video
msgid "gallery_video_title"
msgstr "Título del vídeo"

#: components/ItaliaTheme/Blocks/VideoGallery/Sidebar
# defaultMessage: Non viene mostrato. Serve al redattore per identificare meglio il video all'interno della gallery.
msgid "gallery_video_title_description"
msgstr "No se muestra. El editor lo utiliza para identificar mejor el vídeo dentro de la galería."

#: components/ItaliaTheme/Blocks/VideoGallery/Sidebar
# defaultMessage: Video URL
msgid "gallery_video_url"
Expand Down Expand Up @@ -3266,6 +3261,11 @@ msgstr "Organizar en 4 columnas"
msgid "share"
msgstr "Compartir"

#: components/ItaliaTheme/Blocks/VideoGallery/Sidebar
# defaultMessage: Mostra didascalie
msgid "showVideoCaption"
msgstr ""

#: config/Blocks/ListingOptions/bandiInEvidenceTemplate
# defaultMessage: Mostra la data di ultima modifica
msgid "show_data_ultima_modifica"
Expand Down
12 changes: 6 additions & 6 deletions locales/fr/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -2053,15 +2053,10 @@ msgid "gallery_close_preview"
msgstr "Fermer l'aperçu de l'image"

#: components/ItaliaTheme/Blocks/VideoGallery/Sidebar
# defaultMessage: Titolo del video
# defaultMessage: Didascalia del video
msgid "gallery_video_title"
msgstr ""

#: components/ItaliaTheme/Blocks/VideoGallery/Sidebar
# defaultMessage: Non viene mostrato. Serve al redattore per identificare meglio il video all'interno della gallery.
msgid "gallery_video_title_description"
msgstr ""

#: components/ItaliaTheme/Blocks/VideoGallery/Sidebar
# defaultMessage: Video URL
msgid "gallery_video_url"
Expand Down Expand Up @@ -3274,6 +3269,11 @@ msgstr "Disposer sur 4 colonnes"
msgid "share"
msgstr "Partager"

#: components/ItaliaTheme/Blocks/VideoGallery/Sidebar
# defaultMessage: Mostra didascalie
msgid "showVideoCaption"
msgstr ""

#: config/Blocks/ListingOptions/bandiInEvidenceTemplate
# defaultMessage: Mostra la data di ultima modifica
msgid "show_data_ultima_modifica"
Expand Down
14 changes: 7 additions & 7 deletions locales/it/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -2036,14 +2036,9 @@ msgid "gallery_close_preview"
msgstr "Chiudi l'anteprima"

#: components/ItaliaTheme/Blocks/VideoGallery/Sidebar
# defaultMessage: Titolo del video
# defaultMessage: Didascalia del video
msgid "gallery_video_title"
msgstr "Titolo del video"

#: components/ItaliaTheme/Blocks/VideoGallery/Sidebar
# defaultMessage: Non viene mostrato. Serve al redattore per identificare meglio il video all'interno della gallery.
msgid "gallery_video_title_description"
msgstr "Non viene mostrato. Serve al redattore per identificare meglio il video all'interno della gallery."
msgstr "Didascalia del video"

#: components/ItaliaTheme/Blocks/VideoGallery/Sidebar
# defaultMessage: Video URL
Expand Down Expand Up @@ -3257,6 +3252,11 @@ msgstr "Disponi su 4 colonne"
msgid "share"
msgstr "Condividi"

#: components/ItaliaTheme/Blocks/VideoGallery/Sidebar
# defaultMessage: Mostra didascalie
msgid "showVideoCaption"
msgstr ""

#: config/Blocks/ListingOptions/bandiInEvidenceTemplate
# defaultMessage: Mostra la data di ultima modifica
msgid "show_data_ultima_modifica"
Expand Down
14 changes: 7 additions & 7 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: 2024-07-25T10:23:52.051Z\n"
"POT-Creation-Date: 2024-08-23T12:31:13.362Z\n"
"Last-Translator: Plone i18n <[email protected]>\n"
"Language-Team: Plone i18n <[email protected]>\n"
"MIME-Version: 1.0\n"
Expand Down Expand Up @@ -2038,15 +2038,10 @@ msgid "gallery_close_preview"
msgstr ""

#: components/ItaliaTheme/Blocks/VideoGallery/Sidebar
# defaultMessage: Titolo del video
# defaultMessage: Didascalia del video
msgid "gallery_video_title"
msgstr ""

#: components/ItaliaTheme/Blocks/VideoGallery/Sidebar
# defaultMessage: Non viene mostrato. Serve al redattore per identificare meglio il video all'interno della gallery.
msgid "gallery_video_title_description"
msgstr ""

#: components/ItaliaTheme/Blocks/VideoGallery/Sidebar
# defaultMessage: Video URL
msgid "gallery_video_url"
Expand Down Expand Up @@ -3259,6 +3254,11 @@ msgstr ""
msgid "share"
msgstr ""

#: components/ItaliaTheme/Blocks/VideoGallery/Sidebar
# defaultMessage: Mostra didascalie
msgid "showVideoCaption"
msgstr ""

#: config/Blocks/ListingOptions/bandiInEvidenceTemplate
# defaultMessage: Mostra la data di ultima modifica
msgid "show_data_ultima_modifica"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@ class EditBlock extends SubblockEdit {
if (__SERVER__) {
return <div />;
}

return (
<Subblock subblock={this} className="subblock-edit">
<ViewBlock data={this.props.data} isEditMode={true} />
<ViewBlock
data={this.props.data}
showVideoCaption={this.props.showVideoCaption}
isEditMode={true}
/>
{(!this.props.data?.url || this.props.data?.url.length === 0) && (
<div>{this.props.intl.formatMessage(messages.noVideoUrl)}</div>
)}
Expand Down
17 changes: 15 additions & 2 deletions src/components/ItaliaTheme/Blocks/VideoGallery/Block/ViewBlock.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ const messages = defineMessages({
* @class ViewBlock
* @extends Component
*/
const ViewBlock = ({ data, index, isEditMode = false }) => {
const ViewBlock = ({
data,
showVideoCaption = false,
index,
isEditMode = false,
}) => {
const intl = useIntl();
let placeholder = data.preview_image
? isInternalURL(data.preview_image)
Expand Down Expand Up @@ -134,10 +139,18 @@ const ViewBlock = ({ data, index, isEditMode = false }) => {
type="video/mp4"
/>
) : data.allowExternals ? (
<Embed url={data.url} {...embedSettings} />
<>
<Embed url={data.url} {...embedSettings} />
{showVideoCaption && (
<p className="px-3 mt-2 figure-caption">{data.title}</p>
)}
</>
Wagner3UB marked this conversation as resolved.
Show resolved Hide resolved
) : (
<div className="invalidVideoFormat" />
)}
Wagner3UB marked this conversation as resolved.
Show resolved Hide resolved
{showVideoCaption && (
<p className="px-3 mt-2 figure-caption">{data.title}</p>
)}
</>
)}
</>
Expand Down
1 change: 1 addition & 0 deletions src/components/ItaliaTheme/Blocks/VideoGallery/Edit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class Edit extends SubblocksEdit {
{this.state.subblocks.map((subblock, subindex) => (
<div className="it-single-slide-wrapper" key={subblock.id}>
<EditBlock
showVideoCaption={this.props.data.showVideoCaption}
data={subblock}
index={subindex}
selected={this.isSubblockSelected(subindex)}
Expand Down
25 changes: 16 additions & 9 deletions src/components/ItaliaTheme/Blocks/VideoGallery/Sidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,16 @@ const messages = defineMessages({
video_url: { id: 'gallery_video_url', defaultMessage: 'Video URL' },
video_title: {
id: 'gallery_video_title',
defaultMessage: 'Titolo del video',
},
video_title_description: {
id: 'gallery_video_title_description',
defaultMessage:
"Non viene mostrato. Serve al redattore per identificare meglio il video all'interno della gallery.",
defaultMessage: 'Didascalia del video',
},
allowExternals: {
id: 'Allow Externals',
defaultMessage: 'Allow Externals',
},
showVideoCaption: {
id: 'showVideoCaption',
defaultMessage: 'Mostra didascalie',
},
});

const Sidebar = ({
Expand Down Expand Up @@ -103,6 +102,17 @@ const Sidebar = ({
});
}}
/>
<CheckboxWidget
id="showVideoCaption"
title={intl.formatMessage(messages.showVideoCaption)}
value={data.showVideoCaption ? data.showVideoCaption : false}
onChange={(name, value) => {
onChangeBlock(block, {
...data,
showVideoCaption: value,
});
}}
/>
</Segment>
<Accordion fluid styled className="form">
{data.subblocks &&
Expand Down Expand Up @@ -139,9 +149,6 @@ const Sidebar = ({
<TextWidget
id="title"
title={intl.formatMessage(messages.video_title)}
description={intl.formatMessage(
messages.video_title_description,
)}
value={subblock.title}
onChange={(name, value) => {
onChangeSubBlock(index, {
Expand Down
5 changes: 4 additions & 1 deletion src/components/ItaliaTheme/Blocks/VideoGallery/View.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ const View = ({ data, block }) => {
<Body data={data} nItems={data.subblocks?.length}>
{data.subblocks.map((subblock, subindex) => (
<div className="it-single-slide-wrapper" key={subindex}>
<ViewBlock data={subblock} />
<ViewBlock
data={subblock}
showVideoCaption={data.showVideoCaption}
/>
</div>
))}
</Body>
Expand Down
Loading