imio.smartweb.core 1.2.44__py3-none-any.whl → 1.2.46__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/behaviors/categorization.py +24 -0
- imio/smartweb/core/behaviors/configure.zcml +7 -0
- imio/smartweb/core/browser/static/smartweb-edit-compiled.css +1 -1
- imio/smartweb/core/browser/static/src/edit.less +42 -0
- imio/smartweb/core/contents/pages/cirkwi/content.py +5 -0
- imio/smartweb/core/contents/pages/cirkwi/view.py +2 -1
- imio/smartweb/core/contents/rest/events/endpoint.py +1 -0
- imio/smartweb/core/contents/rest/events/view.pt +2 -1
- imio/smartweb/core/contents/rest/events/view.py +4 -0
- imio/smartweb/core/contents/rest/news/endpoint.py +1 -0
- imio/smartweb/core/contents/rest/news/view.pt +2 -1
- imio/smartweb/core/contents/rest/news/view.py +4 -0
- imio/smartweb/core/contents/sections/configure.zcml +1 -1
- imio/smartweb/core/contents/sections/events/view.py +11 -1
- imio/smartweb/core/contents/sections/macros.pt +3 -2
- imio/smartweb/core/contents/sections/news/view.py +11 -1
- imio/smartweb/core/contents/sections/views.py +4 -4
- imio/smartweb/core/profiles/default/metadata.xml +1 -1
- imio/smartweb/core/profiles/default/types/imio.smartweb.EventsView.xml +1 -0
- imio/smartweb/core/profiles/default/types/imio.smartweb.NewsView.xml +1 -0
- imio/smartweb/core/profiles/default/types/imio.smartweb.SectionEvents.xml +1 -0
- imio/smartweb/core/profiles/default/types/imio.smartweb.SectionNews.xml +1 -0
- imio/smartweb/core/tests/resources/json_rest_events.json +2 -1
- imio/smartweb/core/tests/resources/json_rest_news.json +2 -2
- imio/smartweb/core/tests/resources/json_rest_specific_events.json +1 -1
- imio/smartweb/core/tests/test_htmx_in_sections.py +8 -1
- imio/smartweb/core/tests/test_rest.py +36 -0
- imio/smartweb/core/tests/test_section_events.py +27 -5
- imio/smartweb/core/tests/test_section_news.py +16 -3
- imio/smartweb/core/tests/test_vocabularies.py +3 -0
- imio/smartweb/core/upgrades/configure.zcml +18 -0
- imio/smartweb/core/upgrades/profiles/1056_to_1057/types/imio.smartweb.EventsView.xml +11 -0
- imio/smartweb/core/upgrades/profiles/1056_to_1057/types/imio.smartweb.NewsView.xml +11 -0
- imio/smartweb/core/upgrades/profiles/1056_to_1057/types/imio.smartweb.SectionEvents.xml +11 -0
- imio/smartweb/core/upgrades/profiles/1056_to_1057/types/imio.smartweb.SectionNews.xml +11 -0
- imio/smartweb/core/utils.py +0 -23
- imio/smartweb/core/vocabularies.py +17 -0
- 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/686.smartweb-webcomponents-compiled.css +1 -1
- 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 +1 -1
- imio/smartweb/core/webcomponents/build/js/373.smartweb-webcomponents-compiled.js +2 -1
- imio/smartweb/core/webcomponents/build/js/{568.smartweb-webcomponents-compiled.js.LICENSE.txt → 373.smartweb-webcomponents-compiled.js.LICENSE.txt} +0 -4
- imio/smartweb/core/webcomponents/build/js/486.smartweb-webcomponents-compiled.js +1 -1
- imio/smartweb/core/webcomponents/build/js/499.smartweb-webcomponents-compiled.js +2 -0
- imio/smartweb/core/webcomponents/build/js/686.smartweb-webcomponents-compiled.js +1 -1
- imio/smartweb/core/webcomponents/build/js/736.smartweb-webcomponents-compiled.js +1 -1
- imio/smartweb/core/webcomponents/build/js/736.smartweb-webcomponents-compiled.js.LICENSE.txt +3 -3
- imio/smartweb/core/webcomponents/build/js/919.smartweb-webcomponents-compiled.js +1 -1
- imio/smartweb/core/webcomponents/build/js/{568.smartweb-webcomponents-compiled.js → 963.smartweb-webcomponents-compiled.js} +2 -2
- imio/smartweb/core/webcomponents/build/js/963.smartweb-webcomponents-compiled.js.LICENSE.txt +3 -0
- imio/smartweb/core/webcomponents/build/js/smartweb-webcomponents-compiled.js +1 -1
- imio/smartweb/core/webcomponents/package.json +1 -0
- imio/smartweb/core/webcomponents/src/components/Annuaire/ContactContent/ContactContent.jsx +265 -161
- imio/smartweb/core/webcomponents/src/components/Events/EventCard/EventCard.jsx +34 -21
- imio/smartweb/core/webcomponents/src/components/Events/EventList/EventList.jsx +2 -2
- imio/smartweb/core/webcomponents/src/components/Events/Events.jsx +2 -1
- imio/smartweb/core/webcomponents/src/components/Events/Events.scss +1 -0
- imio/smartweb/core/webcomponents/src/components/News/News.jsx +2 -1
- imio/smartweb/core/webcomponents/src/components/News/News.scss +9 -1
- imio/smartweb/core/webcomponents/src/components/News/NewsCard/NewsCard.jsx +22 -5
- imio/smartweb/core/webcomponents/src/components/News/NewsList/NewsList.jsx +2 -2
- imio/smartweb/core/webcomponents/src/utils/Map.jsx +1 -3
- imio/smartweb/core/webcomponents/src/utils/translation.js +49 -1
- imio.smartweb.core-1.2.46-py3.8-nspkg.pth +2 -0
- {imio.smartweb.core-1.2.44.dist-info → imio.smartweb.core-1.2.46.dist-info}/METADATA +29 -3
- {imio.smartweb.core-1.2.44.dist-info → imio.smartweb.core-1.2.46.dist-info}/RECORD +74 -70
- {imio.smartweb.core-1.2.44.dist-info → imio.smartweb.core-1.2.46.dist-info}/WHEEL +1 -1
- imio/smartweb/core/webcomponents/build/assets/next-react-white.819cb069ac8eec300a9db6a7707712d6.svg +0 -1
- imio/smartweb/core/webcomponents/build/f79b479fdc5c0fe0d553.svg +0 -1
- imio/smartweb/core/webcomponents/build/js/496.smartweb-webcomponents-compiled.js +0 -2
- imio.smartweb.core-1.2.44-py3.10-nspkg.pth +0 -3
- /imio/smartweb/core/webcomponents/build/js/{496.smartweb-webcomponents-compiled.js.LICENSE.txt → 499.smartweb-webcomponents-compiled.js.LICENSE.txt} +0 -0
- {imio.smartweb.core-1.2.44.dist-info → imio.smartweb.core-1.2.46.dist-info}/LICENSE.GPL +0 -0
- {imio.smartweb.core-1.2.44.dist-info → imio.smartweb.core-1.2.46.dist-info}/LICENSE.rst +0 -0
- {imio.smartweb.core-1.2.44.dist-info → imio.smartweb.core-1.2.46.dist-info}/namespace_packages.txt +0 -0
- {imio.smartweb.core-1.2.44.dist-info → imio.smartweb.core-1.2.46.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
from imio.smartweb.locales import SmartwebMessageFactory as _
|
4
|
+
from plone.autoform import directives
|
5
|
+
from plone.autoform.interfaces import IFormFieldProvider
|
6
|
+
from plone.supermodel import model
|
7
|
+
from zope import schema
|
8
|
+
from zope.interface import provider
|
9
|
+
|
10
|
+
|
11
|
+
@provider(IFormFieldProvider)
|
12
|
+
class ICategoryDisplay(model.Schema):
|
13
|
+
directives.order_before(show_categories_or_topics="IOrientation.orientation")
|
14
|
+
|
15
|
+
model.fieldset("layout", fields=["show_categories_or_topics"])
|
16
|
+
show_categories_or_topics = schema.Choice(
|
17
|
+
title=_("Show category or topic"),
|
18
|
+
description=_(
|
19
|
+
"Select if you want (specific) category or (first) topic displayed on items"
|
20
|
+
),
|
21
|
+
source="imio.smartweb.vocabulary.CategoriesDisplay",
|
22
|
+
required=True,
|
23
|
+
default="category",
|
24
|
+
)
|
@@ -5,6 +5,13 @@
|
|
5
5
|
|
6
6
|
<include package="plone.behavior" file="meta.zcml"/>
|
7
7
|
|
8
|
+
<plone:behavior
|
9
|
+
name="imio.smartweb.category_display"
|
10
|
+
title="Categories / Topics display"
|
11
|
+
description="Allow to choose to display categories or topics"
|
12
|
+
provides=".categorization.ICategoryDisplay"
|
13
|
+
/>
|
14
|
+
|
8
15
|
<plone:behavior
|
9
16
|
name="imio.smartweb.orientation"
|
10
17
|
title="Image orientation"
|
@@ -1 +1 @@
|
|
1
|
-
#contentview-preview .icon-preview:before{content:"\e833"}.pat-sortable>:hover{cursor:move}.pat-sortable{display:block;position:relative}.pat-sortable .sortable-section{border:1px solid #dee2e6!important;margin-bottom:1rem;margin-top:1rem;padding:.5rem}.hidden-section-title{opacity:.3}.section-title{vertical-align:middle}.content-section h2,.section-title,.show-hide-banner{display:inline-block}.show-hide-banner{background:#fff;border:1px solid #e6e6e6;padding:15px}.header-section{background:#f2f2f2;line-height:1.9;margin-bottom:1rem!important;margin-top:1rem!important;padding:0 1rem}table.table_schedule{cursor:default}ul.plonetoolbar-authentic-sources-menu,ul.plonetoolbar-smartweb-help-menu{padding-inline-start:0;width:100%}a.manage[class*=contenttype-imio-smartweb-]:before{display:none}a.manage[class*=contenttype-imio-smartweb-] svg{margin-right:5px}
|
1
|
+
#contentview-preview .icon-preview:before{content:"\e833"}.pat-sortable>:hover{cursor:move}.pat-sortable{display:block;position:relative}.pat-sortable .sortable-section{border:1px solid #dee2e6!important;margin-bottom:1rem;margin-top:1rem;padding:.5rem}.hidden-section-title{opacity:.3}.section-title{vertical-align:middle}.content-section h2,.section-title,.show-hide-banner{display:inline-block}.show-hide-banner{background:#fff;border:1px solid #e6e6e6;padding:15px}.header-section{background:#f2f2f2;line-height:1.9;margin-bottom:1rem!important;margin-top:1rem!important;padding:0 1rem}table.table_schedule{cursor:default}ul.plonetoolbar-authentic-sources-menu,ul.plonetoolbar-smartweb-help-menu{padding-inline-start:0;width:100%}a.manage[class*=contenttype-imio-smartweb-]:before{display:none}a.manage[class*=contenttype-imio-smartweb-] svg{margin-right:5px}.manage-section .form_section_size option{font-size:15px}.manage-section .form_section_size option:before{aspect-ratio:16/9;content:"";display:block;width:40px}.form_section_size .icon_col-sm-3:before{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 170 100'%3E%3Cpath d='M5 5h40v90H5z' style='fill:%2388c6ef;stroke-width:0'/%3E%3Cpath d='M45 5v90H5V5h40m5-5H0v100h50V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M45 5h40v90H45z' style='fill:%23fff;stroke-width:0'/%3E%3Cpath d='M85 5v90H45V5h40m5-5H40v100h50V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M85 5h40v90H85z' style='fill:%23fff;stroke-width:0'/%3E%3Cpath d='M125 5v90H85V5h40m5-5H80v100h50V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M125 5h40v90h-40z' style='fill:%23fff;stroke-width:0'/%3E%3Cpath d='M165 5v90h-40V5h40m5-5h-50v100h50V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3C/svg%3E");background-repeat:no-repeat;background-size:contain}.form_section_size .icon_col-sm-4:before{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 170 100'%3E%3Cpath d='M5 5h53.36v90H5z' style='fill:%2388c6ef;stroke-width:0'/%3E%3Cpath d='M58.36 5v90H5V5h53.36m5-5H0v100h63.36V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M58.27 5h53.36v90H58.27z' style='fill:%23fff;stroke-width:0'/%3E%3Cpath d='M111.64 5v90H58.28V5h53.36m5-5H53.28v100h63.36V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M111.64 5H165v90h-53.36z' style='fill:%23fff;stroke-width:0'/%3E%3Cpath d='M165 5v90h-53.36V5H165m5-5h-63.36v100H170V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3C/svg%3E");background-repeat:no-repeat;background-size:contain}.form_section_size .icon_col-sm-6:before{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 170 100'%3E%3Cpath d='M5 5h160v90H5z' style='fill:%23fff;stroke-width:0'/%3E%3Cpath d='M165 5v90H5V5h160m5-5H0v100h170V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M5 5h80v90H5z' style='fill:%2388c6ef;stroke-width:0'/%3E%3Cpath d='M85 5v90H5V5h80m5-5H0v100h90V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3C/svg%3E");background-repeat:no-repeat;background-size:contain}.form_section_size .icon_col-sm-8:before{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 170 100'%3E%3Cpath d='M5 5h53.36v90H5z' style='fill:%2388c6ef;stroke-width:0'/%3E%3Cpath d='M58.36 5v90H5V5h53.36m5-5H0v100h63.36V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M58.27 5h53.36v90H58.27z' style='fill:%2388c6ef;stroke-width:0'/%3E%3Cpath d='M111.64 5v90H58.28V5h53.36m5-5H53.28v100h63.36V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M111.64 5H165v90h-53.36z' style='fill:%23fff;stroke-width:0'/%3E%3Cpath d='M165 5v90h-53.36V5H165m5-5h-63.36v100H170V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3C/svg%3E");background-repeat:no-repeat;background-size:contain}.form_section_size .icon_col-sm-9:before{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 170 100'%3E%3Cpath d='M5 5h40v90H5z' style='fill:%2388c6ef;stroke-width:0'/%3E%3Cpath d='M45 5v90H5V5h40m5-5H0v100h50V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M45 5h40v90H45z' style='fill:%2388c6ef;stroke-width:0'/%3E%3Cpath d='M85 5v90H45V5h40m5-5H40v100h50V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M85 5h40v90H85z' style='fill:%2388c6ef;stroke-width:0'/%3E%3Cpath d='M125 5v90H85V5h40m5-5H80v100h50V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M125 5h40v90h-40z' style='fill:%23fff;stroke-width:0'/%3E%3Cpath d='M165 5v90h-40V5h40m5-5h-50v100h50V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3C/svg%3E");background-repeat:no-repeat;background-size:contain}.form_section_size .icon_col-sm-12:before{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 170 100'%3E%3Cpath d='M5 5h160v90H5z' style='fill:%2388c6ef;stroke-width:0'/%3E%3Cpath d='M165 5v90H5V5h160m5-5H0v100h170V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3C/svg%3E");background-repeat:no-repeat;background-size:contain}
|
@@ -69,4 +69,46 @@ a.manage[class*="contenttype-imio-smartweb-"] {
|
|
69
69
|
svg {
|
70
70
|
margin-right: 5px;
|
71
71
|
}
|
72
|
+
}
|
73
|
+
|
74
|
+
// layout select
|
75
|
+
|
76
|
+
.manage-section .form_section_size option {
|
77
|
+
font-size: 15px;
|
78
|
+
}
|
79
|
+
.manage-section .form_section_size option:before {
|
80
|
+
content:"";
|
81
|
+
display: block;
|
82
|
+
width: 40px;
|
83
|
+
aspect-ratio: 16/9;
|
84
|
+
}
|
85
|
+
.form_section_size .icon_col-sm-3:before {
|
86
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 170 100'%3E%3Cpath d='M5 5h40v90H5z' style='fill:%2388c6ef;stroke-width:0'/%3E%3Cpath d='M45 5v90H5V5h40m5-5H0v100h50V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M45 5h40v90H45z' style='fill:%23fff;stroke-width:0'/%3E%3Cpath d='M85 5v90H45V5h40m5-5H40v100h50V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M85 5h40v90H85z' style='fill:%23fff;stroke-width:0'/%3E%3Cpath d='M125 5v90H85V5h40m5-5H80v100h50V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M125 5h40v90h-40z' style='fill:%23fff;stroke-width:0'/%3E%3Cpath d='M165 5v90h-40V5h40m5-5h-50v100h50V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3C/svg%3E");
|
87
|
+
background-size: contain;
|
88
|
+
background-repeat: no-repeat;
|
89
|
+
}
|
90
|
+
.form_section_size .icon_col-sm-4:before {
|
91
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 170 100'%3E%3Cpath d='M5 5h53.36v90H5z' style='fill:%2388c6ef;stroke-width:0'/%3E%3Cpath d='M58.36 5v90H5V5h53.36m5-5H0v100h63.36V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M58.27 5h53.36v90H58.27z' style='fill:%23fff;stroke-width:0'/%3E%3Cpath d='M111.64 5v90H58.28V5h53.36m5-5H53.28v100h63.36V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M111.64 5H165v90h-53.36z' style='fill:%23fff;stroke-width:0'/%3E%3Cpath d='M165 5v90h-53.36V5H165m5-5h-63.36v100H170V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3C/svg%3E");
|
92
|
+
background-size: contain;
|
93
|
+
background-repeat: no-repeat;
|
94
|
+
}
|
95
|
+
.form_section_size .icon_col-sm-6:before {
|
96
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 170 100'%3E%3Cpath d='M5 5h160v90H5z' style='fill:%23fff;stroke-width:0'/%3E%3Cpath d='M165 5v90H5V5h160m5-5H0v100h170V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M5 5h80v90H5z' style='fill:%2388c6ef;stroke-width:0'/%3E%3Cpath d='M85 5v90H5V5h80m5-5H0v100h90V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3C/svg%3E");
|
97
|
+
background-size: contain;
|
98
|
+
background-repeat: no-repeat;
|
99
|
+
}
|
100
|
+
.form_section_size .icon_col-sm-8:before {
|
101
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 170 100'%3E%3Cpath d='M5 5h53.36v90H5z' style='fill:%2388c6ef;stroke-width:0'/%3E%3Cpath d='M58.36 5v90H5V5h53.36m5-5H0v100h63.36V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M58.27 5h53.36v90H58.27z' style='fill:%2388c6ef;stroke-width:0'/%3E%3Cpath d='M111.64 5v90H58.28V5h53.36m5-5H53.28v100h63.36V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M111.64 5H165v90h-53.36z' style='fill:%23fff;stroke-width:0'/%3E%3Cpath d='M165 5v90h-53.36V5H165m5-5h-63.36v100H170V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3C/svg%3E");
|
102
|
+
background-size: contain;
|
103
|
+
background-repeat: no-repeat;
|
104
|
+
}
|
105
|
+
.form_section_size .icon_col-sm-9:before {
|
106
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 170 100'%3E%3Cpath d='M5 5h40v90H5z' style='fill:%2388c6ef;stroke-width:0'/%3E%3Cpath d='M45 5v90H5V5h40m5-5H0v100h50V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M45 5h40v90H45z' style='fill:%2388c6ef;stroke-width:0'/%3E%3Cpath d='M85 5v90H45V5h40m5-5H40v100h50V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M85 5h40v90H85z' style='fill:%2388c6ef;stroke-width:0'/%3E%3Cpath d='M125 5v90H85V5h40m5-5H80v100h50V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3Cpath d='M125 5h40v90h-40z' style='fill:%23fff;stroke-width:0'/%3E%3Cpath d='M165 5v90h-40V5h40m5-5h-50v100h50V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3C/svg%3E");
|
107
|
+
background-size: contain;
|
108
|
+
background-repeat: no-repeat;
|
109
|
+
}
|
110
|
+
.form_section_size .icon_col-sm-12:before {
|
111
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 170 100'%3E%3Cpath d='M5 5h160v90H5z' style='fill:%2388c6ef;stroke-width:0'/%3E%3Cpath d='M165 5v90H5V5h160m5-5H0v100h170V0Z' style='fill:%230081f4;stroke-width:0'/%3E%3C/svg%3E");
|
112
|
+
background-size: contain;
|
113
|
+
background-repeat: no-repeat;
|
72
114
|
}
|
@@ -10,7 +10,8 @@ class CirkwiViewView(BrowserView):
|
|
10
10
|
|
11
11
|
def get_cirkwi_html(self):
|
12
12
|
cirkwi_widget_id = self.context.cirkwi_widget_id
|
13
|
-
|
13
|
+
cirkwi_widget_mb_key = self.context.cirkwi_widget_mb_key
|
14
|
+
url = f"{self.cirwki_api_uri}{cirkwi_widget_id}?mb_key={cirkwi_widget_mb_key}&{self.request.get('QUERY_STRING')}"
|
14
15
|
response = requests.get(url)
|
15
16
|
if response.status_code != 200:
|
16
17
|
return response.status_code
|
@@ -35,6 +35,7 @@ class BaseEventsEndpoint(BaseEndpoint):
|
|
35
35
|
params = [
|
36
36
|
"selected_agendas={}".format(self.context.selected_agenda),
|
37
37
|
"metadata_fields=category",
|
38
|
+
"metadata_fields=local_category",
|
38
39
|
"metadata_fields=container_uid",
|
39
40
|
"metadata_fields=topics",
|
40
41
|
"metadata_fields=start",
|
@@ -14,7 +14,8 @@
|
|
14
14
|
display-map view/display_map;
|
15
15
|
only-past-events view/only_past_events;
|
16
16
|
view-path view/view_path;
|
17
|
-
display_agendas_titles view/display_agendas_titles;
|
17
|
+
display_agendas_titles view/display_agendas_titles;
|
18
|
+
show-categories-or-topics view/show_categories_or_topics;"></smartweb-events>
|
18
19
|
</div>
|
19
20
|
</metal:main>
|
20
21
|
</body>
|
@@ -39,6 +39,7 @@ class BaseNewsEndpoint(BaseEndpoint):
|
|
39
39
|
"selected_news_folders={}".format(self.context.selected_news_folder),
|
40
40
|
"portal_type=imio.news.NewsItem",
|
41
41
|
"metadata_fields=category",
|
42
|
+
"metadata_fields=local_category",
|
42
43
|
"metadata_fields=container_uid",
|
43
44
|
"metadata_fields=topics",
|
44
45
|
"metadata_fields=has_leadimage",
|
@@ -12,7 +12,8 @@
|
|
12
12
|
orientation view/orientation;
|
13
13
|
current-language view/current_language;
|
14
14
|
view-path view/view_path;
|
15
|
-
display_newsfolders_titles view/display_newsfolders_titles;
|
15
|
+
display_newsfolders_titles view/display_newsfolders_titles;
|
16
|
+
show-categories-or-topics view/show_categories_or_topics;"></smartweb-news>
|
16
17
|
</div>
|
17
18
|
</metal:main>
|
18
19
|
</body>
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
from datetime import date
|
4
4
|
from dateutil.parser import parse
|
5
|
+
from imio.smartweb.common.utils import translate_vocabulary_term
|
5
6
|
from imio.smartweb.core.config import EVENTS_URL
|
6
7
|
from imio.smartweb.core.contents.sections.views import CarouselOrTableSectionView
|
7
8
|
from imio.smartweb.core.contents.sections.views import HashableJsonSectionView
|
@@ -29,6 +30,7 @@ class EventsView(CarouselOrTableSectionView, HashableJsonSectionView):
|
|
29
30
|
selected_item,
|
30
31
|
"metadata_fields=container_uid",
|
31
32
|
"metadata_fields=category_title",
|
33
|
+
"metadata_fields=topics",
|
32
34
|
"metadata_fields=start",
|
33
35
|
"metadata_fields=end",
|
34
36
|
"metadata_fields=has_leadimage",
|
@@ -63,11 +65,19 @@ class EventsView(CarouselOrTableSectionView, HashableJsonSectionView):
|
|
63
65
|
end = item["end"] and parse(item["end"]) or None
|
64
66
|
date_dict = {"start": start, "end": end}
|
65
67
|
modified_hash = hash_md5(item["modified"])
|
68
|
+
category = ""
|
69
|
+
if self.context.show_categories_or_topics == "category":
|
70
|
+
category = item.get("category_title", "")
|
71
|
+
elif self.context.show_categories_or_topics == "topic":
|
72
|
+
topic = item.get("topics") and item["topics"][0] or None
|
73
|
+
category = translate_vocabulary_term(
|
74
|
+
"imio.smartweb.vocabulary.Topics", topic
|
75
|
+
)
|
66
76
|
dict_item = {
|
67
77
|
"uid": item_uid,
|
68
78
|
"title": item["title"],
|
69
79
|
"description": item["description"],
|
70
|
-
"category":
|
80
|
+
"category": category,
|
71
81
|
"event_date": date_dict,
|
72
82
|
"url": f"{linking_view_url}/{item_id}?u={item_uid}",
|
73
83
|
"container_id": item.get("usefull_container_id", None),
|
@@ -68,8 +68,9 @@
|
|
68
68
|
tal:attributes="name string:select_${context/UID};
|
69
69
|
id string:select_${context/UID}">
|
70
70
|
<option tal:repeat="size view/get_sizes"
|
71
|
-
tal:attributes="value size/key"
|
72
|
-
|
71
|
+
tal:attributes="title size/value; value size/key; class string:icon_${size/key}"
|
72
|
+
>
|
73
|
+
</option>
|
73
74
|
</select>
|
74
75
|
</form>
|
75
76
|
<a class="section_size"
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
|
3
|
+
from imio.smartweb.common.utils import translate_vocabulary_term
|
3
4
|
from imio.smartweb.core.config import NEWS_URL
|
4
5
|
from imio.smartweb.core.contents.sections.views import CarouselOrTableSectionView
|
5
6
|
from imio.smartweb.core.contents.sections.views import HashableJsonSectionView
|
@@ -27,6 +28,7 @@ class NewsView(CarouselOrTableSectionView, HashableJsonSectionView):
|
|
27
28
|
"portal_type=imio.news.NewsItem",
|
28
29
|
"metadata_fields=container_uid",
|
29
30
|
"metadata_fields=category_title",
|
31
|
+
"metadata_fields=topics",
|
30
32
|
"metadata_fields=has_leadimage",
|
31
33
|
"metadata_fields=modified",
|
32
34
|
"metadata_fields=effective",
|
@@ -56,11 +58,19 @@ class NewsView(CarouselOrTableSectionView, HashableJsonSectionView):
|
|
56
58
|
item_url = item["@id"]
|
57
59
|
item_uid = item["UID"]
|
58
60
|
modified_hash = hash_md5(item["modified"])
|
61
|
+
category = ""
|
62
|
+
if self.context.show_categories_or_topics == "category":
|
63
|
+
category = item.get("category_title", "")
|
64
|
+
elif self.context.show_categories_or_topics == "topic":
|
65
|
+
topic = item.get("topics") and item["topics"][0] or None
|
66
|
+
category = translate_vocabulary_term(
|
67
|
+
"imio.smartweb.vocabulary.Topics", topic
|
68
|
+
)
|
59
69
|
dict_item = {
|
60
70
|
"uid": item_uid,
|
61
71
|
"title": item["title"],
|
62
72
|
"description": item["description"],
|
63
|
-
"category":
|
73
|
+
"category": category,
|
64
74
|
"effective": item["effective"],
|
65
75
|
"url": f"{linking_view_url}/{item_id}?u={item_uid}",
|
66
76
|
"container_id": item.get("usefull_container_id", None),
|
@@ -3,7 +3,6 @@
|
|
3
3
|
from Acquisition import aq_inner
|
4
4
|
from imio.smartweb.common.utils import get_vocabulary
|
5
5
|
from imio.smartweb.common.utils import translate_vocabulary_term
|
6
|
-
from imio.smartweb.core.utils import get_current_language
|
7
6
|
from imio.smartweb.core.utils import hash_md5
|
8
7
|
from imio.smartweb.locales import SmartwebMessageFactory as _
|
9
8
|
from plone import api
|
@@ -11,6 +10,7 @@ from plone.locking.browser.info import LockInfoViewlet
|
|
11
10
|
from plone.protect.interfaces import IDisableCSRFProtection
|
12
11
|
from Products.Five.browser import BrowserView
|
13
12
|
from zope.annotation.interfaces import IAnnotations
|
13
|
+
from zope.i18n import translate
|
14
14
|
from zope.interface import alsoProvides
|
15
15
|
from zope.interface import Interface
|
16
16
|
from zope.lifecycleevent import modified
|
@@ -65,9 +65,9 @@ class SectionView(BrowserView):
|
|
65
65
|
return api.user.is_anonymous()
|
66
66
|
|
67
67
|
def get_section_size(self):
|
68
|
-
if not self.context.bootstrap_css_class:
|
69
|
-
return _("Define section size")
|
70
68
|
current_lang = api.portal.get_current_language()[:2]
|
69
|
+
if not self.context.bootstrap_css_class:
|
70
|
+
return translate(_("Define section size"), target_language=current_lang)
|
71
71
|
return translate_vocabulary_term(
|
72
72
|
"imio.smartweb.vocabulary.BootstrapCSS",
|
73
73
|
self.context.bootstrap_css_class,
|
@@ -89,7 +89,7 @@ class SectionView(BrowserView):
|
|
89
89
|
context = aq_inner(self.context)
|
90
90
|
context.bootstrap_css_class = section_size
|
91
91
|
context.reindexObject()
|
92
|
-
current_lang = get_current_language(
|
92
|
+
current_lang = api.portal.get_current_language()[:2]
|
93
93
|
size_txt = translate_vocabulary_term(
|
94
94
|
"imio.smartweb.vocabulary.BootstrapCSS",
|
95
95
|
section_size,
|
@@ -32,6 +32,7 @@
|
|
32
32
|
<element value="plone.locking"/>
|
33
33
|
<element value="plone.leadimage"/>
|
34
34
|
<element value="plone.imagecropping"/>
|
35
|
+
<element value="imio.smartweb.category_display"/>
|
35
36
|
<element value="imio.smartweb.orientation"/>
|
36
37
|
<element value="imio.smartweb.listing"/>
|
37
38
|
<element value="imio.smartweb.topics"/>
|
@@ -32,6 +32,7 @@
|
|
32
32
|
<element value="plone.locking"/>
|
33
33
|
<element value="plone.leadimage"/>
|
34
34
|
<element value="plone.imagecropping"/>
|
35
|
+
<element value="imio.smartweb.category_display"/>
|
35
36
|
<element value="imio.smartweb.orientation"/>
|
36
37
|
<element value="imio.smartweb.listing"/>
|
37
38
|
<element value="imio.smartweb.topics"/>
|
@@ -12,7 +12,7 @@
|
|
12
12
|
"@type": "imio.events.Event",
|
13
13
|
"UID": "97902f2e26774a369035117d56381a2a",
|
14
14
|
"breadcrumb": "Belleville » Accueil temps libre » Journée de l'ATL",
|
15
|
-
"category_title":
|
15
|
+
"category_title": "Presse",
|
16
16
|
"description": "Description de mon événement",
|
17
17
|
"end": "2023-10-31T10:00:00+00:00",
|
18
18
|
"first_end": "2023-10-31T10:00:00+00:00",
|
@@ -652,6 +652,7 @@
|
|
652
652
|
"review_state": "published",
|
653
653
|
"start": "2023-01-31T09:00:00+00:00",
|
654
654
|
"title": "Journée de l'ATL",
|
655
|
+
"topics": ["education"],
|
655
656
|
"whole_day": true
|
656
657
|
},
|
657
658
|
{
|
@@ -7,7 +7,7 @@
|
|
7
7
|
"UID": "aff08290e3f64cfa830417bc36d5614f",
|
8
8
|
"breadcrumb": "belleville >> commune >> Première actualité",
|
9
9
|
"category": null,
|
10
|
-
"category_title":
|
10
|
+
"category_title": "Presse",
|
11
11
|
"description": "Description",
|
12
12
|
"effective": "2021-05-11T13:31:00",
|
13
13
|
"has_leadimage": false,
|
@@ -641,7 +641,7 @@
|
|
641
641
|
"modified": "2021-05-11T13:31:00",
|
642
642
|
"review_state": "published",
|
643
643
|
"title": "Première actualité",
|
644
|
-
"topics":
|
644
|
+
"topics": ["education"]
|
645
645
|
},
|
646
646
|
{
|
647
647
|
"@id": "https://actualites.enwallonie.be/belleville/commune/a02e0afe2cbe4209970992d5d7323373",
|
@@ -1,5 +1,5 @@
|
|
1
1
|
{
|
2
|
-
"@id": "http://localhost:8080/Plone/@events?UID=1178188bddde4ced95a6cf8bf04c443c&portal_type=imio.events.Event&metadata_fields=category_title&metadata_fields=start&metadata_fields=end&metadata_fields=has_leadimage&metadata_fields=image_scales&metadata_fields=UID&event_dates.query=2021-11-15&event_dates.range=min&sort_limit=6",
|
2
|
+
"@id": "http://localhost:8080/Plone/@events?UID=1178188bddde4ced95a6cf8bf04c443c&portal_type=imio.events.Event&metadata_fields=category_title&metadata_fields=topics&metadata_fields=start&metadata_fields=end&metadata_fields=has_leadimage&metadata_fields=image_scales&metadata_fields=UID&event_dates.query=2021-11-15&event_dates.range=min&sort_limit=6",
|
3
3
|
"items": [
|
4
4
|
{
|
5
5
|
"@id": "http://localhost:8080/Plone/belleville/communal/1178188bddde4ced95a6cf8bf04c443c",
|
@@ -4,6 +4,7 @@ from imio.smartweb.core.interfaces import IImioSmartwebCoreLayer
|
|
4
4
|
from imio.smartweb.core.testing import IMIO_SMARTWEB_CORE_FUNCTIONAL_TESTING
|
5
5
|
from imio.smartweb.core.testing import ImioSmartwebTestCase
|
6
6
|
from plone import api
|
7
|
+
from plone.api import portal as portal_api
|
7
8
|
from plone.app.testing import logout
|
8
9
|
from plone.app.testing import setRoles
|
9
10
|
from plone.app.testing import TEST_USER_ID
|
@@ -17,6 +18,7 @@ from zope.component import queryMultiAdapter
|
|
17
18
|
from zope.interface import alsoProvides
|
18
19
|
|
19
20
|
import json
|
21
|
+
import mock
|
20
22
|
import re
|
21
23
|
import transaction
|
22
24
|
|
@@ -75,11 +77,16 @@ class TestSections(ImioSmartwebTestCase):
|
|
75
77
|
self.assertEqual(len(available_sizes), nb_occurrences)
|
76
78
|
for size in available_sizes:
|
77
79
|
self.assertIn(
|
78
|
-
f'<option value="{size["key"]}"
|
80
|
+
f'<option title="{size["value"]}" value="{size["key"]}" class="icon_{size["key"]}" >',
|
79
81
|
form_to_choose_size,
|
80
82
|
)
|
83
|
+
# self.assertIn(
|
84
|
+
# f'<option value="{size["key"]}">{size["value"]}</option>',
|
85
|
+
# form_to_choose_size,
|
86
|
+
# )
|
81
87
|
|
82
88
|
def test_change_section_size(self):
|
89
|
+
portal_api.get_current_language = mock.Mock(return_value="en")
|
83
90
|
transaction.commit()
|
84
91
|
section_text_uid = self.section_text.UID()
|
85
92
|
browser = Browser(self.layer["app"])
|
@@ -369,6 +369,7 @@ class SectionsFunctionalTest(ImioSmartwebTestCase):
|
|
369
369
|
"http://localhost:8080/Plone/@events?"
|
370
370
|
"selected_agendas={}&"
|
371
371
|
"metadata_fields=category&"
|
372
|
+
"metadata_fields=local_category&"
|
372
373
|
"metadata_fields=container_uid&"
|
373
374
|
"metadata_fields=topics&"
|
374
375
|
"metadata_fields=start&"
|
@@ -426,6 +427,7 @@ class SectionsFunctionalTest(ImioSmartwebTestCase):
|
|
426
427
|
"selected_news_folders={}&"
|
427
428
|
"portal_type=imio.news.NewsItem&"
|
428
429
|
"metadata_fields=category&"
|
430
|
+
"metadata_fields=local_category&"
|
429
431
|
"metadata_fields=container_uid&"
|
430
432
|
"metadata_fields=topics&"
|
431
433
|
"metadata_fields=has_leadimage&"
|
@@ -489,6 +491,40 @@ class SectionsFunctionalTest(ImioSmartwebTestCase):
|
|
489
491
|
view = queryMultiAdapter((self.rest_events, self.request), name="view")
|
490
492
|
self.assertIn('display-map="True"', view())
|
491
493
|
|
494
|
+
def test_show_categories_or_topics(self):
|
495
|
+
rest_events = api.content.create(
|
496
|
+
container=self.portal,
|
497
|
+
type="imio.smartweb.EventsView",
|
498
|
+
title="events view",
|
499
|
+
)
|
500
|
+
view = queryMultiAdapter((rest_events, self.request), name="view")
|
501
|
+
self.assertIn('show-categories-or-topics="category"', view())
|
502
|
+
rest_events.show_categories_or_topics = "category"
|
503
|
+
view = queryMultiAdapter((rest_events, self.request), name="view")
|
504
|
+
self.assertIn('show-categories-or-topics="category"', view())
|
505
|
+
rest_events.show_categories_or_topics = "topic"
|
506
|
+
view = queryMultiAdapter((rest_events, self.request), name="view")
|
507
|
+
self.assertIn('show-categories-or-topics="topic"', view())
|
508
|
+
rest_events.show_categories_or_topics = ""
|
509
|
+
view = queryMultiAdapter((rest_events, self.request), name="view")
|
510
|
+
self.assertIn('show-categories-or-topics=""', view())
|
511
|
+
rest_news = api.content.create(
|
512
|
+
container=self.portal,
|
513
|
+
type="imio.smartweb.NewsView",
|
514
|
+
title="news view",
|
515
|
+
)
|
516
|
+
view = queryMultiAdapter((rest_news, self.request), name="view")
|
517
|
+
self.assertIn('show-categories-or-topics="category"', view())
|
518
|
+
rest_news.show_categories_or_topics = "category"
|
519
|
+
view = queryMultiAdapter((rest_news, self.request), name="view")
|
520
|
+
self.assertIn('show-categories-or-topics="category"', view())
|
521
|
+
rest_news.show_categories_or_topics = "topic"
|
522
|
+
view = queryMultiAdapter((rest_news, self.request), name="view")
|
523
|
+
self.assertIn('show-categories-or-topics="topic"', view())
|
524
|
+
rest_news.show_categories_or_topics = ""
|
525
|
+
view = queryMultiAdapter((rest_news, self.request), name="view")
|
526
|
+
self.assertIn('show-categories-or-topics=""', view())
|
527
|
+
|
492
528
|
@patch("imio.smartweb.core.rest.authentic_sources.get_wca_token")
|
493
529
|
@patch("imio.smartweb.core.rest.authentic_sources.requests.request")
|
494
530
|
@patch("imio.smartweb.core.rest.authentic_sources.get_default_view_url")
|
@@ -59,12 +59,12 @@ class TestSectionEvents(ImioSmartwebTestCase):
|
|
59
59
|
(self.events, self.request), name="carousel_view"
|
60
60
|
)
|
61
61
|
self.assertEqual(events_view.items, [])
|
62
|
-
url = "http://localhost:8080/Plone/@events?selected_agendas=e73e6a81afea4a579cd0da2773af8d29&metadata_fields=category_title&metadata_fields=start&metadata_fields=end&metadata_fields=has_leadimage&metadata_fields=modified&metadata_fields=UID&event_dates.query=2021-11-15&event_dates.range=min&b_size=6&translated_in_en=1&sort_on=event_dates"
|
62
|
+
url = "http://localhost:8080/Plone/@events?selected_agendas=e73e6a81afea4a579cd0da2773af8d29&metadata_fields=category_title&metadata_fields=topics&metadata_fields=start&metadata_fields=end&metadata_fields=has_leadimage&metadata_fields=modified&metadata_fields=UID&event_dates.query=2021-11-15&event_dates.range=min&b_size=6&translated_in_en=1&sort_on=event_dates"
|
63
63
|
m.get(url, text=json.dumps(self.json_events))
|
64
64
|
self.assertEqual(events_view.items[0][0].get("title"), "Journée de l'ATL")
|
65
65
|
self.assertEqual(len(events_view.items[0]), 2)
|
66
66
|
self.events.specific_related_events = ["1178188bddde4ced95a6cf8bf04c443c"]
|
67
|
-
url = "http://localhost:8080/Plone/@events?UID=1178188bddde4ced95a6cf8bf04c443c&metadata_fields=category_title&metadata_fields=start&metadata_fields=end&metadata_fields=has_leadimage&metadata_fields=modified&metadata_fields=UID&event_dates.query=2021-11-15&event_dates.range=min&b_size=6&translated_in_en=1"
|
67
|
+
url = "http://localhost:8080/Plone/@events?UID=1178188bddde4ced95a6cf8bf04c443c&metadata_fields=category_title&metadata_fields=topics&metadata_fields=start&metadata_fields=end&metadata_fields=has_leadimage&metadata_fields=modified&metadata_fields=UID&event_dates.query=2021-11-15&event_dates.range=min&b_size=6&translated_in_en=1"
|
68
68
|
m.get(url, text=json.dumps(self.json_specific_event))
|
69
69
|
self.assertEqual(len(events_view.items[0]), 1)
|
70
70
|
self.assertEqual(events_view.items[0][0].get("title"), "Bonne cheville")
|
@@ -84,7 +84,7 @@ class TestSectionEvents(ImioSmartwebTestCase):
|
|
84
84
|
events_view = queryMultiAdapter(
|
85
85
|
(self.events, self.request), name="carousel_view"
|
86
86
|
)
|
87
|
-
url = f"http://localhost:8080/Plone/@events?selected_agendas=e73e6a81afea4a579cd0da2773af8d29&metadata_fields=category_title&metadata_fields=start&metadata_fields=end&metadata_fields=has_leadimage&metadata_fields=modified&metadata_fields=UID&event_dates.query={today_str}&event_dates.range=min&b_size=6&translated_in_en=1&sort_on=event_dates"
|
87
|
+
url = f"http://localhost:8080/Plone/@events?selected_agendas=e73e6a81afea4a579cd0da2773af8d29&metadata_fields=category_title&metadata_fields=topics&metadata_fields=start&metadata_fields=end&metadata_fields=has_leadimage&metadata_fields=modified&metadata_fields=UID&event_dates.query={today_str}&event_dates.range=min&b_size=6&translated_in_en=1&sort_on=event_dates"
|
88
88
|
m.get(url, text=json.dumps(self.json_events))
|
89
89
|
self.assertEqual(len(events_view.items[0]), 2)
|
90
90
|
hash_1 = annotations.get(SECTION_ITEMS_HASH_KEY)
|
@@ -92,7 +92,7 @@ class TestSectionEvents(ImioSmartwebTestCase):
|
|
92
92
|
first_modification = self.portalpage.ModificationDate()
|
93
93
|
|
94
94
|
sleep(1)
|
95
|
-
url = f"http://localhost:8080/Plone/@events?selected_agendas=e73e6a81afea4a579cd0da2773af8d29&metadata_fields=category_title&metadata_fields=start&metadata_fields=end&metadata_fields=has_leadimage&metadata_fields=modified&metadata_fields=UID&event_dates.query={today_str}&event_dates.range=min&b_size=6&translated_in_en=1&sort_on=event_dates"
|
95
|
+
url = f"http://localhost:8080/Plone/@events?selected_agendas=e73e6a81afea4a579cd0da2773af8d29&metadata_fields=category_title&metadata_fields=topics&metadata_fields=start&metadata_fields=end&metadata_fields=has_leadimage&metadata_fields=modified&metadata_fields=UID&event_dates.query={today_str}&event_dates.range=min&b_size=6&translated_in_en=1&sort_on=event_dates"
|
96
96
|
m.get(url, text="{}")
|
97
97
|
self.assertEqual(len(events_view.items), 0)
|
98
98
|
next_modification = self.portalpage.ModificationDate()
|
@@ -119,9 +119,31 @@ class TestSectionEvents(ImioSmartwebTestCase):
|
|
119
119
|
events_view = queryMultiAdapter(
|
120
120
|
(self.events, self.request), name="carousel_view"
|
121
121
|
)
|
122
|
-
url = f"http://localhost:8080/Plone/@events?selected_agendas=e73e6a81afea4a579cd0da2773af8d29&metadata_fields=category_title&metadata_fields=start&metadata_fields=end&metadata_fields=has_leadimage&metadata_fields=modified&metadata_fields=UID&event_dates.query={today_str}&event_dates.range=min&b_size=6&translated_in_en=1&sort_on=event_dates"
|
122
|
+
url = f"http://localhost:8080/Plone/@events?selected_agendas=e73e6a81afea4a579cd0da2773af8d29&metadata_fields=category_title&metadata_fields=topics&metadata_fields=start&metadata_fields=end&metadata_fields=has_leadimage&metadata_fields=modified&metadata_fields=UID&event_dates.query={today_str}&event_dates.range=min&b_size=6&translated_in_en=1&sort_on=event_dates"
|
123
123
|
m.get(url, text=json.dumps(self.json_events))
|
124
124
|
|
125
125
|
self.assertIn("paysage_vignette", events_view.items[0][0]["image"])
|
126
126
|
self.events.orientation = "portrait"
|
127
127
|
self.assertIn("portrait_vignette", events_view.items[0][0]["image"])
|
128
|
+
|
129
|
+
@requests_mock.Mocker()
|
130
|
+
def test_show_categories_or_topics(self, m):
|
131
|
+
today = datetime.now()
|
132
|
+
today_str = today.strftime("%Y-%m-%d")
|
133
|
+
intids = getUtility(IIntIds)
|
134
|
+
self.events.related_events = "e73e6a81afea4a579cd0da2773af8d29"
|
135
|
+
self.events.linking_rest_view = RelationValue(
|
136
|
+
intids.getId(self.rest_events_view)
|
137
|
+
)
|
138
|
+
events_view = queryMultiAdapter(
|
139
|
+
(self.events, self.request), name="carousel_view"
|
140
|
+
)
|
141
|
+
url = f"http://localhost:8080/Plone/@events?selected_agendas=e73e6a81afea4a579cd0da2773af8d29&metadata_fields=category_title&metadata_fields=topics&metadata_fields=start&metadata_fields=end&metadata_fields=has_leadimage&metadata_fields=modified&metadata_fields=UID&event_dates.query={today_str}&event_dates.range=min&b_size=6&translated_in_en=1&sort_on=event_dates"
|
142
|
+
m.get(url, text=json.dumps(self.json_events))
|
143
|
+
self.assertEqual(events_view.items[0][0]["category"], "Presse")
|
144
|
+
self.events.show_categories_or_topics = "category"
|
145
|
+
self.assertEqual(events_view.items[0][0]["category"], "Presse")
|
146
|
+
self.events.show_categories_or_topics = "topic"
|
147
|
+
self.assertEqual(events_view.items[0][0]["category"], "Education")
|
148
|
+
self.events.show_categories_or_topics = ""
|
149
|
+
self.assertEqual(events_view.items[0][0]["category"], "")
|
@@ -115,9 +115,6 @@ class TestSectionNews(ImioSmartwebTestCase):
|
|
115
115
|
intids = getUtility(IIntIds)
|
116
116
|
self.news.related_news = "64f4cbee9a394a018a951f6d94452914"
|
117
117
|
self.news.linking_rest_view = RelationValue(intids.getId(self.rest_news_view))
|
118
|
-
annotations = IAnnotations(self.news)
|
119
|
-
self.assertIsNone(annotations.get(SECTION_ITEMS_HASH_KEY))
|
120
|
-
|
121
118
|
news_view = queryMultiAdapter((self.news, self.request), name="carousel_view")
|
122
119
|
url = "http://localhost:8080/Plone/@search?selected_news_folders=64f4cbee9a394a018a951f6d94452914&portal_type=imio.news.NewsItem&metadata_fields=category_title&metadata_fields=has_leadimage&metadata_fields=modified&metadata_fields=effective&metadata_fields=UID&sort_limit=6&translated_in_en=1&sort_on=effective&sort_order=descending"
|
123
120
|
m.get(url, text=json.dumps(self.json_news))
|
@@ -125,3 +122,19 @@ class TestSectionNews(ImioSmartwebTestCase):
|
|
125
122
|
self.assertIn("paysage_vignette", news_view.items[0][0]["image"])
|
126
123
|
self.news.orientation = "portrait"
|
127
124
|
self.assertIn("portrait_vignette", news_view.items[0][0]["image"])
|
125
|
+
|
126
|
+
@requests_mock.Mocker()
|
127
|
+
def test_show_categories_or_topics(self, m):
|
128
|
+
intids = getUtility(IIntIds)
|
129
|
+
self.news.related_news = "64f4cbee9a394a018a951f6d94452914"
|
130
|
+
self.news.linking_rest_view = RelationValue(intids.getId(self.rest_news_view))
|
131
|
+
news_view = queryMultiAdapter((self.news, self.request), name="carousel_view")
|
132
|
+
url = "http://localhost:8080/Plone/@search?selected_news_folders=64f4cbee9a394a018a951f6d94452914&portal_type=imio.news.NewsItem&metadata_fields=category_title&metadata_fields=has_leadimage&metadata_fields=modified&metadata_fields=effective&metadata_fields=UID&sort_limit=6&translated_in_en=1&sort_on=effective&sort_order=descending"
|
133
|
+
m.get(url, text=json.dumps(self.json_news))
|
134
|
+
self.assertEqual(news_view.items[0][0]["category"], "Presse")
|
135
|
+
self.news.show_categories_or_topics = "category"
|
136
|
+
self.assertEqual(news_view.items[0][0]["category"], "Presse")
|
137
|
+
self.news.show_categories_or_topics = "topic"
|
138
|
+
self.assertEqual(news_view.items[0][0]["category"], "Education")
|
139
|
+
self.news.show_categories_or_topics = ""
|
140
|
+
self.assertEqual(news_view.items[0][0]["category"], "")
|
@@ -81,6 +81,9 @@ class TestVocabularies(ImioSmartwebTestCase):
|
|
81
81
|
m.get(GUICHET_URL, text=json.dumps(self.json_procedures_raw_mock))
|
82
82
|
self.assertVocabularyLen("imio.smartweb.vocabulary.PublikProcedures", 0)
|
83
83
|
|
84
|
+
def test_categories_display(self):
|
85
|
+
self.assertVocabularyLen("imio.smartweb.vocabulary.CategoriesDisplay", 3)
|
86
|
+
|
84
87
|
def test_bootstrap_css(self):
|
85
88
|
self.assertVocabularyLen("imio.smartweb.vocabulary.BootstrapCSS", 6)
|
86
89
|
|