imio.smartweb.core 1.2.65__py3-none-any.whl → 1.2.67__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 (70) hide show
  1. imio/smartweb/core/browser/controlpanel.py +41 -0
  2. imio/smartweb/core/browser/faceted/block_view.pt +4 -4
  3. imio/smartweb/core/browser/faceted/summary_view.pt +4 -4
  4. imio/smartweb/core/browser/static/smartweb-view-compiled.css +1 -1
  5. imio/smartweb/core/browser/static/src/view.less +4 -0
  6. imio/smartweb/core/contents/__init__.py +2 -0
  7. imio/smartweb/core/contents/configure.zcml +1 -0
  8. imio/smartweb/core/contents/folder/block_view.pt +8 -8
  9. imio/smartweb/core/contents/folder/summary_view.pt +4 -4
  10. imio/smartweb/core/contents/publication/__init__.py +0 -0
  11. imio/smartweb/core/contents/publication/configure.zcml +5 -0
  12. imio/smartweb/core/contents/publication/content.py +23 -0
  13. imio/smartweb/core/contents/rest/directory/view.pt +2 -1
  14. imio/smartweb/core/contents/rest/events/view.pt +2 -1
  15. imio/smartweb/core/contents/rest/news/view.pt +2 -1
  16. imio/smartweb/core/contents/rest/view.py +4 -0
  17. imio/smartweb/core/contents/sections/common_templates/table.pt +13 -3
  18. imio/smartweb/core/contents/sections/external_content/view.pt +1 -1
  19. imio/smartweb/core/contents/sections/files/content.py +7 -1
  20. imio/smartweb/core/contents/sections/files/view.py +38 -11
  21. imio/smartweb/core/contents/sections/views.py +19 -6
  22. imio/smartweb/core/profiles/default/metadata.xml +1 -1
  23. imio/smartweb/core/profiles/default/types/imio.smartweb.Publication.xml +38 -0
  24. imio/smartweb/core/profiles/default/types/imio.smartweb.SectionFiles.xml +1 -0
  25. imio/smartweb/core/profiles/default/types.xml +1 -0
  26. imio/smartweb/core/subscribers.py +24 -0
  27. imio/smartweb/core/subscribers.zcml +4 -0
  28. imio/smartweb/core/tests/resources/json_iadeliberations_institutions.json +60 -0
  29. imio/smartweb/core/tests/resources/json_iadeliberations_publication.json +105 -0
  30. imio/smartweb/core/tests/resources/json_iadeliberations_publications.json +270 -0
  31. imio/smartweb/core/tests/test_iadeliberations.py +136 -0
  32. imio/smartweb/core/tests/test_vocabularies.py +54 -0
  33. imio/smartweb/core/upgrades/configure.zcml +37 -1
  34. imio/smartweb/core/upgrades/profiles/1059_to_1060/registry/iadeliberation.xml +9 -0
  35. imio/smartweb/core/upgrades/profiles/1060_to_1061/types/imio.smartweb.Publication.xml +38 -0
  36. imio/smartweb/core/upgrades/profiles/1060_to_1061/types/imio.smartweb.SectionFiles.xml +11 -0
  37. imio/smartweb/core/upgrades/profiles/1060_to_1061/types.xml +4 -0
  38. imio/smartweb/core/upgrades/profiles/1060_to_1061/workflows.xml +6 -0
  39. imio/smartweb/core/utils.py +27 -0
  40. imio/smartweb/core/vocabularies.py +44 -0
  41. imio/smartweb/core/vocabularies.zcml +12 -0
  42. imio/smartweb/core/webcomponents/build/css/smartweb-webcomponents-compiled.css +1 -1
  43. imio/smartweb/core/webcomponents/build/js/373.smartweb-webcomponents-compiled.js +1 -1
  44. imio/smartweb/core/webcomponents/build/js/486.smartweb-webcomponents-compiled.js +1 -1
  45. imio/smartweb/core/webcomponents/build/js/{324.smartweb-webcomponents-compiled.js → 828.smartweb-webcomponents-compiled.js} +2 -2
  46. imio/smartweb/core/webcomponents/build/js/884.smartweb-webcomponents-compiled.js +1 -1
  47. imio/smartweb/core/webcomponents/build/js/919.smartweb-webcomponents-compiled.js +1 -1
  48. imio/smartweb/core/webcomponents/build/js/smartweb-webcomponents-compiled.js +1 -1
  49. imio/smartweb/core/webcomponents/src/components/Annuaire/Annuaire.jsx +12 -2
  50. imio/smartweb/core/webcomponents/src/components/Annuaire/ContactCard/ContactCard.jsx +88 -60
  51. imio/smartweb/core/webcomponents/src/components/Annuaire/ContactContent/ContactContent.jsx +27 -1
  52. imio/smartweb/core/webcomponents/src/components/Annuaire/ContactList/ContactList.jsx +6 -2
  53. imio/smartweb/core/webcomponents/src/components/Events/EventCard/EventCard.jsx +69 -39
  54. imio/smartweb/core/webcomponents/src/components/Events/EventContent/EventContent.jsx +30 -3
  55. imio/smartweb/core/webcomponents/src/components/Events/EventList/EventList.jsx +10 -7
  56. imio/smartweb/core/webcomponents/src/components/Events/Events.jsx +4 -2
  57. imio/smartweb/core/webcomponents/src/components/News/News.jsx +3 -0
  58. imio/smartweb/core/webcomponents/src/components/News/NewsCard/NewsCard.jsx +60 -48
  59. imio/smartweb/core/webcomponents/src/components/News/NewsContent/NewsContent.jsx +30 -3
  60. imio/smartweb/core/webcomponents/src/components/News/NewsList/NewsList.jsx +28 -7
  61. imio/smartweb/core/webcomponents/src/index.scss +188 -174
  62. {imio.smartweb.core-1.2.65.dist-info → imio.smartweb.core-1.2.67.dist-info}/METADATA +27 -1
  63. {imio.smartweb.core-1.2.65.dist-info → imio.smartweb.core-1.2.67.dist-info}/RECORD +70 -57
  64. /imio/smartweb/core/webcomponents/build/js/{324.smartweb-webcomponents-compiled.js.LICENSE.txt → 828.smartweb-webcomponents-compiled.js.LICENSE.txt} +0 -0
  65. /imio.smartweb.core-1.2.65-py3.10-nspkg.pth → /imio.smartweb.core-1.2.67-py3.10-nspkg.pth +0 -0
  66. {imio.smartweb.core-1.2.65.dist-info → imio.smartweb.core-1.2.67.dist-info}/LICENSE.GPL +0 -0
  67. {imio.smartweb.core-1.2.65.dist-info → imio.smartweb.core-1.2.67.dist-info}/LICENSE.rst +0 -0
  68. {imio.smartweb.core-1.2.65.dist-info → imio.smartweb.core-1.2.67.dist-info}/WHEEL +0 -0
  69. {imio.smartweb.core-1.2.65.dist-info → imio.smartweb.core-1.2.67.dist-info}/namespace_packages.txt +0 -0
  70. {imio.smartweb.core-1.2.65.dist-info → imio.smartweb.core-1.2.67.dist-info}/top_level.txt +0 -0
@@ -3,7 +3,7 @@ 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, showCategoriesOrTopics }) => {
6
+ const NewsCard = ({ item, showCategoriesOrTopics, contextAuthenticatedUser }) => {
7
7
  const [limitDescription, setLimitDescription] = useState();
8
8
  const [itemTopic, setItemTopic] = useState(null);
9
9
 
@@ -13,7 +13,11 @@ const NewsCard = ({ item, showCategoriesOrTopics }) => {
13
13
 
14
14
  useEffect(() => {
15
15
  if (description.length >= numberLimit) {
16
- setLimitDescription(description.substring(0, numberLimit) + "...");
16
+ let truncatedDescription = description.substring(0, numberLimit);
17
+ if (description.endsWith("**")) {
18
+ truncatedDescription += "**";
19
+ }
20
+ setLimitDescription(truncatedDescription + "...");
17
21
  } else {
18
22
  setLimitDescription(description);
19
23
  }
@@ -27,57 +31,65 @@ const NewsCard = ({ item, showCategoriesOrTopics }) => {
27
31
  const created = moment(item.created).startOf("minute").fromNow();
28
32
  const lastModified = moment(item.modified).startOf("minute").fromNow();
29
33
  return (
30
- <div className="r-list-item">
31
- <div
32
- className={
33
- item.image_vignette_scale ? "r-item-img" : "r-item-img r-item-img-placeholder"
34
- }
35
- style={{
36
- backgroundImage: item.image_vignette_scale
37
- ? "url(" + item.image_vignette_scale + ")"
38
- : "",
39
- }}
40
- />
41
- <div className="r-item-text">
42
- <span className="r-item-title">{title}</span>
43
- {showCategoriesOrTopics === "topic" ? (
44
- itemTopic && <span className="r-item-categorie">{item.topics[0].title}</span>
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>
34
+ <>
35
+ <div className="r-list-item">
36
+ <div
37
+ className={
38
+ item.image_vignette_scale
39
+ ? "r-item-img"
40
+ : "r-item-img r-item-img-placeholder"
41
+ }
42
+ style={{
43
+ backgroundImage: item.image_vignette_scale
44
+ ? "url(" + item.image_vignette_scale + ")"
45
+ : "",
46
+ }}
47
+ />
48
+ <div className="r-item-text">
49
+ <span className="r-item-title">{title}</span>
50
+ {showCategoriesOrTopics === "topic" ? (
51
+ itemTopic && (
52
+ <span className="r-item-categorie">{item.topics[0].title}</span>
53
+ )
54
+ ) : showCategoriesOrTopics === "category" ? (
55
+ item.local_category ? (
56
+ <span className="r-item-categorie">{item.local_category.title}</span>
57
+ ) : (
58
+ item.category && (
59
+ <span className="r-item-categorie">{item.category.title}</span>
60
+ )
51
61
  )
52
- )
53
- ) : (
54
- ""
55
- )}
56
- {description ? (
57
- <ReactMarkdown className="r-item-description">{limitDescription}</ReactMarkdown>
58
- ) : (
59
- ""
60
- )}
61
- <div className="r-item-read-more" style={{ textDecoration: "none" }}>
62
- {created === lastModified ? (
63
- <div className="r-card-date-last">
64
- <span>
65
- <Translate text="Publié" />{" "}
66
- </span>
67
- <span>{created}</span>
68
- </div>
69
62
  ) : (
70
- <div className="r-card-date-last">
71
- <span>
72
- <Translate text="Actualisé" />{" "}
73
- </span>
74
- <span>{lastModified}</span>
75
- </div>
63
+ ""
64
+ )}
65
+ {description ? (
66
+ <ReactMarkdown className="r-item-description">
67
+ {limitDescription}
68
+ </ReactMarkdown>
69
+ ) : (
70
+ ""
76
71
  )}
72
+ <div className="r-item-read-more" style={{ textDecoration: "none" }}>
73
+ {created === lastModified ? (
74
+ <div className="r-card-date-last">
75
+ <span>
76
+ <Translate text="Publié" />{" "}
77
+ </span>
78
+ <span>{created}</span>
79
+ </div>
80
+ ) : (
81
+ <div className="r-card-date-last">
82
+ <span>
83
+ <Translate text="Actualisé" />{" "}
84
+ </span>
85
+ <span>{lastModified}</span>
86
+ </div>
87
+ )}
88
+ </div>
77
89
  </div>
90
+ <div className="r-item-arrow-more"></div>
78
91
  </div>
79
- <div className="r-item-arrow-more"></div>
80
- </div>
92
+ </>
81
93
  );
82
94
  };
83
95
 
@@ -10,7 +10,7 @@ import "../../../../node_modules/flexbin/flexbin.css";
10
10
  import { Translate } from "react-translated";
11
11
  import queryString from "query-string";
12
12
 
13
- const ContactContent = ({ queryUrl, onChange }) => {
13
+ const ContactContent = ({ queryUrl, onChange, contextAuthenticatedUser }) => {
14
14
  let navigate = useNavigate();
15
15
  const parsed = queryString.parse(useFilterQuery().toString());
16
16
  const parsed2 = { ...parsed, UID: parsed["u"], fullobjects: 1 };
@@ -37,8 +37,8 @@ const ContactContent = ({ queryUrl, onChange }) => {
37
37
  window.scrollTo({
38
38
  top: 0,
39
39
  left: 0,
40
- behavior: 'instant'
41
- });
40
+ behavior: "instant",
41
+ });
42
42
  }, [response]);
43
43
 
44
44
  /// use to set file and gallery items
@@ -61,6 +61,33 @@ const ContactContent = ({ queryUrl, onChange }) => {
61
61
  <button type="button" onClick={handleClick}>
62
62
  <Translate text="Retour" />
63
63
  </button>
64
+
65
+ {contextAuthenticatedUser === "False" ? (
66
+ <a
67
+ href={item["@id"]}
68
+ target="_blank"
69
+ title="Editer la fiche"
70
+ className="edit-rest-elements edit-rest-elements-content"
71
+ >
72
+ <svg
73
+ xmlns="http://www.w3.org/2000/svg"
74
+ width="16"
75
+ height="16"
76
+ fill="currentColor"
77
+ class="bi bi-pencil-square"
78
+ viewBox="0 0 16 16"
79
+ >
80
+ <path d="M15.502 1.94a.5.5 0 0 1 0 .706L14.459 3.69l-2-2L13.502.646a.5.5 0 0 1 .707 0l1.293 1.293zm-1.75 2.456-2-2L4.939 9.21a.5.5 0 0 0-.121.196l-.805 2.414a.25.25 0 0 0 .316.316l2.414-.805a.5.5 0 0 0 .196-.12l6.813-6.814z" />
81
+ <path
82
+ fill-rule="evenodd"
83
+ d="M1 13.5A1.5 1.5 0 0 0 2.5 15h11a1.5 1.5 0 0 0 1.5-1.5v-6a.5.5 0 0 0-1 0v6a.5.5 0 0 1-.5.5h-11a.5.5 0 0 1-.5-.5v-11a.5.5 0 0 1 .5-.5H9a.5.5 0 0 0 0-1H2.5A1.5 1.5 0 0 0 1 2.5z"
84
+ />
85
+ </svg>
86
+ </a>
87
+ ) : (
88
+ ""
89
+ )}
90
+
64
91
  <article>
65
92
  <header>
66
93
  <h2 className="r-content-title">{item.title}</h2>
@@ -3,27 +3,47 @@ import NewsCard from "../NewsCard/NewsCard";
3
3
  import { Link } from "react-router-dom";
4
4
  import removeAccents from "remove-accents";
5
5
  import { ScrollContext } from "../../../hooks/ScrollContext";
6
- const NewsList = ({ itemsArray, onChange, showCategoriesOrTopics }) => {
7
-
6
+ const NewsList = ({ itemsArray, onChange, showCategoriesOrTopics, contextAuthenticatedUser }) => {
8
7
  const { scrollPos, updateScrollPos } = useContext(ScrollContext);
9
8
 
10
-
11
9
  function handleClick(event) {
12
10
  onChange(event);
13
11
  updateScrollPos(window.scrollY);
14
12
  }
15
13
 
16
14
  useEffect(() => {
17
- window.scrollTo(
18
- { top: scrollPos,
19
- left: 0,
20
- behavior: 'instant'});
15
+ window.scrollTo({ top: scrollPos, left: 0, behavior: "instant" });
21
16
  }, [itemsArray]);
22
17
  return (
23
18
  <React.Fragment>
24
19
  <ul className="r-result-list actu-result-list">
25
20
  {itemsArray.map((item, i) => (
26
21
  <li key={i} className="r-list-item-group" onClick={() => handleClick(item.UID)}>
22
+ {contextAuthenticatedUser === "False" ? (
23
+ <a
24
+ href={item["@id"]}
25
+ target="_blank"
26
+ title="Editer la fiche"
27
+ className="edit-rest-elements edit-rest-elements-news"
28
+ >
29
+ <svg
30
+ xmlns="http://www.w3.org/2000/svg"
31
+ width="16"
32
+ height="16"
33
+ fill="currentColor"
34
+ class="bi bi-pencil-square"
35
+ viewBox="0 0 16 16"
36
+ >
37
+ <path d="M15.502 1.94a.5.5 0 0 1 0 .706L14.459 3.69l-2-2L13.502.646a.5.5 0 0 1 .707 0l1.293 1.293zm-1.75 2.456-2-2L4.939 9.21a.5.5 0 0 0-.121.196l-.805 2.414a.25.25 0 0 0 .316.316l2.414-.805a.5.5 0 0 0 .196-.12l6.813-6.814z" />
38
+ <path
39
+ fill-rule="evenodd"
40
+ d="M1 13.5A1.5 1.5 0 0 0 2.5 15h11a1.5 1.5 0 0 0 1.5-1.5v-6a.5.5 0 0 0-1 0v6a.5.5 0 0 1-.5.5h-11a.5.5 0 0 1-.5-.5v-11a.5.5 0 0 1 .5-.5H9a.5.5 0 0 0 0-1H2.5A1.5 1.5 0 0 0 1 2.5z"
41
+ />
42
+ </svg>
43
+ </a>
44
+ ) : (
45
+ ""
46
+ )}
27
47
  <Link
28
48
  className="r-news-list-item-link"
29
49
  style={{ textDecoration: "none" }}
@@ -44,6 +64,7 @@ const NewsList = ({ itemsArray, onChange, showCategoriesOrTopics }) => {
44
64
  item={item}
45
65
  showCategoriesOrTopics={showCategoriesOrTopics}
46
66
  key={item.created}
67
+ contextAuthenticatedUser={contextAuthenticatedUser}
47
68
  />
48
69
  </Link>
49
70
  </li>