feat: il widget ha tre aspetti (elenco, schede con locandina, carosello) e i comuni si tagliano al limite del servizio
This commit is contained in:
parent
5c73bbc2b8
commit
fbae03e4f3
7 changed files with 71 additions and 6 deletions
|
|
@ -18,6 +18,7 @@
|
||||||
"regione": { "type": "string", "default": "" },
|
"regione": { "type": "string", "default": "" },
|
||||||
"categoria": { "type": "string", "default": "" },
|
"categoria": { "type": "string", "default": "" },
|
||||||
"limite": { "type": "string", "default": "5" },
|
"limite": { "type": "string", "default": "5" },
|
||||||
|
"formato": { "type": "string", "default": "lista" },
|
||||||
"tema": { "type": "string", "default": "chiaro" },
|
"tema": { "type": "string", "default": "chiaro" },
|
||||||
"colore": { "type": "string", "default": "" },
|
"colore": { "type": "string", "default": "" },
|
||||||
"titolo": { "type": "string", "default": "" },
|
"titolo": { "type": "string", "default": "" },
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,21 @@
|
||||||
set({ categoria: v });
|
set({ categoria: v });
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
campo('limite', __('How many events', 'piazza-in-festa'), __('From 1 to 20.', 'piazza-in-festa'))
|
campo('limite', __('How many events', 'piazza-in-festa'), __('From 1 to 20.', 'piazza-in-festa')),
|
||||||
|
el(SelectControl, {
|
||||||
|
label: __('Layout', 'piazza-in-festa'),
|
||||||
|
value: a.formato,
|
||||||
|
options: [
|
||||||
|
{ label: __('List', 'piazza-in-festa'), value: 'lista' },
|
||||||
|
{ label: __('Cards', 'piazza-in-festa'), value: 'schede' },
|
||||||
|
{ label: __('Carousel', 'piazza-in-festa'), value: 'carosello' }
|
||||||
|
],
|
||||||
|
__next40pxDefaultSize: true,
|
||||||
|
__nextHasNoMarginBottom: true,
|
||||||
|
onChange: function (v) {
|
||||||
|
set({ formato: v });
|
||||||
|
}
|
||||||
|
})
|
||||||
),
|
),
|
||||||
el(
|
el(
|
||||||
PanelBody,
|
PanelBody,
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ function pinfesta_defaults() {
|
||||||
'regione' => '',
|
'regione' => '',
|
||||||
'categoria' => '',
|
'categoria' => '',
|
||||||
'limite' => '5',
|
'limite' => '5',
|
||||||
|
'formato' => 'lista',
|
||||||
'tema' => 'chiaro',
|
'tema' => 'chiaro',
|
||||||
'colore' => '',
|
'colore' => '',
|
||||||
'titolo' => '',
|
'titolo' => '',
|
||||||
|
|
@ -55,8 +56,12 @@ function pinfesta_categorie() {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cleans a comma separated list of town identifiers (the slug you see in the
|
* Cleans a comma separated list of town identifiers (the slug you see in the
|
||||||
* address of a town page, for instance "la-morra"). Twelve at most, which is
|
* address of a town page, for instance "la-morra").
|
||||||
* what the service accepts.
|
*
|
||||||
|
* The hard limit is the service's, not ours: twelve towns on the free plan,
|
||||||
|
* fifty with a key. Here we only cut at the higher of the two, so a site with
|
||||||
|
* a key is not trimmed by the plugin; the extra towns are simply ignored by
|
||||||
|
* the service when the key is missing.
|
||||||
*
|
*
|
||||||
* @param string $raw Raw attribute value.
|
* @param string $raw Raw attribute value.
|
||||||
* @return string Normalised list, empty when nothing survives.
|
* @return string Normalised list, empty when nothing survives.
|
||||||
|
|
@ -72,7 +77,7 @@ function pinfesta_clean_comuni( $raw ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return implode( ',', array_slice( array_unique( $out ), 0, 12 ) );
|
return implode( ',', array_slice( array_unique( $out ), 0, 50 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -102,6 +107,11 @@ function pinfesta_build_url( $args ) {
|
||||||
$query['limite'] = min( $limite, 20 );
|
$query['limite'] = min( $limite, 20 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Elenco, schede con la locandina, o carosello che scorre da solo.
|
||||||
|
if ( in_array( $args['formato'], array( 'schede', 'carosello' ), true ) ) {
|
||||||
|
$query['formato'] = $args['formato'];
|
||||||
|
}
|
||||||
|
|
||||||
if ( 'scuro' === $args['tema'] ) {
|
if ( 'scuro' === $args['tema'] ) {
|
||||||
$query['tema'] = 'scuro';
|
$query['tema'] = 'scuro';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"translation-revision-date": "2026-09-04 12:00+0000",
|
"translation-revision-date": "2026-09-04 16:00+0000",
|
||||||
"generator": "manuale (nessun build step)",
|
"generator": "manuale (nessun build step)",
|
||||||
"domain": "messages",
|
"domain": "messages",
|
||||||
"locale_data": {
|
"locale_data": {
|
||||||
|
|
@ -68,6 +68,18 @@
|
||||||
],
|
],
|
||||||
"Piazza in Festa: set at least one town or a region in the block settings.": [
|
"Piazza in Festa: set at least one town or a region in the block settings.": [
|
||||||
"Piazza in Festa: indica almeno un comune o una regione nelle impostazioni del blocco."
|
"Piazza in Festa: indica almeno un comune o una regione nelle impostazioni del blocco."
|
||||||
|
],
|
||||||
|
"Layout": [
|
||||||
|
"Aspetto"
|
||||||
|
],
|
||||||
|
"List": [
|
||||||
|
"Elenco"
|
||||||
|
],
|
||||||
|
"Cards": [
|
||||||
|
"Schede"
|
||||||
|
],
|
||||||
|
"Carousel": [
|
||||||
|
"Carosello"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"translation-revision-date": "2026-09-04 12:00+0000",
|
"translation-revision-date": "2026-09-04 16:00+0000",
|
||||||
"generator": "manuale (nessun build step)",
|
"generator": "manuale (nessun build step)",
|
||||||
"domain": "messages",
|
"domain": "messages",
|
||||||
"locale_data": {
|
"locale_data": {
|
||||||
|
|
@ -68,6 +68,18 @@
|
||||||
],
|
],
|
||||||
"Piazza in Festa: set at least one town or a region in the block settings.": [
|
"Piazza in Festa: set at least one town or a region in the block settings.": [
|
||||||
"Piazza in Festa: indica almeno un comune o una regione nelle impostazioni del blocco."
|
"Piazza in Festa: indica almeno un comune o una regione nelle impostazioni del blocco."
|
||||||
|
],
|
||||||
|
"Layout": [
|
||||||
|
"Aspetto"
|
||||||
|
],
|
||||||
|
"List": [
|
||||||
|
"Elenco"
|
||||||
|
],
|
||||||
|
"Cards": [
|
||||||
|
"Schede"
|
||||||
|
],
|
||||||
|
"Carousel": [
|
||||||
|
"Carosello"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -120,3 +120,19 @@ msgstr "Si adatta da sola appena carica."
|
||||||
#: blocks/eventi/index.js
|
#: blocks/eventi/index.js
|
||||||
msgid "Piazza in Festa: set at least one town or a region in the block settings."
|
msgid "Piazza in Festa: set at least one town or a region in the block settings."
|
||||||
msgstr "Piazza in Festa: indica almeno un comune o una regione nelle impostazioni del blocco."
|
msgstr "Piazza in Festa: indica almeno un comune o una regione nelle impostazioni del blocco."
|
||||||
|
|
||||||
|
#: blocks/eventi/index.js
|
||||||
|
msgid "Layout"
|
||||||
|
msgstr "Aspetto"
|
||||||
|
|
||||||
|
#: blocks/eventi/index.js
|
||||||
|
msgid "List"
|
||||||
|
msgstr "Elenco"
|
||||||
|
|
||||||
|
#: blocks/eventi/index.js
|
||||||
|
msgid "Cards"
|
||||||
|
msgstr "Schede"
|
||||||
|
|
||||||
|
#: blocks/eventi/index.js
|
||||||
|
msgid "Carousel"
|
||||||
|
msgstr "Carosello"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue