Skip to content

Commit

Permalink
feat: custom feedback form title (#752)
Browse files Browse the repository at this point in the history
* fix: custom feedback form title

* fix: config

* chore: cleanup

* chore: cleanup comments

---------

Co-authored-by: Piero Nicolli <[email protected]>
  • Loading branch information
mamico and pnicolli authored Sep 5, 2024
1 parent e003eb0 commit 651cc36
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 62 deletions.
5 changes: 0 additions & 5 deletions locales/de/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -2094,11 +2094,6 @@ msgstr ""
msgid "feedback_form_title"
msgstr ""

#: components/ItaliaTheme/CustomerSatisfaction/FeedbackForm
# defaultMessage: How easy was it to use this service?
msgid "feedback_form_title_service"
msgstr ""

#: components/ItaliaTheme/CustomerSatisfaction/FeedbackForm
# defaultMessage: Yes
msgid "feedback_form_yes"
Expand Down
5 changes: 0 additions & 5 deletions locales/en/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -2079,11 +2079,6 @@ msgstr ""
msgid "feedback_form_title"
msgstr ""

#: components/ItaliaTheme/CustomerSatisfaction/FeedbackForm
# defaultMessage: How easy was it to use this service?
msgid "feedback_form_title_service"
msgstr ""

#: components/ItaliaTheme/CustomerSatisfaction/FeedbackForm
# defaultMessage: Yes
msgid "feedback_form_yes"
Expand Down
5 changes: 0 additions & 5 deletions locales/es/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -2088,11 +2088,6 @@ msgstr ""
msgid "feedback_form_title"
msgstr ""

#: components/ItaliaTheme/CustomerSatisfaction/FeedbackForm
# defaultMessage: How easy was it to use this service?
msgid "feedback_form_title_service"
msgstr ""

#: components/ItaliaTheme/CustomerSatisfaction/FeedbackForm
# defaultMessage: Yes
msgid "feedback_form_yes"
Expand Down
5 changes: 0 additions & 5 deletions locales/fr/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -2096,11 +2096,6 @@ msgstr ""
msgid "feedback_form_title"
msgstr ""

#: components/ItaliaTheme/CustomerSatisfaction/FeedbackForm
# defaultMessage: How easy was it to use this service?
msgid "feedback_form_title_service"
msgstr ""

#: components/ItaliaTheme/CustomerSatisfaction/FeedbackForm
# defaultMessage: Yes
msgid "feedback_form_yes"
Expand Down
5 changes: 0 additions & 5 deletions locales/it/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -2079,11 +2079,6 @@ msgstr "Grazie, il tuo parere ci aiuterà a migliorare il servizio!"
msgid "feedback_form_title"
msgstr "Quanto sono chiare le informazioni su questa pagina?"

#: components/ItaliaTheme/CustomerSatisfaction/FeedbackForm
# defaultMessage: How easy was it to use this service?
msgid "feedback_form_title_service"
msgstr "Quanto è stato facile usare questo servizio?"

#: components/ItaliaTheme/CustomerSatisfaction/FeedbackForm
# defaultMessage: Yes
msgid "feedback_form_yes"
Expand Down
7 changes: 1 addition & 6 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-08-06T16:50:24.401Z\n"
"POT-Creation-Date: 2024-08-29T12:09:17.914Z\n"
"Last-Translator: Plone i18n <[email protected]>\n"
"Language-Team: Plone i18n <[email protected]>\n"
"MIME-Version: 1.0\n"
Expand Down Expand Up @@ -2081,11 +2081,6 @@ msgstr ""
msgid "feedback_form_title"
msgstr ""

#: components/ItaliaTheme/CustomerSatisfaction/FeedbackForm
# defaultMessage: How easy was it to use this service?
msgid "feedback_form_title_service"
msgstr ""

#: components/ItaliaTheme/CustomerSatisfaction/FeedbackForm
# defaultMessage: Yes
msgid "feedback_form_yes"
Expand Down
21 changes: 3 additions & 18 deletions src/components/ItaliaTheme/CustomerSatisfaction/FeedbackForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ const messages = defineMessages({
id: 'feedback_form_title',
defaultMessage: 'How clear is the information on this page?',
},
service_title: {
id: 'feedback_form_title_service',
defaultMessage: 'How easy was it to use this service?',
},
yes: {
id: 'feedback_form_yes',
defaultMessage: 'Yes',
Expand Down Expand Up @@ -120,7 +116,7 @@ const messages = defineMessages({
},
});

const FeedbackForm = ({ contentType, pathname }) => {
const FeedbackForm = ({ title, pathname }) => {
const intl = useIntl();
const location = useLocation();
const path = pathname ?? location.pathname ?? '/';
Expand Down Expand Up @@ -273,18 +269,7 @@ const FeedbackForm = ({ contentType, pathname }) => {
className="title-medium-2-semi-bold mb-0"
data-element="feedback-title"
>
{/* Il validatore a quanto pare fa il check per titolo.
Il titolo da specifiche deve essere diverso per Servizi, ma loro non lo sanno
https://github.com/italia/pa-website-validator/blob/main/src/storage/municipality/feedbackComponentStructure.ts#L8
*/}
{/* {contentType === 'Servizio'
? intl.formatMessage(messages.service_title)
: intl.formatMessage(messages.title)} */}

{/* Aggiunto titolo per compatibilità modello AGID di io-cittadino */}
{contentType === 'ModelloPratica'
? intl.formatMessage(messages.service_title)
: intl.formatMessage(messages.title)}
{title || intl.formatMessage(messages.title)}
</h2>
<div className="rating-container mb-0">
<RTRating
Expand Down Expand Up @@ -455,7 +440,7 @@ const FeedbackForm = ({ contentType, pathname }) => {
};

FeedbackForm.propTypes = {
contentType: PropTypes.string,
title: PropTypes.string,
pathname: PropTypes.string,
};

Expand Down
1 change: 1 addition & 0 deletions src/config/italiaConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ export default function applyConfig(voltoConfig) {
],
},
enableFeedbackForm: true,
noFeedbackFormFor: ['ModelloPratica'],
enableFeedbackFormCaptcha: false,
enableVoltoFormBlockCaptcha: true,
splitMegamenuColumns: true, //se impostato a false, non spezza le colonne con intestazioni nel megamenu
Expand Down
20 changes: 7 additions & 13 deletions src/customizations/volto/components/theme/Footer/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,18 @@ import config from '@plone/volto/registry';
* @extends Component
*/

const Footer = ({ intl }) => {
const Footer = () => {
useGoogleAnalytics();
const currentContent = useSelector((state) => state.content?.data);
let contentType = null;
if (currentContent != null) {
contentType = currentContent?.['@type'];
}
// const NoFeedbackFormFor = ['Plone Site', 'LRF', 'Subsite'];
const NoFeedbackFormFor = [];
const contentType = currentContent ? currentContent['@type'] : null;
const noFeedbackFormFor = config.settings.siteProperties.noFeedbackFormFor || [];

let content = (
return (
<>
{contentType != null &&
NoFeedbackFormFor.indexOf(contentType) < 0 &&
{contentType &&
!noFeedbackFormFor.includes(contentType) &&
config.settings.siteProperties.enableFeedbackForm && (
<FeedbackForm contentType={contentType} />
<FeedbackForm />
)}

<SubsiteFooter />
Expand All @@ -46,8 +42,6 @@ const Footer = ({ intl }) => {
</footer>
</>
);

return content;
};

export default Footer;

0 comments on commit 651cc36

Please sign in to comment.