imio.smartweb.core 1.2.43__py3-none-any.whl → 1.2.45__py3-none-any.whl

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.
Files changed (75) hide show
  1. imio/smartweb/core/behaviors/categorization.py +24 -0
  2. imio/smartweb/core/behaviors/configure.zcml +7 -0
  3. imio/smartweb/core/browser/static/smartweb-edit-compiled.css +1 -1
  4. imio/smartweb/core/browser/static/src/edit.less +42 -0
  5. imio/smartweb/core/contents/pages/cirkwi/content.py +5 -0
  6. imio/smartweb/core/contents/pages/cirkwi/view.py +2 -1
  7. imio/smartweb/core/contents/rest/events/endpoint.py +1 -0
  8. imio/smartweb/core/contents/rest/events/view.pt +2 -1
  9. imio/smartweb/core/contents/rest/events/view.py +4 -0
  10. imio/smartweb/core/contents/rest/news/endpoint.py +1 -0
  11. imio/smartweb/core/contents/rest/news/view.pt +2 -1
  12. imio/smartweb/core/contents/rest/news/view.py +4 -0
  13. imio/smartweb/core/contents/sections/configure.zcml +1 -1
  14. imio/smartweb/core/contents/sections/events/view.py +11 -1
  15. imio/smartweb/core/contents/sections/macros.pt +3 -2
  16. imio/smartweb/core/contents/sections/news/view.py +11 -1
  17. imio/smartweb/core/contents/sections/views.py +8 -7
  18. imio/smartweb/core/profiles/default/metadata.xml +1 -1
  19. imio/smartweb/core/profiles/default/types/imio.smartweb.EventsView.xml +1 -0
  20. imio/smartweb/core/profiles/default/types/imio.smartweb.NewsView.xml +1 -0
  21. imio/smartweb/core/profiles/default/types/imio.smartweb.SectionEvents.xml +1 -0
  22. imio/smartweb/core/profiles/default/types/imio.smartweb.SectionNews.xml +1 -0
  23. imio/smartweb/core/tests/resources/json_rest_events.json +2 -1
  24. imio/smartweb/core/tests/resources/json_rest_news.json +2 -2
  25. imio/smartweb/core/tests/resources/json_rest_specific_events.json +1 -1
  26. imio/smartweb/core/tests/test_htmx_in_sections.py +10 -3
  27. imio/smartweb/core/tests/test_rest.py +36 -0
  28. imio/smartweb/core/tests/test_section_events.py +27 -5
  29. imio/smartweb/core/tests/test_section_news.py +16 -3
  30. imio/smartweb/core/tests/test_vocabularies.py +3 -0
  31. imio/smartweb/core/upgrades/configure.zcml +18 -0
  32. imio/smartweb/core/upgrades/profiles/1056_to_1057/types/imio.smartweb.EventsView.xml +11 -0
  33. imio/smartweb/core/upgrades/profiles/1056_to_1057/types/imio.smartweb.NewsView.xml +11 -0
  34. imio/smartweb/core/upgrades/profiles/1056_to_1057/types/imio.smartweb.SectionEvents.xml +11 -0
  35. imio/smartweb/core/upgrades/profiles/1056_to_1057/types/imio.smartweb.SectionNews.xml +11 -0
  36. imio/smartweb/core/utils.py +0 -23
  37. imio/smartweb/core/vocabularies.py +17 -0
  38. imio/smartweb/core/vocabularies.zcml +6 -0
  39. imio/smartweb/core/webcomponents/build/css/373.smartweb-webcomponents-compiled.css +1 -1
  40. imio/smartweb/core/webcomponents/build/js/218.smartweb-webcomponents-compiled.js +1 -1
  41. imio/smartweb/core/webcomponents/build/js/218.smartweb-webcomponents-compiled.js.LICENSE.txt +1 -1
  42. imio/smartweb/core/webcomponents/build/js/373.smartweb-webcomponents-compiled.js +2 -1
  43. imio/smartweb/core/webcomponents/build/js/{568.smartweb-webcomponents-compiled.js.LICENSE.txt → 373.smartweb-webcomponents-compiled.js.LICENSE.txt} +0 -4
  44. imio/smartweb/core/webcomponents/build/js/486.smartweb-webcomponents-compiled.js +1 -1
  45. imio/smartweb/core/webcomponents/build/js/499.smartweb-webcomponents-compiled.js +2 -0
  46. imio/smartweb/core/webcomponents/build/js/686.smartweb-webcomponents-compiled.js +1 -1
  47. imio/smartweb/core/webcomponents/build/js/736.smartweb-webcomponents-compiled.js +1 -1
  48. imio/smartweb/core/webcomponents/build/js/736.smartweb-webcomponents-compiled.js.LICENSE.txt +3 -3
  49. imio/smartweb/core/webcomponents/build/js/919.smartweb-webcomponents-compiled.js +1 -1
  50. imio/smartweb/core/webcomponents/build/js/{568.smartweb-webcomponents-compiled.js → 963.smartweb-webcomponents-compiled.js} +2 -2
  51. imio/smartweb/core/webcomponents/build/js/963.smartweb-webcomponents-compiled.js.LICENSE.txt +3 -0
  52. imio/smartweb/core/webcomponents/build/js/smartweb-webcomponents-compiled.js +1 -1
  53. imio/smartweb/core/webcomponents/package.json +1 -0
  54. imio/smartweb/core/webcomponents/src/components/Annuaire/ContactContent/ContactContent.jsx +265 -161
  55. imio/smartweb/core/webcomponents/src/components/Events/EventCard/EventCard.jsx +34 -21
  56. imio/smartweb/core/webcomponents/src/components/Events/EventList/EventList.jsx +2 -2
  57. imio/smartweb/core/webcomponents/src/components/Events/Events.jsx +2 -1
  58. imio/smartweb/core/webcomponents/src/components/News/News.jsx +2 -1
  59. imio/smartweb/core/webcomponents/src/components/News/News.scss +8 -1
  60. imio/smartweb/core/webcomponents/src/components/News/NewsCard/NewsCard.jsx +22 -5
  61. imio/smartweb/core/webcomponents/src/components/News/NewsList/NewsList.jsx +2 -2
  62. imio/smartweb/core/webcomponents/src/utils/Map.jsx +1 -3
  63. imio/smartweb/core/webcomponents/src/utils/translation.js +49 -1
  64. {imio.smartweb.core-1.2.43.dist-info → imio.smartweb.core-1.2.45.dist-info}/METADATA +27 -1
  65. {imio.smartweb.core-1.2.43.dist-info → imio.smartweb.core-1.2.45.dist-info}/RECORD +72 -68
  66. imio/smartweb/core/webcomponents/build/assets/next-react-white.819cb069ac8eec300a9db6a7707712d6.svg +0 -1
  67. imio/smartweb/core/webcomponents/build/f79b479fdc5c0fe0d553.svg +0 -1
  68. imio/smartweb/core/webcomponents/build/js/496.smartweb-webcomponents-compiled.js +0 -2
  69. /imio/smartweb/core/webcomponents/build/js/{496.smartweb-webcomponents-compiled.js.LICENSE.txt → 499.smartweb-webcomponents-compiled.js.LICENSE.txt} +0 -0
  70. /imio.smartweb.core-1.2.43-py3.10-nspkg.pth → /imio.smartweb.core-1.2.45-py3.10-nspkg.pth +0 -0
  71. {imio.smartweb.core-1.2.43.dist-info → imio.smartweb.core-1.2.45.dist-info}/LICENSE.GPL +0 -0
  72. {imio.smartweb.core-1.2.43.dist-info → imio.smartweb.core-1.2.45.dist-info}/LICENSE.rst +0 -0
  73. {imio.smartweb.core-1.2.43.dist-info → imio.smartweb.core-1.2.45.dist-info}/WHEEL +0 -0
  74. {imio.smartweb.core-1.2.43.dist-info → imio.smartweb.core-1.2.45.dist-info}/namespace_packages.txt +0 -0
  75. {imio.smartweb.core-1.2.43.dist-info → imio.smartweb.core-1.2.45.dist-info}/top_level.txt +0 -0
@@ -1,25 +1,18 @@
1
1
  import React from "react";
2
2
  import moment from "moment";
3
- import Moment from "react-moment";
4
- const ContactCard = ({ item }) => {
5
- const title = item.title && item.title;
6
- const category =
7
- item.taxonomy_contact_category && item.taxonomy_contact_category[0];
8
- const start = moment(item.start && item.start);
3
+ import { Translate } from "react-translated";
9
4
 
10
- const number = item.number ? item.number : "";
11
- const street = item.street ? item.street : "";
12
- const complement = item.complement ? item.complement : "";
13
- const zipcode = item.zipcode ? item.zipcode : "";
14
- const city = item.city ? item.city : "";
15
- const country = item.country ? item.country : "";
16
- const phones = item.phones ? item.phones : "";
17
- const mails = item.mails ? item.mails : "";
18
- const topics = item.topics ? item.topics : "";
5
+ const ContactCard = ({ item, showCategoriesOrTopics }) => {
6
+ moment.locale("be");
7
+ const title = item.title && item.title;
8
+ const start = moment.utc(item.start).format("DD-MM-YYYY");
9
+ const end = moment.utc(item.end).format("DD-MM-YYYY");
19
10
  return (
20
11
  <div className="r-list-item">
21
12
  <div
22
- className={item.image_vignette_scale ? "r-item-img" : "r-item-img r-item-img-placeholder"}
13
+ className={
14
+ item.image_vignette_scale ? "r-item-img" : "r-item-img r-item-img-placeholder"
15
+ }
23
16
  style={{
24
17
  backgroundImage: item.image_vignette_scale
25
18
  ? "url(" + item.image_vignette_scale + ")"
@@ -28,16 +21,36 @@ const ContactCard = ({ item }) => {
28
21
  />
29
22
 
30
23
  <div className="r-item-text">
31
- {start &&
24
+ {start && (
32
25
  <span className="r-item-date">
33
- <Moment format="DD-MM-YYYY">{start}</Moment>
26
+ {start === end ? (
27
+ start
28
+ ) : (
29
+ <>
30
+ {start} <Translate text="au" /> {end}
31
+ </>
32
+ )}
34
33
  </span>
35
- }
34
+ )}
36
35
  <span className="r-item-title">{title}</span>
37
- {item.category && <span className="r-item-categorie">{item.category.title}</span>}
36
+ {showCategoriesOrTopics === "topic" ? (
37
+ item.topics[0] && (
38
+ <span className="r-item-categorie">{item.topics[0].title}</span>
39
+ )
40
+ ) : showCategoriesOrTopics === "category" ? (
41
+ item.local_category ? (
42
+ <span className="r-item-categorie">{item.local_category.title}</span>
43
+ ) : (
44
+ item.category && (
45
+ <span className="r-item-categorie">{item.category.title}</span>
46
+ )
47
+ )
48
+ ) : (
49
+ ""
50
+ )}
38
51
  </div>
39
52
  </div>
40
53
  );
41
54
  };
42
55
 
43
- export default ContactCard;
56
+ export default ContactCard;
@@ -2,7 +2,7 @@ import EventCard from "../EventCard/EventCard";
2
2
  import { Link } from "react-router-dom";
3
3
  import React from "react";
4
4
  import removeAccents from "remove-accents";
5
- const ContactList = ({ itemsArray, onChange, onHover, parentCallback }) => {
5
+ const ContactList = ({ itemsArray, onChange, onHover,showCategoriesOrTopics }) => {
6
6
  function handleClick(event) {
7
7
  onChange(event);
8
8
  }
@@ -32,7 +32,7 @@ const ContactList = ({ itemsArray, onChange, onHover, parentCallback }) => {
32
32
  },
33
33
  }}
34
34
  ></Link>
35
- <EventCard item={item} key={item.created} />
35
+ <EventCard item={item} showCategoriesOrTopics={showCategoriesOrTopics} key={item.created} />
36
36
  </li>
37
37
  ))}
38
38
  </ul>
@@ -29,6 +29,7 @@ export default function Events(props) {
29
29
  displayMap={props.displayMap}
30
30
  onlyPastEvents={props.onlyPastEvents}
31
31
  language={props.currentLanguage}
32
+ showCategoriesOrTopics={props.showCategoriesOrTopics}
32
33
  />
33
34
  </Provider>
34
35
  </BrowserRouter>
@@ -125,7 +126,7 @@ function EventsView(props) {
125
126
  let MapRender;
126
127
  if (itemsArray && itemsArray.length > 0) {
127
128
  listRender = (
128
- <EventList onChange={clickID} itemsArray={itemsArray} onHover={hoverID} />
129
+ <EventList onChange={clickID} itemsArray={itemsArray} onHover={hoverID} showCategoriesOrTopics={props.showCategoriesOrTopics} />
129
130
  );
130
131
  MapRender = (
131
132
  <Map
@@ -25,6 +25,7 @@ export default function News(props) {
25
25
  queryUrl={props.queryUrl}
26
26
  proposeUrl={props.proposeUrl}
27
27
  batchSize={props.batchSize}
28
+ showCategoriesOrTopics={props.showCategoriesOrTopics}
28
29
  />
29
30
  </Provider>
30
31
  </BrowserRouter>
@@ -97,7 +98,7 @@ const NewsView = (props) => {
97
98
  // coditional list render
98
99
  let listRender;
99
100
  if (itemsArray && itemsArray.length > 0) {
100
- listRender = <NewsList onChange={clickID} itemsArray={itemsArray} />;
101
+ listRender = <NewsList onChange={clickID} itemsArray={itemsArray} showCategoriesOrTopics={props.showCategoriesOrTopics} />;
101
102
  } else if (!isLoading) {
102
103
  listRender = <p><Translate text="Aucune actualité n'a été trouvée" /></p>;
103
104
  }
@@ -186,4 +186,11 @@
186
186
  }
187
187
  }
188
188
  }
189
- }
189
+ }
190
+
191
+ .r-item-categorie {
192
+ margin-top: 5px;
193
+ text-transform: uppercase;
194
+ color: #747474;
195
+ font-weight: 400;
196
+ }
@@ -3,20 +3,25 @@ import moment from "moment";
3
3
  import ReactMarkdown from 'react-markdown';
4
4
  import { Translate } from "react-translated";
5
5
  import { LanguageContext } from '../News.jsx';
6
- const NewsCard = ({ item }) => {
6
+ const NewsCard = ({ item,showCategoriesOrTopics }) => {
7
7
  const [limitDescription, setLimitDescription] = useState();
8
+ const [itemTopic, setItemTopic] = useState(null);
9
+
8
10
  const numberLimit = 150;
9
11
  const title = item.title && item.title;
10
12
  const description = item.description && item.description;
11
- const category = item.taxonomy_contact_category
12
- ? item.taxonomy_contact_category[0].title
13
- : "";
13
+
14
14
  useEffect(() => {
15
15
  if (description.length >= numberLimit) {
16
16
  setLimitDescription(description.substring(0, numberLimit) + "...");
17
17
  } else {
18
18
  setLimitDescription(description);
19
19
  }
20
+ if (item.topics && item.topics.length > 1) {
21
+ setItemTopic(item.topics[0].title);
22
+ } else {
23
+ setItemTopic(null)
24
+ }
20
25
  }, [item]);
21
26
  moment.locale(useContext(LanguageContext))
22
27
  const created = moment(item.created).startOf('minute').fromNow();
@@ -32,8 +37,20 @@ const NewsCard = ({ item }) => {
32
37
  }}
33
38
  />
34
39
  <div className="r-item-text">
35
- {category ? <span className="r-item-categorie">{category}</span> : ""}
36
40
  <span className="r-item-title">{title}</span>
41
+ {showCategoriesOrTopics === "topic" ? (
42
+ itemTopic && (
43
+ <span className="r-item-categorie">{item.topics[0].title}</span>
44
+ )
45
+ ) : showCategoriesOrTopics === "category" ? (
46
+ item.local_category ? (
47
+ <span className="r-item-categorie">{item.local_category.title}</span>
48
+ ) : (
49
+ item.category && (
50
+ <span className="r-item-categorie">{item.category.title}</span>
51
+ )
52
+ )
53
+ ) : ""}
37
54
  {description ?
38
55
  <ReactMarkdown className="r-item-description">{limitDescription}</ReactMarkdown>
39
56
  : ""
@@ -2,7 +2,7 @@ import NewsCard from "../NewsCard/NewsCard";
2
2
  import { Link } from "react-router-dom";
3
3
  import React from "react";
4
4
  import removeAccents from "remove-accents";
5
- const NewsList = ({ itemsArray, onChange, parentCallback }) => {
5
+ const NewsList = ({ itemsArray, onChange, showCategoriesOrTopics }) => {
6
6
  function handleClick(event) {
7
7
  onChange(event);
8
8
  }
@@ -26,7 +26,7 @@ const NewsList = ({ itemsArray, onChange, parentCallback }) => {
26
26
  },
27
27
  }}
28
28
  >
29
- <NewsCard item={item} key={item.created} />
29
+ <NewsCard item={item} showCategoriesOrTopics={showCategoriesOrTopics} key={item.created} />
30
30
  </Link>
31
31
  </li>
32
32
  ))}
@@ -107,9 +107,7 @@ function Map(props) {
107
107
  className="r-map-popup"
108
108
  style={{ textDecoration: "none" }}
109
109
  to={{
110
- pathname: removeAccents(
111
- mark.title.replace(/\s/g, "-").toLowerCase()
112
- ),
110
+ pathname: "/" + removeAccents(mark.title).replace(/[^a-zA-Z ]/g, "").replace(/\s/g, "-").toLowerCase(),
113
111
  search: `?u=${mark.UID}`,
114
112
  state: {
115
113
  idItem: mark.UID,
@@ -252,10 +252,58 @@ export default {
252
252
  de: "Benutzerdefiniert (Von ... bis ...)",
253
253
  nl: "Aangepast (Van ... tot ...)",
254
254
  },
255
+ "au": {
256
+ en: "to",
257
+ fr: "au",
258
+ de: "bis",
259
+ nl: "tot",
260
+ },
255
261
  "Personnalisé": {
256
262
  en: "Custom",
257
263
  fr: "Personnalisé",
258
264
  de: "Benutzerdefiniert",
259
265
  nl: "Aangepast",
260
- }
266
+ },
267
+ "Monday": {
268
+ en: "Monday",
269
+ fr: "Lundi",
270
+ de: "Montag",
271
+ nl: "Maandag",
272
+ },
273
+ "Tuesday": {
274
+ en: "Tuesday",
275
+ fr: "Mardi",
276
+ de: "Dienstag",
277
+ nl: "Dinsdag",
278
+ },
279
+ "Wednesday": {
280
+ en: "Wednesday",
281
+ fr: "Mercredi",
282
+ de: "Mittwoch",
283
+ nl: "Woensdag",
284
+ },
285
+ "Thursday": {
286
+ en: "Thursday",
287
+ fr: "Jeudi",
288
+ de: "Donnerstag",
289
+ nl: "Donderdag",
290
+ },
291
+ "Friday": {
292
+ en: "Friday",
293
+ fr: "Vendredi",
294
+ de: "Freitag",
295
+ nl: "Vrijdag",
296
+ },
297
+ "Saturday": {
298
+ en: "Saturday",
299
+ fr: "Samedi",
300
+ de: "Samstag",
301
+ nl: "Zaterdag",
302
+ },
303
+ "Sunday": {
304
+ en: "Sunday",
305
+ fr: "Dimanche",
306
+ de: "Sonntag",
307
+ nl: "Zondag",
308
+ },
261
309
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: imio.smartweb.core
3
- Version: 1.2.43
3
+ Version: 1.2.45
4
4
  Summary: Core product for iMio websites
5
5
  Home-page: https://github.com/imio/imio.smartweb.core
6
6
  Author: Christophe Boulanger
@@ -189,6 +189,32 @@ Changelog
189
189
  =========
190
190
 
191
191
 
192
+ 1.2.45 (2024-05-06)
193
+ -------------------
194
+
195
+ - WEB-4101 : Allow to choose to display topic or category on event & news.
196
+ This affects all related content types: SectionNews, SectionEvents, NewsView, EventsView.
197
+ Local category is alway taken before category (1 value).
198
+ Topic is always the first in list (1 value).
199
+ [laulaz, thomlamb]
200
+
201
+ - Add end date on event cards
202
+ [thomlamb]
203
+
204
+ - Add tradcution for directory timetable
205
+ [thomlamb]
206
+
207
+ - SUP-36869 : Fix root ulr on Leaflet Marker.
208
+ [thomlamb]
209
+
210
+
211
+ 1.2.44 (2024-04-18)
212
+ -------------------
213
+
214
+ - WEB-4099 : Fix select name
215
+ [boulch]
216
+
217
+
192
218
  1.2.43 (2024-04-18)
193
219
  -------------------
194
220