imio.smartweb.core 1.2.90__py3-none-any.whl → 1.3__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.
- imio/smartweb/core/browser/controlpanel.py +42 -5
- imio/smartweb/core/browser/utils.py +4 -1
- imio/smartweb/core/configure.zcml +5 -1
- imio/smartweb/core/contents/__init__.py +2 -0
- imio/smartweb/core/contents/rest/campaign/__init__.py +0 -0
- imio/smartweb/core/contents/rest/campaign/configure.zcml +80 -0
- imio/smartweb/core/contents/rest/campaign/content.py +83 -0
- imio/smartweb/core/contents/rest/campaign/endpoint.py +211 -0
- imio/smartweb/core/contents/rest/campaign/view.pt +19 -0
- imio/smartweb/core/contents/rest/campaign/view.py +29 -0
- imio/smartweb/core/contents/rest/configure.zcml +1 -0
- imio/smartweb/core/interfaces.py +4 -0
- imio/smartweb/core/overrides.zcml +10 -0
- imio/smartweb/core/profiles/default/metadata.xml +1 -1
- imio/smartweb/core/profiles/ideabox/browserlayer.xml +7 -0
- imio/smartweb/core/profiles/ideabox/metadata.xml +5 -0
- imio/smartweb/core/profiles/ideabox/registry/iaideabox.xml +9 -0
- imio/smartweb/core/profiles/ideabox/types/imio.smartweb.CampaignView.xml +40 -0
- imio/smartweb/core/profiles/ideabox/types/imio.smartweb.Folder.xml +71 -0
- imio/smartweb/core/profiles/ideabox/types.xml +17 -0
- imio/smartweb/core/profiles/ideabox_uninstall/browserlayer.xml +7 -0
- imio/smartweb/core/profiles/ideabox_uninstall/types/imio.smartweb.Folder.xml +25 -0
- imio/smartweb/core/profiles/ideabox_uninstall/types.xml +4 -0
- imio/smartweb/core/profiles/testing/metadata.xml +1 -0
- imio/smartweb/core/profiles/testing/registry.xml +2 -2
- imio/smartweb/core/profiles.zcml +18 -0
- imio/smartweb/core/subscribers.py +27 -1
- imio/smartweb/core/subscribers.zcml +8 -0
- imio/smartweb/core/tests/resources/json_ideabox_campaign.json +222 -0
- imio/smartweb/core/tests/resources/json_ideabox_campaigns.json +425 -0
- imio/smartweb/core/tests/resources/json_ideabox_projects.json +1871 -0
- imio/smartweb/core/tests/test_iadeliberations.py +38 -40
- imio/smartweb/core/tests/test_ideabox.py +120 -0
- imio/smartweb/core/tests/test_procedure.py +7 -3
- imio/smartweb/core/tests/test_rest.py +7 -0
- imio/smartweb/core/tests/test_vocabularies.py +8 -10
- imio/smartweb/core/upgrades/configure.zcml +16 -1
- imio/smartweb/core/upgrades/upgrades.py +64 -0
- imio/smartweb/core/utils.py +33 -0
- imio/smartweb/core/viewlets/actions.py +10 -0
- imio/smartweb/core/viewlets/header_actions.pt +2 -0
- imio/smartweb/core/viewlets/offcanvas.pt +31 -6
- imio/smartweb/core/viewlets/ogptags.py +9 -0
- imio/smartweb/core/viewlets/subsite_logo.pt +1 -1
- imio/smartweb/core/vocabularies.py +35 -4
- imio/smartweb/core/vocabularies.zcml +6 -0
- imio/smartweb/core/webcomponents/build/css/373.smartweb-webcomponents-compiled.css +1 -1
- imio/smartweb/core/webcomponents/build/css/420.smartweb-webcomponents-compiled.css +1 -0
- imio/smartweb/core/webcomponents/build/css/486.smartweb-webcomponents-compiled.css +1 -1
- imio/smartweb/core/webcomponents/build/css/666.smartweb-webcomponents-compiled.css +1 -0
- imio/smartweb/core/webcomponents/build/css/884.smartweb-webcomponents-compiled.css +1 -1
- imio/smartweb/core/webcomponents/build/css/smartweb-webcomponents-compiled.css +1 -1
- imio/smartweb/core/webcomponents/build/js/141.smartweb-webcomponents-compiled.js +2 -0
- imio/smartweb/core/webcomponents/build/js/{828.smartweb-webcomponents-compiled.js.LICENSE.txt → 141.smartweb-webcomponents-compiled.js.LICENSE.txt} +3 -3
- imio/smartweb/core/webcomponents/build/js/15.smartweb-webcomponents-compiled.js +2 -0
- imio/smartweb/core/webcomponents/build/js/21.smartweb-webcomponents-compiled.js +1 -0
- imio/smartweb/core/webcomponents/build/js/218.smartweb-webcomponents-compiled.js +1 -1
- imio/smartweb/core/webcomponents/build/js/218.smartweb-webcomponents-compiled.js.LICENSE.txt +0 -5
- imio/smartweb/core/webcomponents/build/js/373.smartweb-webcomponents-compiled.js +1 -1
- imio/smartweb/core/webcomponents/build/js/486.smartweb-webcomponents-compiled.js +1 -1
- imio/smartweb/core/webcomponents/build/js/666.smartweb-webcomponents-compiled.js +1 -0
- imio/smartweb/core/webcomponents/build/js/799.smartweb-webcomponents-compiled.js +1 -1
- imio/smartweb/core/webcomponents/build/js/824.smartweb-webcomponents-compiled.js +1 -1
- imio/smartweb/core/webcomponents/build/js/884.smartweb-webcomponents-compiled.js +1 -1
- imio/smartweb/core/webcomponents/build/js/919.smartweb-webcomponents-compiled.js +1 -1
- imio/smartweb/core/webcomponents/build/js/922.smartweb-webcomponents-compiled.js +1 -0
- imio/smartweb/core/webcomponents/build/js/smartweb-webcomponents-compiled.js +1 -1
- imio/smartweb/core/webcomponents/package.json +80 -80
- imio/smartweb/core/webcomponents/src/components/Annuaire/Annuaire.scss +1 -0
- imio/smartweb/core/webcomponents/src/components/Campaign/Campaign.jsx +306 -0
- imio/smartweb/core/webcomponents/src/components/Campaign/Campaign.scss +672 -0
- imio/smartweb/core/webcomponents/src/components/Campaign/CampaignCard/CampaignCard.jsx +79 -0
- imio/smartweb/core/webcomponents/src/components/Campaign/CampaignContent/CampaignContent.jsx +193 -0
- imio/smartweb/core/webcomponents/src/components/Campaign/CampaignList/CampaignList.jsx +67 -0
- imio/smartweb/core/webcomponents/src/components/Campaign/Filters/Filter.jsx +259 -0
- imio/smartweb/core/webcomponents/src/components/Campaign/index.js +2 -0
- imio/smartweb/core/webcomponents/src/components/Filters/MainFilter.scss +1 -0
- imio/smartweb/core/webcomponents/src/components/News/NewsContent/NewsContent.jsx +0 -1
- imio/smartweb/core/webcomponents/src/hooks/useAxios.js +45 -9
- imio/smartweb/core/webcomponents/src/index.jsx +2 -0
- imio/smartweb/core/webcomponents/src/index.scss +2 -2
- imio/smartweb/core/webcomponents/src/utils/CampaignMap.jsx +177 -0
- imio/smartweb/core/webcomponents/src/utils/Map.jsx +1 -1
- imio/smartweb/core/webcomponents/src/utils/Map.scss +15 -1
- imio/smartweb/core/webcomponents/src/utils/translation.js +235 -199
- {imio.smartweb.core-1.2.90.dist-info → imio.smartweb.core-1.3.dist-info}/METADATA +18 -1
- {imio.smartweb.core-1.2.90.dist-info → imio.smartweb.core-1.3.dist-info}/RECORD +94 -61
- imio/smartweb/core/webcomponents/build/js/499.smartweb-webcomponents-compiled.js +0 -2
- imio/smartweb/core/webcomponents/build/js/828.smartweb-webcomponents-compiled.js +0 -2
- /imio/smartweb/core/webcomponents/build/js/{499.smartweb-webcomponents-compiled.js.LICENSE.txt → 15.smartweb-webcomponents-compiled.js.LICENSE.txt} +0 -0
- /imio.smartweb.core-1.2.90-py3.12-nspkg.pth → /imio.smartweb.core-1.3-py3.12-nspkg.pth +0 -0
- {imio.smartweb.core-1.2.90.dist-info → imio.smartweb.core-1.3.dist-info}/LICENSE.GPL +0 -0
- {imio.smartweb.core-1.2.90.dist-info → imio.smartweb.core-1.3.dist-info}/LICENSE.rst +0 -0
- {imio.smartweb.core-1.2.90.dist-info → imio.smartweb.core-1.3.dist-info}/WHEEL +0 -0
- {imio.smartweb.core-1.2.90.dist-info → imio.smartweb.core-1.3.dist-info}/namespace_packages.txt +0 -0
- {imio.smartweb.core-1.2.90.dist-info → imio.smartweb.core-1.3.dist-info}/top_level.txt +0 -0
@@ -16,25 +16,61 @@ const useAxios = (params) => {
|
|
16
16
|
} else {
|
17
17
|
setIsMore(false);
|
18
18
|
}
|
19
|
-
|
19
|
+
|
20
|
+
if (Object.keys(params.params).length === 0) {
|
20
21
|
setResponse(null);
|
21
22
|
return;
|
22
|
-
}
|
23
|
-
|
23
|
+
}
|
24
|
+
|
25
|
+
try {
|
26
|
+
// Handle multiple URLs with identifiers
|
27
|
+
if (Array.isArray(params.url)) {
|
28
|
+
const requests = params.url.map((urlConfig, index) => {
|
29
|
+
const { url, identifier } =
|
30
|
+
typeof urlConfig === "string"
|
31
|
+
? { url: urlConfig, identifier: `request_${index}` }
|
32
|
+
: urlConfig;
|
33
|
+
|
34
|
+
return axios
|
35
|
+
.request({
|
36
|
+
...params,
|
37
|
+
url,
|
38
|
+
signal: controller.signal,
|
39
|
+
})
|
40
|
+
.then((res) => ({
|
41
|
+
identifier,
|
42
|
+
data: res.data,
|
43
|
+
}));
|
44
|
+
});
|
45
|
+
|
46
|
+
const responses = await Promise.all(requests);
|
47
|
+
// Convert array to object with identifiers as keys
|
48
|
+
const responseObject = responses.reduce((acc, { identifier, data }) => {
|
49
|
+
acc[identifier] = data;
|
50
|
+
return acc;
|
51
|
+
}, {});
|
52
|
+
|
53
|
+
setResponse(responseObject);
|
54
|
+
}
|
55
|
+
// Handle single URL
|
56
|
+
else {
|
24
57
|
const res = await axios.request(params);
|
25
58
|
setResponse(res.data);
|
26
|
-
setIsLoading(false);
|
27
|
-
setError(null);
|
28
|
-
} catch (err) {
|
29
|
-
setError(err);
|
30
59
|
}
|
60
|
+
setIsLoading(false);
|
61
|
+
setError(null);
|
62
|
+
} catch (err) {
|
63
|
+
setError(err);
|
64
|
+
setIsLoading(false);
|
31
65
|
}
|
32
66
|
};
|
67
|
+
|
33
68
|
useEffect(() => {
|
34
69
|
fetchData({ ...params, signal: controller.signal });
|
35
|
-
return () => controller.abort()
|
70
|
+
return () => controller.abort();
|
36
71
|
}, [params.params]);
|
72
|
+
|
37
73
|
return { response, error, isLoading, isMore };
|
38
74
|
};
|
39
75
|
|
40
|
-
export default useAxios;
|
76
|
+
export default useAxios;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import ReactWebComponent from "react-web-component";
|
3
3
|
import Annuaire from "./components/Annuaire";
|
4
|
+
import Campaign from "./components/Campaign";
|
4
5
|
import News from "./components/News";
|
5
6
|
import Events from "./components/Events";
|
6
7
|
import Search from "./components/Search";
|
@@ -11,6 +12,7 @@ import "./index.scss";
|
|
11
12
|
Note: if your webcomponent depends on external css, disable shadow root
|
12
13
|
*/
|
13
14
|
ReactWebComponent.create(<Annuaire />, "smartweb-annuaire", false);
|
15
|
+
ReactWebComponent.create(<Campaign />, "smartweb-campaign", false);
|
14
16
|
ReactWebComponent.create(<News />, "smartweb-news", false);
|
15
17
|
ReactWebComponent.create(<Events />, "smartweb-events", false);
|
16
18
|
ReactWebComponent.create(<Search />, "smartweb-search", false);
|
@@ -0,0 +1,177 @@
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
2
|
+
import { MapContainer, TileLayer, Marker, Popup, useMap } from "react-leaflet";
|
3
|
+
import useFilterQuery from "../hooks/useFilterQuery";
|
4
|
+
import L from "leaflet";
|
5
|
+
import iconSvg from "../assets/pin-react.svg";
|
6
|
+
import iconSvgActivated from "../assets/pin-react-active.svg";
|
7
|
+
import { Link } from "react-router-dom";
|
8
|
+
import "./Map.scss";
|
9
|
+
import "leaflet/dist/leaflet.css";
|
10
|
+
import removeAccents from "remove-accents";
|
11
|
+
import queryString from "query-string";
|
12
|
+
import { el } from "date-fns/locale";
|
13
|
+
|
14
|
+
function ChangeMapView({ activeItem, arrayOfLatLngs }) {
|
15
|
+
const map = useMap();
|
16
|
+
if (activeItem) {
|
17
|
+
const activeCoord = [];
|
18
|
+
activeCoord.push(activeItem.fields.geolocalisation.lat);
|
19
|
+
activeCoord.push(activeItem.fields.geolocalisation.lon);
|
20
|
+
map.setView(activeCoord, 15);
|
21
|
+
} else {
|
22
|
+
let bounds = new L.LatLngBounds(arrayOfLatLngs);
|
23
|
+
map.fitBounds(bounds);
|
24
|
+
}
|
25
|
+
return null;
|
26
|
+
}
|
27
|
+
|
28
|
+
function Map(props) {
|
29
|
+
const [activeItem, setActiveItem] = useState(null);
|
30
|
+
const [filterGeoArray, setFilterGeoArray] = useState([]);
|
31
|
+
const [allPosition, setAllPosition] = useState(null);
|
32
|
+
const { u, ...parsed } = Object.assign({
|
33
|
+
id: queryString.parse(useFilterQuery().toString())["u"],
|
34
|
+
});
|
35
|
+
// Delete Imio positions
|
36
|
+
useEffect(() => {
|
37
|
+
if (!props.items) {
|
38
|
+
return;
|
39
|
+
}
|
40
|
+
const filterArray = props.items.filter((isgeo) => {
|
41
|
+
if (isgeo.fields) {
|
42
|
+
return (
|
43
|
+
isgeo.fields.geolocalisation.lat &&
|
44
|
+
isgeo.fields.geolocalisation.lat !== 50.4989185 &&
|
45
|
+
isgeo.fields.geolocalisation.lon !== 4.7184485
|
46
|
+
);
|
47
|
+
} else {
|
48
|
+
return (
|
49
|
+
isgeo.geolocation.latitude &&
|
50
|
+
isgeo.geolocation.latitude !== 50.4989185 &&
|
51
|
+
isgeo.geolocation.longitude !== 4.7184485
|
52
|
+
);
|
53
|
+
}
|
54
|
+
});
|
55
|
+
setFilterGeoArray(filterArray);
|
56
|
+
}, [props.items]);
|
57
|
+
|
58
|
+
// Setup Maker Icon
|
59
|
+
const mapIcon = (url) => {
|
60
|
+
return new L.Icon({
|
61
|
+
iconUrl: url,
|
62
|
+
iconSize: [29, 37],
|
63
|
+
});
|
64
|
+
};
|
65
|
+
// Get Marker Icon and Z-index
|
66
|
+
const getMarkerIcon = (index) => {
|
67
|
+
if (index === parsed.id) {
|
68
|
+
return mapIcon(iconSvgActivated);
|
69
|
+
}
|
70
|
+
if (index === props.hoverId) {
|
71
|
+
return mapIcon(iconSvgActivated);
|
72
|
+
}
|
73
|
+
return mapIcon(iconSvg);
|
74
|
+
};
|
75
|
+
const getMarkerZindex = (index) => {
|
76
|
+
if (index === props.clickId) {
|
77
|
+
return 999;
|
78
|
+
}
|
79
|
+
if (index === props.hoverId) {
|
80
|
+
return 999;
|
81
|
+
}
|
82
|
+
return 1;
|
83
|
+
};
|
84
|
+
|
85
|
+
useEffect(() => {
|
86
|
+
var result =
|
87
|
+
filterGeoArray &&
|
88
|
+
filterGeoArray.filter((obj) => {
|
89
|
+
return obj.id === parsed.id;
|
90
|
+
});
|
91
|
+
setActiveItem(result[0]);
|
92
|
+
}, [filterGeoArray]);
|
93
|
+
|
94
|
+
useEffect(() => {
|
95
|
+
if (filterGeoArray.length > 0) {
|
96
|
+
let posArray = [];
|
97
|
+
filterGeoArray.map((pos, i) => {
|
98
|
+
let lat = pos.fields.geolocalisation.lat;
|
99
|
+
let long = pos.fields.geolocalisation.lon;
|
100
|
+
posArray.push([lat, long]);
|
101
|
+
});
|
102
|
+
setAllPosition(posArray);
|
103
|
+
}
|
104
|
+
}, [filterGeoArray]);
|
105
|
+
const position = [50.85034, 4.35171];
|
106
|
+
|
107
|
+
const markers = filterGeoArray.map((mark, i) => (
|
108
|
+
<Marker
|
109
|
+
key={i}
|
110
|
+
icon={getMarkerIcon(mark.id)}
|
111
|
+
zIndexOffset={getMarkerZindex(mark.id)}
|
112
|
+
position={[
|
113
|
+
mark.fields.geolocalisation ? mark.fields.geolocalisation.lat : "",
|
114
|
+
mark.fields.geolocalisation ? mark.fields.geolocalisation.lon : "",
|
115
|
+
]}
|
116
|
+
eventHandlers={{
|
117
|
+
mouseover: (e) => {
|
118
|
+
// Gérer les événements ici
|
119
|
+
},
|
120
|
+
}}
|
121
|
+
>
|
122
|
+
<Popup closeButton={false}>
|
123
|
+
<Link
|
124
|
+
className="r-map-popup"
|
125
|
+
style={{ textDecoration: "none" }}
|
126
|
+
to={{
|
127
|
+
pathname:
|
128
|
+
"/" +
|
129
|
+
removeAccents(mark.text)
|
130
|
+
.replace(/[^a-zA-Z ]/g, "")
|
131
|
+
.replace(/\s/g, "-")
|
132
|
+
.toLowerCase(),
|
133
|
+
search: `?u=${mark.id}`,
|
134
|
+
state: {
|
135
|
+
idItem: mark.id,
|
136
|
+
},
|
137
|
+
}}
|
138
|
+
>
|
139
|
+
<span className="r-map-popup-title">{mark.text}</span>
|
140
|
+
</Link>
|
141
|
+
<a
|
142
|
+
href={`https://www.google.com/maps/dir/?api=1&destination=${mark.fields.rue ? mark.fields.rue + " " + mark.fields.numero : ""}`}
|
143
|
+
className="r-map-popup-adress"
|
144
|
+
>
|
145
|
+
{mark.fields.rue && mark.fields.rue + " " + mark.fields.numero}
|
146
|
+
</a>
|
147
|
+
</Popup>
|
148
|
+
</Marker>
|
149
|
+
));
|
150
|
+
|
151
|
+
return (
|
152
|
+
<div>
|
153
|
+
<MapContainer
|
154
|
+
style={{ height: `calc(100vh - ${props.headerHeight}px)`, minHeight: "600px" }}
|
155
|
+
center={position}
|
156
|
+
zoom={35}
|
157
|
+
>
|
158
|
+
<TileLayer
|
159
|
+
attribution='© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
160
|
+
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
161
|
+
/>
|
162
|
+
{allPosition != null ? (
|
163
|
+
<ChangeMapView
|
164
|
+
activeItem={activeItem}
|
165
|
+
activeItemUID={parsed.id}
|
166
|
+
arrayOfLatLngs={allPosition && allPosition}
|
167
|
+
/>
|
168
|
+
) : (
|
169
|
+
""
|
170
|
+
)}
|
171
|
+
{filterGeoArray && markers}
|
172
|
+
</MapContainer>
|
173
|
+
</div>
|
174
|
+
);
|
175
|
+
}
|
176
|
+
|
177
|
+
export default Map;
|
@@ -4,4 +4,18 @@
|
|
4
4
|
|
5
5
|
.leaflet-popup {
|
6
6
|
padding: 0;
|
7
|
-
}
|
7
|
+
}
|
8
|
+
.r-map-popup-title {
|
9
|
+
font-weight: bold;
|
10
|
+
text-decoration: none !important;
|
11
|
+
}
|
12
|
+
|
13
|
+
.r-map-popup-adress {
|
14
|
+
font-size: 1em;
|
15
|
+
text-decoration: underline;
|
16
|
+
display: block;
|
17
|
+
margin-top: 0.5rem;
|
18
|
+
color: #202228;
|
19
|
+
position: relative;
|
20
|
+
z-index: 1;
|
21
|
+
}
|