@plone/volto 17.0.0-alpha.0 → 17.0.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.yarn/install-state.gz +0 -0
- package/CHANGELOG.md +451 -19
- package/CONTRIBUTING.md +1 -1
- package/README.md +12 -15
- package/addon-registry.js +34 -0
- package/create-theme-addons-loader.js +79 -0
- package/cypress/support/commands.js +25 -0
- package/locales/ca/LC_MESSAGES/volto.po +187 -6
- package/locales/ca.json +1 -1
- package/locales/de/LC_MESSAGES/volto.po +206 -25
- package/locales/de.json +1 -1
- package/locales/en/LC_MESSAGES/volto.po +186 -5
- package/locales/en.json +1 -1
- package/locales/es/LC_MESSAGES/volto.po +187 -6
- package/locales/es.json +1 -1
- package/locales/eu/LC_MESSAGES/volto.po +187 -6
- package/locales/eu.json +1 -1
- package/locales/fi/LC_MESSAGES/volto.po +4792 -0
- package/locales/fi.json +1 -1
- package/locales/fr/LC_MESSAGES/volto.po +187 -6
- package/locales/fr.json +1 -1
- package/locales/it/LC_MESSAGES/volto.po +187 -6
- package/locales/it.json +1 -1
- package/locales/ja/LC_MESSAGES/volto.po +187 -6
- package/locales/ja.json +1 -1
- package/locales/nl/LC_MESSAGES/volto.po +842 -649
- package/locales/nl.json +1 -1
- package/locales/pt/LC_MESSAGES/volto.po +187 -6
- package/locales/pt.json +1 -1
- package/locales/pt_BR/LC_MESSAGES/volto.po +195 -14
- package/locales/pt_BR.json +1 -1
- package/locales/ro/LC_MESSAGES/volto.po +187 -6
- package/locales/ro.json +1 -1
- package/locales/volto.pot +187 -6
- package/locales/zh_CN/LC_MESSAGES/volto.po +187 -6
- package/locales/zh_CN.json +1 -1
- package/package-why.json +0 -1
- package/package.json +9 -8
- package/packages/volto-slate/build/messages/src/blocks/Table/TableBlockEdit.json +1 -1
- package/packages/volto-slate/build/messages/src/blocks/Text/DefaultTextBlockEditor.json +1 -1
- package/packages/volto-slate/build/messages/src/blocks/Text/DetachedTextBlockEditor.json +1 -1
- package/packages/volto-slate/build/messages/src/blocks/Text/SlashMenu.json +1 -1
- package/packages/volto-slate/build/messages/src/editor/plugins/AdvancedLink/index.json +1 -1
- package/packages/volto-slate/build/messages/src/editor/plugins/Link/index.json +1 -1
- package/packages/volto-slate/build/messages/src/editor/plugins/Table/index.json +1 -1
- package/packages/volto-slate/build/messages/src/elementEditor/messages.json +1 -1
- package/packages/volto-slate/build/messages/src/widgets/HtmlSlateWidget.json +1 -1
- package/packages/volto-slate/build/messages/src/widgets/RichTextWidgetView.json +1 -1
- package/packages/volto-slate/package.json +1 -1
- package/packages/volto-slate/src/blocks/Table/TableBlockView.jsx +4 -4
- package/packages/volto-slate/src/blocks/Table/index.js +2 -0
- package/packages/volto-slate/src/blocks/Text/SlashMenu.jsx +4 -3
- package/packages/volto-slate/src/editor/deserialize.js +0 -1
- package/packages/volto-slate/src/editor/plugins/StyleMenu/StyleMenu.jsx +14 -4
- package/razzle.config.js +28 -0
- package/src/actions/index.js +6 -0
- package/src/actions/language/language.js +9 -8
- package/src/actions/querystringsearch/querystringsearch.js +20 -14
- package/src/actions/relations/rebuild.js +25 -0
- package/src/actions/relations/relations.js +86 -0
- package/src/actions/relations/relations.test.js +15 -0
- package/src/components/index.js +1 -0
- package/src/components/manage/Add/Add.jsx +2 -2
- package/src/components/manage/BlockChooser/BlockChooser.jsx +14 -5
- package/src/components/manage/BlockChooser/BlockChooser.test.jsx +5 -0
- package/src/components/manage/BlockChooser/BlockChooserButton.jsx +63 -29
- package/src/components/manage/BlockChooser/BlockChooserSearch.jsx +0 -1
- package/src/components/manage/Blocks/Listing/Edit.jsx +0 -19
- package/src/components/manage/Blocks/Listing/ListingBody.jsx +77 -61
- package/src/components/manage/Blocks/Listing/View.jsx +0 -4
- package/src/components/manage/Blocks/Listing/getAsyncData.js +10 -2
- package/src/components/manage/Blocks/Listing/withQuerystringResults.jsx +18 -13
- package/src/components/manage/Blocks/Search/SearchBlockEdit.jsx +5 -4
- package/src/components/manage/Blocks/Search/SearchBlockView.jsx +2 -1
- package/src/components/manage/Blocks/Search/components/DateRangeFacet.jsx +4 -1
- package/src/components/manage/Blocks/Search/components/Facets.jsx +58 -2
- package/src/components/manage/Blocks/Search/hocs/withSearch.jsx +24 -11
- package/src/components/manage/Blocks/Search/layout/LeftColumnFacets.jsx +17 -5
- package/src/components/manage/Blocks/Search/layout/RightColumnFacets.jsx +17 -5
- package/src/components/manage/Blocks/Search/layout/TopSideFacets.jsx +21 -5
- package/src/components/manage/Blocks/Search/schema.js +16 -1
- package/src/components/manage/Blocks/ToC/Edit.jsx +1 -0
- package/src/components/manage/Contents/Contents.jsx +69 -33
- package/src/components/manage/Contents/ContentsItem.jsx +6 -0
- package/src/components/manage/Controlpanels/AddonsControlpanel.jsx +3 -3
- package/src/components/manage/Controlpanels/Controlpanels.jsx +199 -224
- package/src/components/manage/Controlpanels/Controlpanels.test.jsx +46 -7
- package/src/components/manage/Controlpanels/Relations/BrokenRelations.jsx +66 -0
- package/src/components/manage/Controlpanels/Relations/Relations.jsx +114 -0
- package/src/components/manage/Controlpanels/Relations/RelationsListing.jsx +479 -0
- package/src/components/manage/Controlpanels/Relations/RelationsMatrix.jsx +531 -0
- package/src/components/manage/Controlpanels/Users/UserGroupMembershipControlPanel.jsx +3 -3
- package/src/components/manage/Controlpanels/Users/UserGroupMembershipListing.jsx +51 -82
- package/src/components/manage/Controlpanels/Users/UserGroupMembershipMatrix.jsx +79 -75
- package/src/components/manage/DragDropList/DragDropList.jsx +63 -42
- package/src/components/manage/Form/BlocksToolbar.jsx +5 -1
- package/src/components/manage/Form/Form.jsx +11 -5
- package/src/components/manage/Form/InlineForm.jsx +39 -9
- package/src/components/manage/Form/InlineFormState.js +8 -0
- package/src/components/manage/History/History.jsx +35 -18
- package/src/components/manage/Multilingual/CreateTranslation.jsx +2 -2
- package/src/components/manage/Multilingual/TranslationObject.jsx +4 -3
- package/src/components/manage/Preferences/ChangePassword.jsx +2 -2
- package/src/components/manage/Preferences/PersonalPreferences.jsx +2 -2
- package/src/components/manage/Toast/Toast.jsx +1 -1
- package/src/components/manage/Toolbar/Types.jsx +2 -2
- package/src/components/manage/Widgets/DatetimeWidget.jsx +9 -5
- package/src/components/manage/Widgets/ObjectListWidget.jsx +3 -8
- package/src/components/manage/Widgets/RecurrenceWidget/ByDayField.jsx +2 -1
- package/src/components/manage/Widgets/RecurrenceWidget/MonthOfTheYearField.jsx +2 -1
- package/src/components/manage/Widgets/RecurrenceWidget/Occurences.jsx +2 -1
- package/src/components/manage/Widgets/RecurrenceWidget/RecurrenceWidget.jsx +7 -2
- package/src/components/manage/Widgets/RecurrenceWidget/WeekdayOfTheMonthField.jsx +2 -1
- package/src/components/manage/Widgets/SelectUtils.js +1 -1
- package/src/components/manage/Widgets/SelectWidget.jsx +1 -1
- package/src/components/theme/Footer/Footer.jsx +2 -13
- package/src/components/theme/Header/Header.jsx +37 -63
- package/src/components/theme/Header/Header.test.jsx +18 -0
- package/src/components/theme/Icon/Icon.jsx +2 -2
- package/src/components/theme/LanguageSelector/LanguageSelector.js +8 -3
- package/src/components/theme/Login/Login.jsx +1 -0
- package/src/components/theme/Logo/Logo.jsx +2 -1
- package/src/components/theme/MultilingualRedirector/MultilingualRedirector.jsx +2 -2
- package/src/components/theme/Navigation/NavItem.jsx +4 -2
- package/src/components/theme/NotFound/NotFound.jsx +55 -41
- package/src/components/theme/PasswordReset/PasswordReset.jsx +7 -4
- package/src/components/theme/PasswordReset/RequestPasswordReset.jsx +1 -1
- package/src/components/theme/Sitemap/Sitemap.jsx +5 -3
- package/src/components/theme/View/DefaultView.jsx +1 -1
- package/src/components/theme/View/EventDatesInfo.jsx +2 -1
- package/src/components/theme/View/EventView.jsx +1 -1
- package/src/components/theme/View/NewsItemView.jsx +1 -1
- package/src/components/theme/View/RenderBlocks.jsx +7 -1
- package/src/components/theme/Widgets/DateWidget.jsx +2 -1
- package/src/components/theme/Widgets/DatetimeWidget.jsx +2 -1
- package/src/components/theme/Widgets/RelationsWidget.jsx +13 -11
- package/src/config/ControlPanels.js +2 -0
- package/src/config/Widgets.jsx +1 -0
- package/src/config/index.js +3 -0
- package/src/config/server.js +19 -0
- package/src/constants/ActionTypes.js +4 -0
- package/src/constants/Languages.js +8 -4
- package/src/express-middleware/devproxy.js +4 -2
- package/src/express-middleware/sitemap.js +36 -4
- package/src/express-middleware/static.js +32 -0
- package/src/helpers/Api/Api.js +1 -1
- package/src/helpers/FormValidation/FormValidation.js +11 -2
- package/src/helpers/FormValidation/FormValidation.test.js +73 -0
- package/src/helpers/Html/Html.jsx +3 -1
- package/src/helpers/Html/Html.test.jsx +5 -0
- package/src/helpers/MessageLabels/MessageLabels.js +72 -0
- package/src/helpers/Robots/Robots.js +24 -6
- package/src/helpers/Sitemap/Sitemap.js +44 -2
- package/src/helpers/Url/Url.js +27 -6
- package/src/helpers/Url/Url.test.js +26 -0
- package/src/helpers/Utils/Utils.js +38 -13
- package/src/helpers/Utils/Utils.test.js +4 -4
- package/src/helpers/index.js +7 -2
- package/src/hooks/userSession/useToken.js +5 -0
- package/src/middleware/Api.test.js +54 -0
- package/src/middleware/api.js +8 -4
- package/src/reducers/actions/actions.js +1 -1
- package/src/reducers/breadcrumbs/breadcrumbs.js +1 -1
- package/src/reducers/index.js +2 -0
- package/src/reducers/navigation/navigation.js +1 -1
- package/src/reducers/relations/relations.js +173 -0
- package/src/reducers/types/types.js +1 -1
- package/src/routes.js +5 -0
- package/src/server.jsx +29 -30
- package/src/start-server.js +4 -2
- package/test-setup-config.js +1 -0
- package/theme/themes/pastanaga/extras/blocks.less +0 -9
- package/theme/themes/pastanaga/extras/contents.less +1 -0
- package/theme/themes/pastanaga/extras/main.less +80 -1
- package/theme/themes/pastanaga/extras/search.less +6 -0
- package/theme/themes/pastanaga/extras/sidebar.less +4 -0
- package/theme/themes/pastanaga/extras/userscontrolpanel.less +99 -76
- package/.changelog.draft +0 -22
- package/.editorconfig +0 -36
- package/.storybook/main.js +0 -127
- package/.storybook/manager.js +0 -15
- package/.storybook/preview.js +0 -21
- package/.storybook/static/previewImage.svg +0 -48
- package/.yarnrc.yml +0 -5
- package/jsdoc.json +0 -16
- package/netlify.toml +0 -5
- package/pyvenv.cfg +0 -3
- package/share/man/man1/ttx.1 +0 -225
- package/src/components/theme/Header/Header.md +0 -27
- package/towncrier.toml +0 -33
|
@@ -116,22 +116,37 @@ class History extends Component {
|
|
|
116
116
|
this.props.revertHistory(getBaseUrl(this.props.pathname), value);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
* @returns {string} Markup for the component.
|
|
123
|
-
*/
|
|
124
|
-
render() {
|
|
119
|
+
processHistoryEntries = () => {
|
|
120
|
+
// Getting the history entries from the props
|
|
121
|
+
// No clue why the reverse(concat()) is necessary
|
|
125
122
|
const entries = reverse(concat(this.props.entries));
|
|
126
123
|
let title = entries.length > 0 ? entries[0].state_title : '';
|
|
127
124
|
for (let x = 1; x < entries.length; x += 1) {
|
|
128
125
|
entries[x].prev_state_title = title;
|
|
129
126
|
title = entries[x].state_title || title;
|
|
130
127
|
}
|
|
128
|
+
// We reverse them again
|
|
131
129
|
reverse(entries);
|
|
130
|
+
|
|
131
|
+
// We identify the latest 'versioning' entry and mark it
|
|
132
|
+
const current_version = find(entries, (item) => item.type === 'versioning');
|
|
133
|
+
if (current_version) {
|
|
134
|
+
current_version.is_current = true;
|
|
135
|
+
}
|
|
136
|
+
return entries;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Render method.
|
|
141
|
+
* @method render
|
|
142
|
+
* @returns {string} Markup for the component.
|
|
143
|
+
*/
|
|
144
|
+
render() {
|
|
132
145
|
const historyAction = find(this.props.objectActions, {
|
|
133
146
|
id: 'history',
|
|
134
147
|
});
|
|
148
|
+
const entries = this.processHistoryEntries();
|
|
149
|
+
|
|
135
150
|
return !historyAction ? (
|
|
136
151
|
<>
|
|
137
152
|
{this.props.token ? (
|
|
@@ -266,18 +281,20 @@ class History extends Component {
|
|
|
266
281
|
/>
|
|
267
282
|
</Link>
|
|
268
283
|
)}
|
|
269
|
-
{'version' in entry &&
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
284
|
+
{'version' in entry &&
|
|
285
|
+
entry.may_revert &&
|
|
286
|
+
!entry.is_current && (
|
|
287
|
+
<Dropdown.Item
|
|
288
|
+
value={entry.version}
|
|
289
|
+
onClick={this.onRevert}
|
|
290
|
+
>
|
|
291
|
+
<Icon name="undo" />{' '}
|
|
292
|
+
<FormattedMessage
|
|
293
|
+
id="Revert to this revision"
|
|
294
|
+
defaultMessage="Revert to this revision"
|
|
295
|
+
/>
|
|
296
|
+
</Dropdown.Item>
|
|
297
|
+
)}
|
|
281
298
|
</Dropdown.Menu>
|
|
282
299
|
</Dropdown>
|
|
283
300
|
)}
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
getTranslationLocator,
|
|
7
7
|
getContent,
|
|
8
8
|
} from '@plone/volto/actions';
|
|
9
|
-
import { flattenToAppURL,
|
|
9
|
+
import { flattenToAppURL, toGettextLang } from '@plone/volto/helpers';
|
|
10
10
|
import config from '@plone/volto/registry';
|
|
11
11
|
|
|
12
12
|
const CreateTranslation = (props) => {
|
|
@@ -33,7 +33,7 @@ const CreateTranslation = (props) => {
|
|
|
33
33
|
return () => {
|
|
34
34
|
// We change the interface language
|
|
35
35
|
if (config.settings.supportedLanguages.includes(language)) {
|
|
36
|
-
const langFileName =
|
|
36
|
+
const langFileName = toGettextLang(language);
|
|
37
37
|
import('@root/../locales/' + langFileName + '.json').then((locale) => {
|
|
38
38
|
dispatch(changeLanguage(language, locale.default));
|
|
39
39
|
});
|
|
@@ -15,7 +15,8 @@ import {
|
|
|
15
15
|
Api,
|
|
16
16
|
flattenToAppURL,
|
|
17
17
|
langmap,
|
|
18
|
-
|
|
18
|
+
toGettextLang,
|
|
19
|
+
toReactIntlLang,
|
|
19
20
|
} from '@plone/volto/helpers';
|
|
20
21
|
import { createBrowserHistory } from 'history';
|
|
21
22
|
const messages = defineMessages({
|
|
@@ -55,9 +56,9 @@ const TranslationObject = ({
|
|
|
55
56
|
setLoadingLocale(true);
|
|
56
57
|
let lang =
|
|
57
58
|
config.settings.supportedLanguages[Object.keys(locales).length];
|
|
58
|
-
const langFileName =
|
|
59
|
+
const langFileName = toGettextLang(lang);
|
|
59
60
|
import('@root/../locales/' + langFileName + '.json').then((locale) => {
|
|
60
|
-
setLocales({ ...locales, [lang]: locale.default });
|
|
61
|
+
setLocales({ ...locales, [toReactIntlLang(lang)]: locale.default });
|
|
61
62
|
setLoadingLocale(false);
|
|
62
63
|
});
|
|
63
64
|
}
|
|
@@ -43,8 +43,8 @@ const messages = defineMessages({
|
|
|
43
43
|
defaultMessage: 'New password',
|
|
44
44
|
},
|
|
45
45
|
newPasswordDescription: {
|
|
46
|
-
id: 'Enter your new password. Minimum
|
|
47
|
-
defaultMessage: 'Enter your new password. Minimum
|
|
46
|
+
id: 'Enter your new password. Minimum 8 characters.',
|
|
47
|
+
defaultMessage: 'Enter your new password. Minimum 8 characters.',
|
|
48
48
|
},
|
|
49
49
|
newPasswordRepeatTitle: {
|
|
50
50
|
id: 'Confirm password',
|
|
@@ -15,7 +15,7 @@ import { toast } from 'react-toastify';
|
|
|
15
15
|
import { Form, Toast } from '@plone/volto/components';
|
|
16
16
|
import languages from '@plone/volto/constants/Languages';
|
|
17
17
|
import { changeLanguage } from '@plone/volto/actions';
|
|
18
|
-
import {
|
|
18
|
+
import { toGettextLang } from '@plone/volto/helpers';
|
|
19
19
|
import config from '@plone/volto/registry';
|
|
20
20
|
|
|
21
21
|
const messages = defineMessages({
|
|
@@ -86,7 +86,7 @@ class PersonalPreferences extends Component {
|
|
|
86
86
|
onSubmit(data) {
|
|
87
87
|
let language = data.language || 'en';
|
|
88
88
|
if (config.settings.supportedLanguages.includes(language)) {
|
|
89
|
-
const langFileName =
|
|
89
|
+
const langFileName = toGettextLang(language);
|
|
90
90
|
import('@root/../locales/' + langFileName + '.json').then((locale) => {
|
|
91
91
|
this.props.changeLanguage(language, locale.default);
|
|
92
92
|
});
|
|
@@ -4,7 +4,7 @@ import { connect } from 'react-redux';
|
|
|
4
4
|
import { Link } from 'react-router-dom';
|
|
5
5
|
import { filter, find, isEmpty, map } from 'lodash';
|
|
6
6
|
import { FormattedMessage } from 'react-intl';
|
|
7
|
-
import { flattenToAppURL, langmap } from '@plone/volto/helpers';
|
|
7
|
+
import { flattenToAppURL, langmap, toBackendLang } from '@plone/volto/helpers';
|
|
8
8
|
import config from '@plone/volto/registry';
|
|
9
9
|
|
|
10
10
|
const Types = ({ types, pathname, content, currentLanguage }) => {
|
|
@@ -59,7 +59,7 @@ const Types = ({ types, pathname, content, currentLanguage }) => {
|
|
|
59
59
|
find(content['@components'].translations.items, {
|
|
60
60
|
language: lang,
|
|
61
61
|
}),
|
|
62
|
-
) && currentLanguage !== lang,
|
|
62
|
+
) && toBackendLang(currentLanguage) !== lang,
|
|
63
63
|
);
|
|
64
64
|
|
|
65
65
|
return (
|
|
@@ -10,7 +10,7 @@ import { connect } from 'react-redux';
|
|
|
10
10
|
import loadable from '@loadable/component';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import { Icon, FormFieldWrapper } from '@plone/volto/components';
|
|
13
|
-
import { parseDateTime } from '@plone/volto/helpers';
|
|
13
|
+
import { parseDateTime, toBackendLang } from '@plone/volto/helpers';
|
|
14
14
|
import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
|
|
15
15
|
|
|
16
16
|
import leftKey from '@plone/volto/icons/left-key.svg';
|
|
@@ -101,7 +101,7 @@ export class DatetimeWidgetComponent extends Component {
|
|
|
101
101
|
// if passed value matches the construction time, we guess it's a default
|
|
102
102
|
isDefault:
|
|
103
103
|
parseDateTime(
|
|
104
|
-
this.props.lang,
|
|
104
|
+
toBackendLang(this.props.lang),
|
|
105
105
|
this.props.value,
|
|
106
106
|
undefined,
|
|
107
107
|
this.moment,
|
|
@@ -111,7 +111,7 @@ export class DatetimeWidgetComponent extends Component {
|
|
|
111
111
|
|
|
112
112
|
getInternalValue() {
|
|
113
113
|
return parseDateTime(
|
|
114
|
-
this.props.lang,
|
|
114
|
+
toBackendLang(this.props.lang),
|
|
115
115
|
this.props.value,
|
|
116
116
|
undefined,
|
|
117
117
|
this.moment,
|
|
@@ -211,7 +211,9 @@ export class DatetimeWidgetComponent extends Component {
|
|
|
211
211
|
{...(noPastDates ? {} : { isOutsideRange: () => false })}
|
|
212
212
|
onFocusChange={this.onFocusChange}
|
|
213
213
|
noBorder
|
|
214
|
-
displayFormat={moment
|
|
214
|
+
displayFormat={moment
|
|
215
|
+
.localeData(toBackendLang(lang))
|
|
216
|
+
.longDateFormat('L')}
|
|
215
217
|
navPrev={<PrevIcon />}
|
|
216
218
|
navNext={<NextIcon />}
|
|
217
219
|
id={`${id}-date`}
|
|
@@ -233,7 +235,9 @@ export class DatetimeWidgetComponent extends Component {
|
|
|
233
235
|
showSecond={false}
|
|
234
236
|
use12Hours={lang === 'en'}
|
|
235
237
|
id={`${id}-time`}
|
|
236
|
-
format={moment
|
|
238
|
+
format={moment
|
|
239
|
+
.localeData(toBackendLang(lang))
|
|
240
|
+
.longDateFormat('LT')}
|
|
237
241
|
placeholder={intl.formatMessage(messages.time)}
|
|
238
242
|
focusOnOpen
|
|
239
243
|
placement="bottomRight"
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { defineMessages, useIntl } from 'react-intl';
|
|
3
3
|
import { Accordion, Button, Segment } from 'semantic-ui-react';
|
|
4
4
|
import { DragDropList, FormFieldWrapper, Icon } from '@plone/volto/components';
|
|
5
|
-
import { applySchemaDefaults } from '@plone/volto/helpers';
|
|
5
|
+
import { applySchemaDefaults, reorderArray } from '@plone/volto/helpers';
|
|
6
6
|
import ObjectWidget from '@plone/volto/components/manage/Widgets/ObjectWidget';
|
|
7
7
|
|
|
8
8
|
import upSVG from '@plone/volto/icons/up-key.svg';
|
|
@@ -164,13 +164,8 @@ const ObjectListWidget = (props) => {
|
|
|
164
164
|
if (!destination) {
|
|
165
165
|
return;
|
|
166
166
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
const second = value[destination.index];
|
|
170
|
-
value[destination.index] = first;
|
|
171
|
-
value[source.index] = second;
|
|
172
|
-
|
|
173
|
-
onChange(id, value);
|
|
167
|
+
const newValue = reorderArray(value, source.index, destination.index);
|
|
168
|
+
onChange(id, newValue);
|
|
174
169
|
return true;
|
|
175
170
|
}}
|
|
176
171
|
>
|
|
@@ -7,6 +7,7 @@ import React from 'react';
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { Form, Grid, Button } from 'semantic-ui-react';
|
|
9
9
|
import { Days } from './Utils';
|
|
10
|
+
import { toBackendLang } from '@plone/volto/helpers';
|
|
10
11
|
import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
|
|
11
12
|
import { useSelector } from 'react-redux';
|
|
12
13
|
|
|
@@ -18,7 +19,7 @@ import { useSelector } from 'react-redux';
|
|
|
18
19
|
const ByDayField = ({ label, value, onChange, moment: momentlib }) => {
|
|
19
20
|
const lang = useSelector((state) => state.intl.locale);
|
|
20
21
|
const moment = momentlib.default;
|
|
21
|
-
moment.locale(lang);
|
|
22
|
+
moment.locale(toBackendLang(lang));
|
|
22
23
|
|
|
23
24
|
const toggleWeekDay = (dayName) => {
|
|
24
25
|
var day = Days[dayName];
|
|
@@ -8,6 +8,7 @@ import PropTypes from 'prop-types';
|
|
|
8
8
|
import { map } from 'lodash';
|
|
9
9
|
import { Form } from 'semantic-ui-react';
|
|
10
10
|
import SelectInput from './SelectInput';
|
|
11
|
+
import { toBackendLang } from '@plone/volto/helpers';
|
|
11
12
|
import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
|
|
12
13
|
import { useSelector } from 'react-redux';
|
|
13
14
|
|
|
@@ -25,7 +26,7 @@ const MonthOfTheYearField = ({
|
|
|
25
26
|
}) => {
|
|
26
27
|
const moment = momentlib.default;
|
|
27
28
|
const lang = useSelector((state) => state.intl.locale);
|
|
28
|
-
moment.locale(lang);
|
|
29
|
+
moment.locale(toBackendLang(lang));
|
|
29
30
|
const monthList = [
|
|
30
31
|
...map(moment.months(), (m, i) => ({
|
|
31
32
|
value: i + 1,
|
|
@@ -11,6 +11,7 @@ import { List, Button, Header, Label } from 'semantic-ui-react';
|
|
|
11
11
|
import { Icon } from '@plone/volto/components';
|
|
12
12
|
import addSVG from '@plone/volto/icons/circle-plus.svg';
|
|
13
13
|
import trashSVG from '@plone/volto/icons/delete.svg';
|
|
14
|
+
import { toBackendLang } from '@plone/volto/helpers';
|
|
14
15
|
import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
|
|
15
16
|
|
|
16
17
|
import { useSelector } from 'react-redux';
|
|
@@ -68,7 +69,7 @@ const Occurences_ = ({
|
|
|
68
69
|
}) => {
|
|
69
70
|
const moment = momentlib.default;
|
|
70
71
|
const lang = useSelector((state) => state.intl.locale);
|
|
71
|
-
moment.locale(lang);
|
|
72
|
+
moment.locale(toBackendLang(lang));
|
|
72
73
|
let all = [];
|
|
73
74
|
const isExcluded = (date) => {
|
|
74
75
|
var dateISO = toISOString(date);
|
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
} from 'semantic-ui-react';
|
|
24
24
|
|
|
25
25
|
import { SelectWidget, Icon, DatetimeWidget } from '@plone/volto/components';
|
|
26
|
+
import { toBackendLang } from '@plone/volto/helpers';
|
|
26
27
|
import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
|
|
27
28
|
|
|
28
29
|
import saveSVG from '@plone/volto/icons/save.svg';
|
|
@@ -183,7 +184,7 @@ class RecurrenceWidget extends Component {
|
|
|
183
184
|
const { RRuleSet, rrulestr } = props.rrule;
|
|
184
185
|
|
|
185
186
|
this.moment = this.props.moment.default;
|
|
186
|
-
this.moment.locale(this.props.lang);
|
|
187
|
+
this.moment.locale(toBackendLang(this.props.lang));
|
|
187
188
|
|
|
188
189
|
let rruleSet = this.props.value
|
|
189
190
|
? rrulestr(props.value, {
|
|
@@ -201,7 +202,11 @@ class RecurrenceWidget extends Component {
|
|
|
201
202
|
open: false,
|
|
202
203
|
rruleSet: rruleSet,
|
|
203
204
|
formValues: this.getFormValues(rruleSet),
|
|
204
|
-
RRULE_LANGUAGE: rrulei18n(
|
|
205
|
+
RRULE_LANGUAGE: rrulei18n(
|
|
206
|
+
this.props.intl,
|
|
207
|
+
this.moment,
|
|
208
|
+
toBackendLang(this.props.lang),
|
|
209
|
+
),
|
|
205
210
|
};
|
|
206
211
|
}
|
|
207
212
|
|
|
@@ -8,6 +8,7 @@ import { map } from 'lodash';
|
|
|
8
8
|
import { Days } from './Utils';
|
|
9
9
|
import SelectInput from './SelectInput';
|
|
10
10
|
import { Form } from 'semantic-ui-react';
|
|
11
|
+
import { toBackendLang } from '@plone/volto/helpers';
|
|
11
12
|
import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
|
|
12
13
|
import { useSelector } from 'react-redux';
|
|
13
14
|
|
|
@@ -22,7 +23,7 @@ const WeekdayOfTheMonthField = (props) => {
|
|
|
22
23
|
const lang = useSelector((state) => state.intl.locale);
|
|
23
24
|
|
|
24
25
|
const moment = momentlib.default;
|
|
25
|
-
moment.locale(lang);
|
|
26
|
+
moment.locale(toBackendLang(lang));
|
|
26
27
|
|
|
27
28
|
const weekdayOfTheMonthList = [
|
|
28
29
|
...map(Object.keys(Days), (d) => ({
|
|
@@ -54,7 +54,7 @@ export function normalizeSingleSelectOption(value, intl) {
|
|
|
54
54
|
throw new Error(`Unknown value type of select widget: ${value}`);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
const token = value.token ?? value.value ?? 'no-value';
|
|
57
|
+
const token = value.token ?? value.value ?? value.UID ?? 'no-value';
|
|
58
58
|
const label =
|
|
59
59
|
(value.title && value.title !== 'None' ? value.title : undefined) ??
|
|
60
60
|
value.label ??
|
|
@@ -202,7 +202,7 @@ class SelectWidget extends Component {
|
|
|
202
202
|
|
|
203
203
|
const isMulti = this.props.isMulti
|
|
204
204
|
? this.props.isMulti
|
|
205
|
-
: id === 'roles' || id === 'groups';
|
|
205
|
+
: id === 'roles' || id === 'groups' || this.props.type === 'array';
|
|
206
206
|
|
|
207
207
|
return (
|
|
208
208
|
<FormFieldWrapper {...this.props}>
|
|
@@ -9,7 +9,6 @@ import { map } from 'lodash';
|
|
|
9
9
|
import { FormattedMessage, defineMessages, injectIntl } from 'react-intl';
|
|
10
10
|
import { useSelector, shallowEqual } from 'react-redux';
|
|
11
11
|
import { UniversalLink } from '@plone/volto/components';
|
|
12
|
-
import config from '@plone/volto/registry';
|
|
13
12
|
import { flattenToAppURL, addAppURL } from '@plone/volto/helpers';
|
|
14
13
|
|
|
15
14
|
const messages = defineMessages({
|
|
@@ -26,10 +25,8 @@ const messages = defineMessages({
|
|
|
26
25
|
* @returns {string} Markup of the component
|
|
27
26
|
*/
|
|
28
27
|
const Footer = ({ intl }) => {
|
|
29
|
-
const {
|
|
30
|
-
const { lang, siteActions = [] } = useSelector(
|
|
28
|
+
const { siteActions = [] } = useSelector(
|
|
31
29
|
(state) => ({
|
|
32
|
-
lang: state.intl.locale,
|
|
33
30
|
siteActions: state.actions?.actions?.site_actions,
|
|
34
31
|
}),
|
|
35
32
|
shallowEqual,
|
|
@@ -97,15 +94,7 @@ const Footer = ({ intl }) => {
|
|
|
97
94
|
<UniversalLink
|
|
98
95
|
className="item"
|
|
99
96
|
href={
|
|
100
|
-
|
|
101
|
-
? `/${lang}/${
|
|
102
|
-
item.url
|
|
103
|
-
? flattenToAppURL(item.url)
|
|
104
|
-
: addAppURL(item.id)
|
|
105
|
-
}`
|
|
106
|
-
: item.url
|
|
107
|
-
? flattenToAppURL(item.url)
|
|
108
|
-
: addAppURL(item.id)
|
|
97
|
+
item.url ? flattenToAppURL(item.url) : addAppURL(item.id)
|
|
109
98
|
}
|
|
110
99
|
>
|
|
111
100
|
{item?.title}
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Header component.
|
|
3
|
-
* @module components/theme/Header/Header
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import React, { Component } from 'react';
|
|
7
1
|
import { Container, Segment } from 'semantic-ui-react';
|
|
8
2
|
import PropTypes from 'prop-types';
|
|
9
|
-
import {
|
|
3
|
+
import { useToken } from '@plone/volto/hooks/userSession/useToken';
|
|
10
4
|
|
|
11
5
|
import {
|
|
12
6
|
Anontools,
|
|
@@ -16,65 +10,45 @@ import {
|
|
|
16
10
|
SearchWidget,
|
|
17
11
|
} from '@plone/volto/components';
|
|
18
12
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
* @class Header
|
|
22
|
-
* @extends Component
|
|
23
|
-
*/
|
|
24
|
-
class Header extends Component {
|
|
25
|
-
/**
|
|
26
|
-
* Property types.
|
|
27
|
-
* @property {Object} propTypes Property types.
|
|
28
|
-
* @static
|
|
29
|
-
*/
|
|
30
|
-
static propTypes = {
|
|
31
|
-
token: PropTypes.string,
|
|
32
|
-
pathname: PropTypes.string.isRequired,
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Default properties.
|
|
37
|
-
* @property {Object} defaultProps Default properties.
|
|
38
|
-
* @static
|
|
39
|
-
*/
|
|
40
|
-
static defaultProps = {
|
|
41
|
-
token: null,
|
|
42
|
-
};
|
|
13
|
+
const Header = ({ pathname }) => {
|
|
14
|
+
const token = useToken();
|
|
43
15
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
<Segment basic className="header-wrapper" role="banner">
|
|
52
|
-
<Container>
|
|
53
|
-
<div className="header">
|
|
54
|
-
<div className="logo-nav-wrapper">
|
|
55
|
-
<div className="logo">
|
|
56
|
-
<Logo />
|
|
57
|
-
</div>
|
|
58
|
-
<Navigation pathname={this.props.pathname} />
|
|
16
|
+
return (
|
|
17
|
+
<Segment basic className="header-wrapper" role="banner">
|
|
18
|
+
<Container>
|
|
19
|
+
<div className="header">
|
|
20
|
+
<div className="logo-nav-wrapper">
|
|
21
|
+
<div className="logo">
|
|
22
|
+
<Logo />
|
|
59
23
|
</div>
|
|
60
|
-
<
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
<div className="search">
|
|
68
|
-
<SearchWidget />
|
|
24
|
+
<Navigation pathname={pathname} />
|
|
25
|
+
</div>
|
|
26
|
+
<div className="tools-search-wrapper">
|
|
27
|
+
<LanguageSelector />
|
|
28
|
+
{!token && (
|
|
29
|
+
<div className="tools">
|
|
30
|
+
<Anontools />
|
|
69
31
|
</div>
|
|
32
|
+
)}
|
|
33
|
+
<div className="search">
|
|
34
|
+
<SearchWidget />
|
|
70
35
|
</div>
|
|
71
36
|
</div>
|
|
72
|
-
</
|
|
73
|
-
</
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
37
|
+
</div>
|
|
38
|
+
</Container>
|
|
39
|
+
</Segment>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export default Header;
|
|
44
|
+
|
|
45
|
+
Header.propTypes = {
|
|
46
|
+
token: PropTypes.string,
|
|
47
|
+
pathname: PropTypes.string.isRequired,
|
|
48
|
+
content: PropTypes.objectOf(PropTypes.any),
|
|
49
|
+
};
|
|
77
50
|
|
|
78
|
-
|
|
79
|
-
token:
|
|
80
|
-
|
|
51
|
+
Header.defaultProps = {
|
|
52
|
+
token: null,
|
|
53
|
+
content: null,
|
|
54
|
+
};
|
|
@@ -39,4 +39,22 @@ describe('Header', () => {
|
|
|
39
39
|
const json = component.toJSON();
|
|
40
40
|
expect(json).toMatchSnapshot();
|
|
41
41
|
});
|
|
42
|
+
|
|
43
|
+
it('renders a header component - auth', () => {
|
|
44
|
+
const store = mockStore({
|
|
45
|
+
userSession: { token: '1234567890' },
|
|
46
|
+
intl: {
|
|
47
|
+
locale: 'en',
|
|
48
|
+
messages: {},
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const component = renderer.create(
|
|
53
|
+
<Provider store={store}>
|
|
54
|
+
<Header pathname="/blog" />
|
|
55
|
+
</Provider>,
|
|
56
|
+
);
|
|
57
|
+
const json = component.toJSON();
|
|
58
|
+
expect(json).toMatchSnapshot();
|
|
59
|
+
});
|
|
42
60
|
});
|
|
@@ -44,8 +44,8 @@ const Icon = ({
|
|
|
44
44
|
ariaHidden,
|
|
45
45
|
}) => (
|
|
46
46
|
<svg
|
|
47
|
-
xmlns={name
|
|
48
|
-
viewBox={name
|
|
47
|
+
xmlns={name?.attributes?.xmlns}
|
|
48
|
+
viewBox={name?.attributes?.viewBox}
|
|
49
49
|
style={{
|
|
50
50
|
height: size,
|
|
51
51
|
width: 'auto',
|
|
@@ -11,7 +11,12 @@ import { useSelector } from 'react-redux';
|
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import { find, map } from 'lodash';
|
|
13
13
|
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
Helmet,
|
|
16
|
+
langmap,
|
|
17
|
+
flattenToAppURL,
|
|
18
|
+
toReactIntlLang,
|
|
19
|
+
} from '@plone/volto/helpers';
|
|
15
20
|
|
|
16
21
|
import config from '@plone/volto/registry';
|
|
17
22
|
|
|
@@ -42,7 +47,7 @@ const LanguageSelector = (props) => {
|
|
|
42
47
|
aria-label={`${intl.formatMessage(
|
|
43
48
|
messages.switchLanguageTo,
|
|
44
49
|
)} ${langmap[lang].nativeName.toLowerCase()}`}
|
|
45
|
-
className={cx({ selected: lang === currentLang })}
|
|
50
|
+
className={cx({ selected: toReactIntlLang(lang) === currentLang })}
|
|
46
51
|
to={translation ? flattenToAppURL(translation['@id']) : `/${lang}`}
|
|
47
52
|
title={langmap[lang].nativeName}
|
|
48
53
|
onClick={() => {
|
|
@@ -57,7 +62,7 @@ const LanguageSelector = (props) => {
|
|
|
57
62
|
</div>
|
|
58
63
|
) : (
|
|
59
64
|
<Helmet>
|
|
60
|
-
<html lang={settings.defaultLanguage} />
|
|
65
|
+
<html lang={toReactIntlLang(settings.defaultLanguage)} />
|
|
61
66
|
</Helmet>
|
|
62
67
|
);
|
|
63
68
|
};
|
|
@@ -8,6 +8,7 @@ import { Image } from 'semantic-ui-react';
|
|
|
8
8
|
import { useSelector } from 'react-redux';
|
|
9
9
|
import config from '@plone/volto/registry';
|
|
10
10
|
import { UniversalLink } from '@plone/volto/components';
|
|
11
|
+
import { toBackendLang } from '@plone/volto/helpers';
|
|
11
12
|
import LogoImage from '@plone/volto/components/theme/Logo/Logo.svg';
|
|
12
13
|
|
|
13
14
|
const messages = defineMessages({
|
|
@@ -34,7 +35,7 @@ const Logo = () => {
|
|
|
34
35
|
|
|
35
36
|
return (
|
|
36
37
|
<UniversalLink
|
|
37
|
-
href={settings.isMultilingual ? `/${lang}` : '/'}
|
|
38
|
+
href={settings.isMultilingual ? `/${toBackendLang(lang)}` : '/'}
|
|
38
39
|
title={intl.formatMessage(messages.site)}
|
|
39
40
|
>
|
|
40
41
|
<Image
|
|
@@ -4,7 +4,7 @@ import { useDispatch } from 'react-redux';
|
|
|
4
4
|
import { useCookies } from 'react-cookie';
|
|
5
5
|
import config from '@plone/volto/registry';
|
|
6
6
|
import { changeLanguage } from '@plone/volto/actions';
|
|
7
|
-
import {
|
|
7
|
+
import { toGettextLang } from '@plone/volto/helpers';
|
|
8
8
|
|
|
9
9
|
const MultilingualRedirector = (props) => {
|
|
10
10
|
const { settings } = config;
|
|
@@ -23,7 +23,7 @@ const MultilingualRedirector = (props) => {
|
|
|
23
23
|
// const detectedLang = (navigator.language || navigator.userLanguage).substring(0, 2);
|
|
24
24
|
let mounted = true;
|
|
25
25
|
if (settings.isMultilingual && pathname === '/') {
|
|
26
|
-
const langFileName =
|
|
26
|
+
const langFileName = toGettextLang(redirectToLanguage);
|
|
27
27
|
import('@root/../locales/' + langFileName + '.json').then((locale) => {
|
|
28
28
|
if (mounted) {
|
|
29
29
|
dispatch(changeLanguage(redirectToLanguage, locale.default));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { NavLink } from 'react-router-dom';
|
|
3
|
-
import { isInternalURL } from '@plone/volto/helpers';
|
|
3
|
+
import { isInternalURL, toBackendLang } from '@plone/volto/helpers';
|
|
4
4
|
import config from '@plone/volto/registry';
|
|
5
5
|
|
|
6
6
|
const NavItem = ({ item, lang }) => {
|
|
@@ -15,7 +15,9 @@ const NavItem = ({ item, lang }) => {
|
|
|
15
15
|
className="item"
|
|
16
16
|
activeClassName="active"
|
|
17
17
|
exact={
|
|
18
|
-
settings.isMultilingual
|
|
18
|
+
settings.isMultilingual
|
|
19
|
+
? item.url === `/${toBackendLang(lang)}`
|
|
20
|
+
: item.url === ''
|
|
19
21
|
}
|
|
20
22
|
>
|
|
21
23
|
{item.title}
|