design-comuni-plone-theme 11.24.1 → 11.24.3

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.
Binary file
package/CHANGELOG.md CHANGED
@@ -1,5 +1,39 @@
1
1
 
2
2
 
3
+ ## [11.24.3](https://github.com/RedTurtle/design-comuni-plone-theme/compare/v11.24.2...v11.24.3) (2024-10-24)
4
+
5
+
6
+ ### Features
7
+
8
+ * show end of recurrence date instead of end date in event ct when set ([#789](https://github.com/RedTurtle/design-comuni-plone-theme/issues/789)) ([23e06c4](https://github.com/RedTurtle/design-comuni-plone-theme/commit/23e06c4c619d41d780f01a67502082d7603e199e))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * append / to the end of apiPath because if it hasn't, internal url check for mp4 links fails. ([#794](https://github.com/RedTurtle/design-comuni-plone-theme/issues/794)) ([4f84bc3](https://github.com/RedTurtle/design-comuni-plone-theme/commit/4f84bc31b50b14657d53961ae4e4171e1c68b765))
14
+
15
+
16
+ ### Maintenance
17
+
18
+ * added BE info in release.md bc impacts usability ([#791](https://github.com/RedTurtle/design-comuni-plone-theme/issues/791)) ([b608189](https://github.com/RedTurtle/design-comuni-plone-theme/commit/b60818985b4065035cc9b4015890adfe6dbf86db))
19
+
20
+
21
+ ### Documentation
22
+
23
+ * updated publiccode and release log ([ffe98a5](https://github.com/RedTurtle/design-comuni-plone-theme/commit/ffe98a5896d6efd05ed63ca64f8a58c7282a0030))
24
+
25
+ ## [11.24.2](https://github.com/RedTurtle/design-comuni-plone-theme/compare/v11.24.1...v11.24.2) (2024-10-16)
26
+
27
+
28
+ ### Bug Fixes
29
+
30
+ * do not break LinkView for anonymous users ([#786](https://github.com/RedTurtle/design-comuni-plone-theme/issues/786)) ([a45b7e6](https://github.com/RedTurtle/design-comuni-plone-theme/commit/a45b7e6f9f376526e4e382988371ff46bcb6899e))
31
+
32
+
33
+ ### Documentation
34
+
35
+ * updated publiccode ([ade6642](https://github.com/RedTurtle/design-comuni-plone-theme/commit/ade66429389d5632b9071a687e2f8fe25b2b84f1))
36
+
3
37
  ## [11.24.1](https://github.com/RedTurtle/design-comuni-plone-theme/compare/v11.24.0...v11.24.1) (2024-10-09)
4
38
 
5
39
 
package/RELEASE.md CHANGED
@@ -41,6 +41,16 @@
41
41
  - ...
42
42
  -->
43
43
 
44
+ ## Versione 11.24.3 (24/10/2024)
45
+
46
+ ### Migliorie
47
+
48
+ - Quando viene impostata una ricorrenza, nel tipo di contenuto Evento viene mostrata la data di fine della ricorrenza invece che del singolo evento
49
+
50
+ ### Fix
51
+
52
+ - Risolto problema con i video esterni che puntano a degli mp4: ora non vengono più erroneamente visti come link interni.
53
+
44
54
  ## Versione 11.24.0 (03/10/2024)
45
55
 
46
56
  ### Migliorie
@@ -202,6 +212,10 @@
202
212
 
203
213
  ## Versione 11.12.5 (30/05/2024)
204
214
 
215
+ ### Novità
216
+
217
+ - Per ragioni di conformità alle linee guida Agid, inibito l'inserimento di CT File nella cartella modulistica.
218
+
205
219
  ### Fix
206
220
 
207
221
  - Sistemato il layout "Card con immagine" dei blocchi elenco quando gli elementi non hanno immagine.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "design-comuni-plone-theme",
3
3
  "description": "Volto Theme for Italia design guidelines",
4
4
  "license": "GPL-v3",
5
- "version": "11.24.1",
5
+ "version": "11.24.3",
6
6
  "main": "src/index.js",
7
7
  "repository": {
8
8
  "type": "git",
package/publiccode.yml CHANGED
@@ -227,9 +227,9 @@ maintenance:
227
227
  name: io-Comune - Il sito AgID per Comuni ed Enti Pubblici
228
228
  platforms:
229
229
  - web
230
- releaseDate: '2024-10-03'
230
+ releaseDate: '2024-10-24'
231
231
  softwareType: standalone/web
232
- softwareVersion: 11.24.0
232
+ softwareVersion: 11.24.3
233
233
  url: 'https://github.com/italia/design-comuni-plone-theme'
234
234
  usedBy:
235
235
  - ASP Comuni Modenesi Area Nord
@@ -4,7 +4,7 @@ import { rrulei18n } from '@plone/volto/components/manage/Widgets/RecurrenceWidg
4
4
  import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
5
5
  import { Card, CardTitle, CardBody } from 'design-react-kit';
6
6
  import PropTypes from 'prop-types';
7
- import { viewDate } from 'design-comuni-plone-theme/helpers';
7
+ import { viewDate, getRealEventEnd } from 'design-comuni-plone-theme/helpers';
8
8
 
9
9
  const messages = defineMessages({
10
10
  start: {
@@ -46,19 +46,23 @@ const Dates = ({ content, show_image, moment: momentlib, rrule }) => {
46
46
 
47
47
  const rrulestr = rrule.rrulestr;
48
48
 
49
- let rruleSet = null;
50
49
  let recurrenceText = null;
51
50
 
51
+ const rruleSet = content.recurrence
52
+ ? rrulestr(content?.recurrence, {
53
+ compatible: true, //If set to True, the parser will operate in RFC-compatible mode. Right now it means that unfold will be turned on, and if a DTSTART is found, it will be considered the first recurrence instance, as documented in the RFC.
54
+ forceset: true,
55
+ })
56
+ : null;
57
+
58
+ const actualEndDate = getRealEventEnd(content, rruleSet);
59
+
52
60
  if (content.recurrence) {
53
61
  const isRecurrenceByDay = content.recurrence.includes('BYDAY=+');
54
62
  const isWeekdaySunday = content.recurrence
55
63
  .split('BYDAY')[1]
56
64
  ?.includes('SU');
57
65
  const RRULE_LANGUAGE = rrulei18n(intl, moment);
58
- rruleSet = rrulestr(content.recurrence, {
59
- compatible: true, //If set to True, the parser will operate in RFC-compatible mode. Right now it means that unfold will be turned on, and if a DTSTART is found, it will be considered the first recurrence instance, as documented in the RFC.
60
- forceset: true,
61
- });
62
66
 
63
67
  recurrenceText = rruleSet.rrules()[0]?.toText(
64
68
  (t) => {
@@ -79,7 +83,8 @@ const Dates = ({ content, show_image, moment: momentlib, rrule }) => {
79
83
  );
80
84
  }
81
85
  const start = viewDate(intl.locale, content.start);
82
- const end = viewDate(intl.locale, content.end);
86
+ // format and save date into new variable depending on recurrence of event
87
+ const end = viewDate(intl.locale, actualEndDate);
83
88
  const openEnd = content?.open_end;
84
89
  const wholeDay = content?.whole_day;
85
90
  const rdates = rruleSet?.rdates() ?? [];
@@ -4,6 +4,7 @@ import PropTypes from 'prop-types';
4
4
 
5
5
  import { rrulei18n } from '@plone/volto/components/manage/Widgets/RecurrenceWidget/Utils';
6
6
  import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
7
+ import { getRealEventEnd } from 'design-comuni-plone-theme/helpers';
7
8
 
8
9
  const messages = defineMessages({
9
10
  dateStart: {
@@ -25,11 +26,23 @@ const PageHeaderEventDates = ({ content, moment, rrule }) => {
25
26
  Moment.locale(intl.locale);
26
27
 
27
28
  const rrulestr = rrule.rrulestr;
29
+
30
+ const rruleSet = content.recurrence
31
+ ? rrulestr(content?.recurrence, {
32
+ compatible: true, //If set to True, the parser will operate in RFC-compatible mode. Right now it means that unfold will be turned on, and if a DTSTART is found, it will be considered the first recurrence instance, as documented in the RFC.
33
+ forceset: true,
34
+ })
35
+ : null;
36
+
37
+ const actualEndDate = getRealEventEnd(content, rruleSet);
38
+
28
39
  const wholeDay = content?.whole_day;
29
40
  const openEnd = content?.open_end;
41
+ // show only start when event starts and ends in same day or if a recurrence is set
42
+ // because to set a recurrence, the event must have the same date as start and end date
30
43
  const renderOnlyStart =
31
44
  Moment(content.end).format('DD-MM-Y') ===
32
- Moment(content.start).format('DD-MM-Y');
45
+ Moment(content.start).format('DD-MM-Y') && !content.recurrence;
33
46
  let eventRecurrenceText = null;
34
47
 
35
48
  if (content['@type'] === 'Event') {
@@ -38,10 +51,7 @@ const PageHeaderEventDates = ({ content, moment, rrule }) => {
38
51
  const isWeekdaySunday = content.recurrence
39
52
  .split('BYDAY')[1]
40
53
  ?.includes('SU');
41
- const rruleSet = rrulestr(content.recurrence, {
42
- compatible: true, //If set to True, the parser will operate in RFC-compatible mode. Right now it means that unfold will be turned on, and if a DTSTART is found, it will be considered the first recurrence instance, as documented in the RFC.
43
- forceset: true,
44
- });
54
+
45
55
  const RRULE_LANGUAGE = rrulei18n(intl, Moment);
46
56
  eventRecurrenceText = rruleSet.rrules()[0]?.toText(
47
57
  (t) => {
@@ -55,6 +65,7 @@ const PageHeaderEventDates = ({ content, moment, rrule }) => {
55
65
  RRULE_LANGUAGE.strings['on the'] = 'la';
56
66
  }
57
67
  }
68
+
58
69
  return RRULE_LANGUAGE.strings[t];
59
70
  },
60
71
  RRULE_LANGUAGE,
@@ -62,15 +73,19 @@ const PageHeaderEventDates = ({ content, moment, rrule }) => {
62
73
  );
63
74
  }
64
75
  }
76
+
77
+ // format and save date into new variable depending on recurrence of event
78
+ const endDate = Moment(actualEndDate).format('DD-MM-Y');
79
+
65
80
  return content['@type'] === 'Event' ? (
66
81
  <p className="h4 py-2">
67
- {!wholeDay &&
82
+ {!Moment(content.end).isSame(actualEndDate) &&
68
83
  !openEnd &&
69
84
  !renderOnlyStart &&
70
- `dal ${Moment(content.start).format('DD-MM-Y')} al ${Moment(
71
- content.end,
72
- ).format('DD-MM-Y')}`}
73
- {(wholeDay || renderOnlyStart) &&
85
+ `dal ${Moment(content.start).format('DD-MM-Y')} al ${endDate}`}
86
+ {(wholeDay ||
87
+ renderOnlyStart ||
88
+ Moment(content.end).isSame(actualEndDate)) &&
74
89
  !openEnd &&
75
90
  `${Moment(content.start).format('DD-MM-Y')}`}
76
91
  {openEnd &&
@@ -74,6 +74,11 @@ const Body = ({ data, isEditMode }) => {
74
74
  ref: ref,
75
75
  };
76
76
 
77
+ let apiPath = config.settings.apiPath;
78
+ if (!apiPath.endsWith('/')) {
79
+ apiPath += '/';
80
+ }
81
+
77
82
  return (
78
83
  <>
79
84
  {data.url && (
@@ -105,10 +110,7 @@ const Body = ({ data, isEditMode }) => {
105
110
  <video
106
111
  src={
107
112
  isInternalURL(
108
- data.url.replace(
109
- getParentUrl(config.settings.apiPath),
110
- '',
111
- ),
113
+ data.url.replace(getParentUrl(apiPath), ''),
112
114
  )
113
115
  ? `${data.url}${
114
116
  data.url.indexOf('@@download/file') < 0
@@ -13,12 +13,12 @@ import config from '@plone/volto/registry';
13
13
 
14
14
  const LinkView = ({ token, content }) => {
15
15
  const history = useHistory();
16
- const userIsSpidUser = useSelector(
17
- (state) => state.users.user.roles.length === 0,
16
+ const userWithoutRoles = useSelector((state) =>
17
+ state.users?.user ? state.users.user?.roles?.length === 0 : true,
18
18
  );
19
19
 
20
20
  useEffect(() => {
21
- if (!token || userIsSpidUser) {
21
+ if (!token || userWithoutRoles) {
22
22
  const { remoteUrl } = content;
23
23
  if (isInternalURL(remoteUrl)) {
24
24
  history.replace(flattenToAppURL(remoteUrl));
@@ -26,7 +26,7 @@ const LinkView = ({ token, content }) => {
26
26
  window.location.href = flattenToAppURL(remoteUrl);
27
27
  }
28
28
  }
29
- }, [content, history, token, userIsSpidUser]);
29
+ }, [content, history, token, userWithoutRoles]);
30
30
  const { title, description, remoteUrl } = content;
31
31
  const { openExternalLinkInNewTab } = config.settings;
32
32
  const Container =
@@ -11,8 +11,8 @@ export const viewDate = (locale, value, format) => {
11
11
  ? // Since we assume UTC everywhere, then transform to local (momentjs default)
12
12
  moment(value)
13
13
  : value.match(/T(.)/g)
14
- ? moment(`${value}Z`) // This might happen in old Plone versions dates
15
- : moment(value); //This when date is like '2021-05-05'
14
+ ? moment(`${value}Z`) // This might happen in old Plone versions dates
15
+ : moment(value); //This when date is like '2021-05-05'
16
16
  } else {
17
17
  datetime = moment(value);
18
18
  }
@@ -45,3 +45,11 @@ export const getRealStartAndEndWithRecurrence = (
45
45
  ),
46
46
  };
47
47
  };
48
+
49
+ export const getRealEventEnd = (content, rruleSet) => {
50
+ let actualEndDate = content.end;
51
+ if (content.recurrence) {
52
+ actualEndDate = rruleSet.rrules()[0].options.until;
53
+ }
54
+ return actualEndDate;
55
+ };
@@ -21,6 +21,7 @@ export { getItemsByPath } from 'design-comuni-plone-theme/helpers/getItemsByPath
21
21
  export {
22
22
  viewDate,
23
23
  getRealStartAndEndWithRecurrence,
24
+ getRealEventEnd,
24
25
  } from 'design-comuni-plone-theme/helpers/dates';
25
26
  export { getSiteProperty } from 'design-comuni-plone-theme/helpers/config';
26
27
  export { useDebouncedEffect } from 'design-comuni-plone-theme/helpers/debounce';