Skip to content

Commit

Permalink
feat: added checkbox for showing image for all cards in uo search (#816)
Browse files Browse the repository at this point in the history
* feat: added checkbox for showing image for all cards in uo search

* fix: value for checkbox widgets in uoSearch and eventsSearch sidebar
  • Loading branch information
sabrina-bongiovanni authored Nov 26, 2024
1 parent deff07d commit 504417f
Show file tree
Hide file tree
Showing 11 changed files with 80 additions and 9 deletions.
2 changes: 1 addition & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

### Novità

- ...
- E' ora possibile decidere se mostrare l'immagine di anteprima per tutte le card nel blocco di ricerca Evento e Unità Organizzativa.

### Fix

Expand Down
6 changes: 6 additions & 0 deletions locales/de/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -3261,6 +3261,12 @@ msgstr ""
msgid "searchBlock"
msgstr ""

#: components/ItaliaTheme/Blocks/EventSearch/Sidebar
#: components/ItaliaTheme/Blocks/UOSearch/Sidebar
# defaultMessage: Mostra l'immagine per tutti gli elementi
msgid "searchBlock_always_show_image"
msgstr ""

#: components/ItaliaTheme/Blocks/BandiSearch/Sidebar
#: components/ItaliaTheme/Blocks/EventSearch/Sidebar
#: components/ItaliaTheme/Blocks/UOSearch/Sidebar
Expand Down
6 changes: 6 additions & 0 deletions locales/en/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -3246,6 +3246,12 @@ msgstr "Search by all topics"
msgid "searchBlock"
msgstr ""

#: components/ItaliaTheme/Blocks/EventSearch/Sidebar
#: components/ItaliaTheme/Blocks/UOSearch/Sidebar
# defaultMessage: Mostra l'immagine per tutti gli elementi
msgid "searchBlock_always_show_image"
msgstr "Show image for every card"

#: components/ItaliaTheme/Blocks/BandiSearch/Sidebar
#: components/ItaliaTheme/Blocks/EventSearch/Sidebar
#: components/ItaliaTheme/Blocks/UOSearch/Sidebar
Expand Down
6 changes: 6 additions & 0 deletions locales/es/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -3255,6 +3255,12 @@ msgstr "Buscar por todos los temas"
msgid "searchBlock"
msgstr "Búsqueda de eventos"

#: components/ItaliaTheme/Blocks/EventSearch/Sidebar
#: components/ItaliaTheme/Blocks/UOSearch/Sidebar
# defaultMessage: Mostra l'immagine per tutti gli elementi
msgid "searchBlock_always_show_image"
msgstr ""

#: components/ItaliaTheme/Blocks/BandiSearch/Sidebar
#: components/ItaliaTheme/Blocks/EventSearch/Sidebar
#: components/ItaliaTheme/Blocks/UOSearch/Sidebar
Expand Down
6 changes: 6 additions & 0 deletions locales/fr/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -3263,6 +3263,12 @@ msgstr "Rechercher tous les sujets"
msgid "searchBlock"
msgstr ""

#: components/ItaliaTheme/Blocks/EventSearch/Sidebar
#: components/ItaliaTheme/Blocks/UOSearch/Sidebar
# defaultMessage: Mostra l'immagine per tutti gli elementi
msgid "searchBlock_always_show_image"
msgstr ""

#: components/ItaliaTheme/Blocks/BandiSearch/Sidebar
#: components/ItaliaTheme/Blocks/EventSearch/Sidebar
#: components/ItaliaTheme/Blocks/UOSearch/Sidebar
Expand Down
6 changes: 6 additions & 0 deletions locales/it/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -3246,6 +3246,12 @@ msgstr "Cerca tutti gli argomenti"
msgid "searchBlock"
msgstr "Ricerca eventi"

#: components/ItaliaTheme/Blocks/EventSearch/Sidebar
#: components/ItaliaTheme/Blocks/UOSearch/Sidebar
# defaultMessage: Mostra l'immagine per tutti gli elementi
msgid "searchBlock_always_show_image"
msgstr ""

#: components/ItaliaTheme/Blocks/BandiSearch/Sidebar
#: components/ItaliaTheme/Blocks/EventSearch/Sidebar
#: components/ItaliaTheme/Blocks/UOSearch/Sidebar
Expand Down
8 changes: 7 additions & 1 deletion 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-10-29T15:18:21.587Z\n"
"POT-Creation-Date: 2024-11-25T15:31:18.424Z\n"
"Last-Translator: Plone i18n <[email protected]>\n"
"Language-Team: Plone i18n <[email protected]>\n"
"MIME-Version: 1.0\n"
Expand Down Expand Up @@ -3248,6 +3248,12 @@ msgstr ""
msgid "searchBlock"
msgstr ""

#: components/ItaliaTheme/Blocks/EventSearch/Sidebar
#: components/ItaliaTheme/Blocks/UOSearch/Sidebar
# defaultMessage: Mostra l'immagine per tutti gli elementi
msgid "searchBlock_always_show_image"
msgstr ""

#: components/ItaliaTheme/Blocks/BandiSearch/Sidebar
#: components/ItaliaTheme/Blocks/EventSearch/Sidebar
#: components/ItaliaTheme/Blocks/UOSearch/Sidebar
Expand Down
6 changes: 5 additions & 1 deletion src/components/ItaliaTheme/Blocks/EventSearch/Body.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,11 @@ const Body = ({ data, id, inEditMode, path, onChangeBlock }) => {
items?.length > 0 ? (
<div className="mt-4" ref={resultsRef} aria-live="polite">
<div className="block listing">
<CardWithImageTemplate items={items} full_width={false} />
<CardWithImageTemplate
items={items}
full_width={false}
always_show_image={data.always_show_image}
/>
</div>
{querystringResults.total > b_size && (
<Pagination
Expand Down
21 changes: 16 additions & 5 deletions src/components/ItaliaTheme/Blocks/EventSearch/Sidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ const messages = defineMessages({
id: 'searchBlock_show_default_results',
defaultMessage: 'Di default, mostra i risultati',
},
always_show_image: {
id: 'searchBlock_always_show_image',
defaultMessage: "Mostra l'immagine per tutti gli elementi",
},
});

const Sidebar = (props) => {
Expand Down Expand Up @@ -161,11 +165,18 @@ const Sidebar = (props) => {
<CheckboxWidget
id="show_default_results"
title={props.intl.formatMessage(messages.show_default_results)}
value={
props.data.show_default_results
? props.data.show_default_results
: false
}
value={props.data.show_default_results}
onChange={(id, value) => {
props.onChangeBlock(props.block, {
...props.data,
[id]: value,
});
}}
/>
<CheckboxWidget
id="always_show_image"
title={props.intl.formatMessage(messages.always_show_image)}
value={props.data.always_show_image}
onChange={(id, value) => {
props.onChangeBlock(props.block, {
...props.data,
Expand Down
6 changes: 5 additions & 1 deletion src/components/ItaliaTheme/Blocks/UOSearch/Body.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,11 @@ const Body = ({ data, id, inEditMode, path, onChangeBlock }) => {
items?.length > 0 ? (
<div className="mt-4" ref={resultsRef} aria-live="polite">
<div className="block listing">
<CardWithImageTemplate items={items} full_width={false} />
<CardWithImageTemplate
items={items}
full_width={false}
always_show_image={data.always_show_image}
/>
</div>
{querystringResults.total > b_size && (
<Pagination
Expand Down
16 changes: 16 additions & 0 deletions src/components/ItaliaTheme/Blocks/UOSearch/Sidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
SelectWidget,
Icon,
ObjectBrowserWidget,
CheckboxWidget,
} from '@plone/volto/components';
import upSVG from '@plone/volto/icons/up-key.svg';
import downSVG from '@plone/volto/icons/down-key.svg';
Expand Down Expand Up @@ -72,6 +73,10 @@ const messages = defineMessages({
id: 'searchBlock_date_filter',
defaultMessage: 'Filtro per date',
},
always_show_image: {
id: 'searchBlock_always_show_image',
defaultMessage: "Mostra l'immagine per tutti gli elementi",
},
});

const Sidebar = (props) => {
Expand Down Expand Up @@ -153,6 +158,17 @@ const Sidebar = (props) => {
});
}}
/>
<CheckboxWidget
id="always_show_image"
title={props.intl.formatMessage(messages.always_show_image)}
value={props.data.always_show_image}
onChange={(id, value) => {
props.onChangeBlock(props.block, {
...props.data,
[id]: value,
});
}}
/>
</div>
</Segment>
<Accordion fluid styled className="form">
Expand Down

0 comments on commit 504417f

Please sign in to comment.