forked from italia/design-comuni-plone-theme
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add new widget for event luoghi_correlati with custom form vali…
…dation
- Loading branch information
Showing
13 changed files
with
531 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-01-11T13:44:40.490Z\n" | ||
"POT-Creation-Date: 2024-01-15T16:05:18.583Z\n" | ||
"Last-Translator: Plone i18n <[email protected]>\n" | ||
"Language-Team: Plone i18n <[email protected]>\n" | ||
"MIME-Version: 1.0\n" | ||
|
@@ -2407,6 +2407,11 @@ msgstr "" | |
msgid "luoghi_correlati" | ||
msgstr "" | ||
|
||
#: components/ItaliaTheme/manage/Widgets/LuoghiCorrelatiEventoWidget | ||
# defaultMessage: Luogo dell'evento | ||
msgid "luoghi_correlati_evento_widget_title" | ||
msgstr "" | ||
|
||
#: components/ItaliaTheme/View/NewsItemView/NewsItemLuoghiCorrelati | ||
# defaultMessage: Luoghi | ||
msgid "luoghi_notizia" | ||
|
64 changes: 64 additions & 0 deletions
64
src/components/ItaliaTheme/manage/Widgets/LuoghiCorrelatiEventoWidget.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { defineMessages, useIntl } from 'react-intl'; | ||
import { Form } from 'semantic-ui-react'; | ||
import cx from 'classnames'; | ||
import config from '@plone/volto/registry'; | ||
|
||
const messages = defineMessages({ | ||
luoghi_correlati_evento_widget_title: { | ||
id: 'luoghi_correlati_evento_widget_title', | ||
defaultMessage: "Luogo dell'evento", | ||
}, | ||
}); | ||
|
||
const LuoghiCorrelatiEventoWidget = (props) => { | ||
const Widget = config.widgets.factory['Relation List']; | ||
const intl = useIntl(); | ||
|
||
return ( | ||
<Form.Field | ||
inline | ||
required={false} | ||
className={cx( | ||
'help', | ||
'luoghi-correlati-evento-widget', | ||
`field-wrapper-${props.id}`, | ||
props?.multilingual_options?.language_independent | ||
? 'language-independent-field' | ||
: null, | ||
)} | ||
> | ||
<div className="introduction-helper-wrapper"> | ||
<h3 className="field-title"> | ||
{intl.formatMessage(messages.luoghi_correlati_evento_widget_title)} | ||
</h3> | ||
<p className="help"> | ||
Sezione obbligatoria secondo il{' '} | ||
<a | ||
target="_blank" | ||
href="https://docs.italia.it/italia/designers-italia/design-comuni-docs/it/versione-corrente/conformita/buone-pratiche-asseverazione.html" | ||
rel="noopener noreferrer" | ||
> | ||
documento di buone pratiche per l'asseverazione dei siti | ||
</a> | ||
. Per confermare la presenza in pagina della relativa sezione devono | ||
essere presenti: | ||
<ul> | ||
<li> | ||
«Luoghi correlati» che è un campo con un riferimento ad un oggetto | ||
di tipo Luogo già presente sul sito. Se compilato, questo campo è | ||
sufficiente per la validazione della compilazione del modulo. | ||
</li> | ||
<li> | ||
Se non è possibile compilare il campo «Luoghi correlati», è | ||
necessario compilare almeno i campi «Nome sede», «Via», «Città» e | ||
«Nazione» sottostanti. | ||
</li> | ||
</ul> | ||
</p> | ||
</div> | ||
<Widget {...props} /> | ||
</Form.Field> | ||
); | ||
}; | ||
|
||
export default LuoghiCorrelatiEventoWidget; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.