imio.smartweb.core 1.2.12__py3-none-any.whl → 1.2.68__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/configure.zcml +41 -1
- imio/smartweb/core/browser/controlpanel.py +41 -0
- imio/smartweb/core/browser/dashboards/configure.zcml +0 -2
- imio/smartweb/core/browser/dashboards/plausible.py +4 -4
- imio/smartweb/core/browser/faceted/block_view.pt +4 -4
- imio/smartweb/core/browser/faceted/summary_view.pt +4 -4
- imio/smartweb/core/browser/forms.py +3 -3
- imio/smartweb/core/browser/redirect_to_main_react_view.py +52 -0
- imio/smartweb/core/browser/search/search.pt +2 -1
- imio/smartweb/core/browser/search/search.py +4 -0
- imio/smartweb/core/browser/sitemap.py +148 -0
- imio/smartweb/core/browser/static/icons/action-delete.svg +3 -0
- imio/smartweb/core/browser/static/icons/action-e-guichet.svg +1 -1
- imio/smartweb/core/browser/static/icons/action-email.svg +1 -1
- imio/smartweb/core/browser/static/icons/action-engagement-2.svg +4 -0
- imio/smartweb/core/browser/static/icons/action-engagement.svg +1 -1
- imio/smartweb/core/browser/static/icons/action-nous-contacter.svg +1 -1
- imio/smartweb/core/browser/static/icons/action-nous-rejoindre.svg +2 -1
- imio/smartweb/core/browser/static/icons/action-organiser-un-evenement.svg +1 -1
- imio/smartweb/core/browser/static/icons/action-panneaux.svg +3 -0
- imio/smartweb/core/browser/static/icons/action-signaler-un-probleme.svg +1 -1
- imio/smartweb/core/browser/static/icons/action-voir-plan.svg +1 -1
- imio/smartweb/core/browser/static/icons/action-vote.svg +3 -0
- imio/smartweb/core/browser/static/icons/categorie-associations.svg +1 -1
- imio/smartweb/core/browser/static/icons/categorie-attention.svg +3 -0
- imio/smartweb/core/browser/static/icons/categorie-avis-et-enquetes.svg +1 -1
- imio/smartweb/core/browser/static/icons/categorie-cinema.svg +1 -1
- imio/smartweb/core/browser/static/icons/categorie-commerce.svg +1 -1
- imio/smartweb/core/browser/static/icons/categorie-concert.svg +1 -1
- imio/smartweb/core/browser/static/icons/categorie-culture.svg +1 -1
- imio/smartweb/core/browser/static/icons/categorie-demarches.svg +1 -1
- imio/smartweb/core/browser/static/icons/categorie-enfance.svg +1 -1
- imio/smartweb/core/browser/static/icons/categorie-enseignement.svg +1 -1
- imio/smartweb/core/browser/static/icons/categorie-environnement-gestion-des-dechets.svg +1 -1
- imio/smartweb/core/browser/static/icons/categorie-exposition.svg +1 -1
- imio/smartweb/core/browser/static/icons/categorie-horaires.svg +1 -1
- imio/smartweb/core/browser/static/icons/categorie-infos-travaux-2.svg +4 -0
- imio/smartweb/core/browser/static/icons/categorie-infos-travaux.svg +1 -1
- imio/smartweb/core/browser/static/icons/categorie-mandataires.svg +1 -1
- imio/smartweb/core/browser/static/icons/categorie-mobilite.svg +1 -1
- imio/smartweb/core/browser/static/icons/categorie-mon-dossier.svg +1 -1
- imio/smartweb/core/browser/static/icons/categorie-nature.svg +3 -0
- imio/smartweb/core/browser/static/icons/categorie-parc-de-stationnement.svg +1 -1
- imio/smartweb/core/browser/static/icons/categorie-parcs-a-conteneurs.svg +4 -0
- imio/smartweb/core/browser/static/icons/categorie-parcs-et-jardins.svg +1 -1
- imio/smartweb/core/browser/static/icons/categorie-plus.svg +3 -0
- imio/smartweb/core/browser/static/icons/categorie-primes-2.svg +5 -0
- imio/smartweb/core/browser/static/icons/categorie-primes.svg +1 -1
- imio/smartweb/core/browser/static/icons/categorie-sport-courir.svg +1 -1
- imio/smartweb/core/browser/static/icons/categorie-sport-natation.svg +4 -0
- imio/smartweb/core/browser/static/icons/categorie-sport-velo.svg +1 -1
- imio/smartweb/core/browser/static/icons/categorie-tourisme.svg +1 -1
- imio/smartweb/core/browser/static/icons/organisation-academie-musique.svg +1 -1
- imio/smartweb/core/browser/static/icons/organisation-centre-sportif.svg +1 -1
- imio/smartweb/core/browser/static/icons/organisation-cpas.svg +1 -1
- imio/smartweb/core/browser/static/icons/organisation-ecole-des-arts.svg +1 -1
- imio/smartweb/core/browser/static/icons/organisation-ecole-sac.svg +4 -0
- imio/smartweb/core/browser/static/icons/organisation-ecole.svg +1 -1
- imio/smartweb/core/browser/static/icons/organisation-mobilite.svg +1 -1
- imio/smartweb/core/browser/static/icons/organisation-scout.svg +3 -0
- imio/smartweb/core/browser/static/icons/reseausocial-behance.svg +3 -0
- imio/smartweb/core/browser/static/icons/reseausocial-facebook.svg +1 -1
- imio/smartweb/core/browser/static/icons/reseausocial-linkedin.svg +3 -0
- imio/smartweb/core/browser/static/icons/reseausocial-twitter.svg +3 -13
- imio/smartweb/core/browser/static/icons/reseausocial-vimeo.svg +1 -1
- imio/smartweb/core/browser/static/icons/reseausocial-youtube.svg +1 -1
- imio/smartweb/core/browser/static/icons/vue-actualites.svg +1 -1
- imio/smartweb/core/browser/static/icons/vue-agenda.svg +1 -1
- imio/smartweb/core/browser/static/icons/vue-annuaire.svg +1 -1
- imio/smartweb/core/browser/static/smartweb-edit-compiled.css +1 -1
- imio/smartweb/core/browser/static/smartweb-edit-compiled.js +1 -1
- imio/smartweb/core/browser/static/smartweb-view-compiled.css +1 -1
- imio/smartweb/core/browser/static/smartweb-view-compiled.js +1 -1
- imio/smartweb/core/browser/static/src/edit.js +5 -0
- imio/smartweb/core/browser/static/src/edit.less +42 -0
- imio/smartweb/core/browser/static/src/view.js +11 -0
- imio/smartweb/core/browser/static/src/view.less +4 -0
- imio/smartweb/core/browser/utils.py +5 -32
- imio/smartweb/core/browser/vocabulary.py +40 -0
- imio/smartweb/core/contents/__init__.py +4 -0
- imio/smartweb/core/contents/configure.zcml +1 -0
- imio/smartweb/core/contents/cropping.py +1 -1
- imio/smartweb/core/contents/folder/block_view.pt +8 -8
- imio/smartweb/core/contents/folder/summary_view.pt +4 -4
- imio/smartweb/core/contents/pages/cirkwi/content.py +5 -0
- imio/smartweb/core/contents/pages/cirkwi/view.py +2 -1
- imio/smartweb/core/contents/pages/portal_page/view.py +3 -0
- imio/smartweb/core/contents/pages/views.py +3 -1
- imio/smartweb/core/contents/publication/configure.zcml +5 -0
- imio/smartweb/core/contents/publication/content.py +23 -0
- imio/smartweb/core/contents/rest/base.py +24 -10
- imio/smartweb/core/contents/rest/configure.zcml +7 -0
- imio/smartweb/core/contents/rest/directory/content.py +2 -2
- imio/smartweb/core/contents/rest/directory/endpoint.py +2 -2
- imio/smartweb/core/contents/rest/directory/view.pt +3 -1
- imio/smartweb/core/contents/rest/directory/view.py +3 -0
- imio/smartweb/core/contents/rest/events/content.py +15 -2
- imio/smartweb/core/contents/rest/events/endpoint.py +5 -7
- imio/smartweb/core/contents/rest/events/view.pt +6 -1
- imio/smartweb/core/contents/rest/events/view.py +15 -0
- imio/smartweb/core/contents/rest/news/content.py +8 -2
- imio/smartweb/core/contents/rest/news/endpoint.py +4 -2
- imio/smartweb/core/contents/rest/news/view.pt +5 -1
- imio/smartweb/core/contents/rest/news/view.py +11 -0
- imio/smartweb/core/contents/rest/search/endpoint.py +4 -4
- imio/smartweb/core/contents/rest/traversal.py +18 -0
- imio/smartweb/core/contents/rest/utils.py +98 -0
- imio/smartweb/core/contents/rest/view.py +11 -0
- imio/smartweb/core/contents/sections/common_templates/carousel.pt +6 -2
- imio/smartweb/core/contents/sections/common_templates/table.pt +22 -8
- imio/smartweb/core/contents/sections/configure.zcml +18 -0
- imio/smartweb/core/contents/sections/contact/content.py +2 -2
- imio/smartweb/core/contents/sections/contact/utils.py +2 -154
- imio/smartweb/core/contents/sections/events/content.py +12 -4
- imio/smartweb/core/contents/sections/events/view.py +20 -2
- imio/smartweb/core/contents/sections/external_content/configure.zcml +29 -0
- imio/smartweb/core/contents/sections/external_content/view.pt +25 -7
- imio/smartweb/core/contents/sections/external_content/view_idelux_waste.pt +50 -0
- imio/smartweb/core/contents/sections/external_content/view_inbw_containers_affluence.pt +91 -0
- imio/smartweb/core/contents/sections/external_content/view_odwb_widget.pt +20 -0
- imio/smartweb/core/contents/sections/external_content/views.py +306 -125
- imio/smartweb/core/contents/sections/files/content.py +7 -1
- imio/smartweb/core/contents/sections/files/view.py +40 -12
- imio/smartweb/core/contents/sections/links/view.py +5 -0
- imio/smartweb/core/contents/sections/macros.pt +39 -9
- imio/smartweb/core/contents/sections/news/content.py +11 -3
- imio/smartweb/core/contents/sections/news/view.py +20 -2
- imio/smartweb/core/contents/sections/text/view.pt +5 -4
- imio/smartweb/core/contents/sections/text/views.py +2 -0
- imio/smartweb/core/contents/sections/views.py +81 -4
- imio/smartweb/core/interfaces.py +15 -0
- imio/smartweb/core/profiles/default/actions.xml +15 -0
- imio/smartweb/core/profiles/default/diff_tool.xml +8 -0
- imio/smartweb/core/profiles/default/metadata.xml +1 -1
- imio/smartweb/core/profiles/default/registry/plone.xml +21 -4
- imio/smartweb/core/profiles/default/repositorytool.xml +1 -0
- imio/smartweb/core/profiles/default/taxonomies/page_category.xml +16 -0
- imio/smartweb/core/profiles/default/taxonomies/procedure_category.xml +26 -0
- imio/smartweb/core/profiles/default/types/Collection.xml +13 -0
- imio/smartweb/core/profiles/default/types/File.xml +13 -0
- imio/smartweb/core/profiles/default/types/Image.xml +13 -0
- imio/smartweb/core/profiles/default/types/imio.smartweb.BlockLink.xml +5 -0
- imio/smartweb/core/profiles/default/types/imio.smartweb.CirkwiView.xml +1 -0
- imio/smartweb/core/profiles/default/types/imio.smartweb.DirectoryView.xml +1 -0
- imio/smartweb/core/profiles/default/types/imio.smartweb.EventsView.xml +2 -0
- imio/smartweb/core/profiles/default/types/imio.smartweb.Folder.xml +1 -0
- imio/smartweb/core/profiles/default/types/imio.smartweb.NewsView.xml +2 -0
- imio/smartweb/core/profiles/default/types/imio.smartweb.Page.xml +1 -0
- imio/smartweb/core/profiles/default/types/imio.smartweb.PortalPage.xml +1 -0
- imio/smartweb/core/profiles/default/types/imio.smartweb.Procedure.xml +1 -0
- imio/smartweb/core/profiles/default/types/imio.smartweb.Publication.xml +38 -0
- imio/smartweb/core/profiles/default/types/imio.smartweb.SectionEvents.xml +1 -0
- imio/smartweb/core/profiles/default/types/imio.smartweb.SectionFiles.xml +2 -0
- imio/smartweb/core/profiles/default/types/imio.smartweb.SectionHTML.xml +0 -1
- imio/smartweb/core/profiles/default/types/imio.smartweb.SectionNews.xml +1 -0
- imio/smartweb/core/profiles/default/types.xml +1 -0
- imio/smartweb/core/profiles/icons/basic/registry.xml +120 -0
- imio/smartweb/core/profiles/testing/types/imio.smartweb.DirectoryView.xml +11 -0
- imio/smartweb/core/profiles/testing/types/imio.smartweb.EventsView.xml +11 -0
- imio/smartweb/core/profiles/testing/types/imio.smartweb.NewsView.xml +11 -0
- imio/smartweb/core/profiles/validation/contentrules.xml +102 -0
- imio/smartweb/core/profiles.zcml +8 -0
- imio/smartweb/core/rest/authentic_sources.py +23 -11
- imio/smartweb/core/subscribers.py +24 -0
- imio/smartweb/core/subscribers.zcml +4 -0
- imio/smartweb/core/tests/resources/json_iadeliberations_institutions.json +60 -0
- imio/smartweb/core/tests/resources/json_iadeliberations_publication.json +105 -0
- imio/smartweb/core/tests/resources/json_iadeliberations_publications.json +270 -0
- imio/smartweb/core/tests/resources/json_rest_events.json +6 -2
- 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_cropping.py +4 -4
- imio/smartweb/core/tests/test_htmx_in_sections.py +131 -0
- imio/smartweb/core/tests/test_iadeliberations.py +136 -0
- imio/smartweb/core/tests/test_icons.py +1 -1
- imio/smartweb/core/tests/test_redirect_to_main_react_view.py +79 -0
- imio/smartweb/core/tests/test_rest.py +283 -22
- imio/smartweb/core/tests/test_section_contact.py +2 -2
- imio/smartweb/core/tests/test_section_events.py +28 -5
- imio/smartweb/core/tests/test_section_external_content.py +26 -25
- imio/smartweb/core/tests/test_section_news.py +30 -8
- imio/smartweb/core/tests/test_sections.py +38 -15
- imio/smartweb/core/tests/test_sitemap.py +174 -0
- imio/smartweb/core/tests/test_vocabularies.py +61 -4
- imio/smartweb/core/tests/test_vocabulary.py +43 -0
- imio/smartweb/core/tests/utils.py +15 -0
- imio/smartweb/core/upgrades/configure.zcml +180 -0
- imio/smartweb/core/upgrades/profiles/1051_to_1052/actions.xml +20 -0
- imio/smartweb/core/upgrades/profiles/1052_to_1053/diff_tool.xml +8 -0
- imio/smartweb/core/upgrades/profiles/1052_to_1053/repositorytool.xml +9 -0
- imio/smartweb/core/upgrades/profiles/1052_to_1053/types/imio.smartweb.SectionHTML.xml +14 -0
- imio/smartweb/core/upgrades/profiles/1053_to_1054/registry.xml +39 -0
- imio/smartweb/core/upgrades/profiles/1054_to_1055/types/Collection.xml +13 -0
- imio/smartweb/core/upgrades/profiles/1054_to_1055/types/File.xml +13 -0
- imio/smartweb/core/upgrades/profiles/1054_to_1055/types/Image.xml +13 -0
- imio/smartweb/core/upgrades/profiles/1054_to_1055/types/imio.smartweb.BlockLink.xml +12 -0
- imio/smartweb/core/upgrades/profiles/1054_to_1055/types/imio.smartweb.CirkwiView.xml +12 -0
- imio/smartweb/core/upgrades/profiles/1054_to_1055/types/imio.smartweb.DirectoryView.xml +12 -0
- imio/smartweb/core/upgrades/profiles/1054_to_1055/types/imio.smartweb.EventsView.xml +12 -0
- imio/smartweb/core/upgrades/profiles/1054_to_1055/types/imio.smartweb.Folder.xml +12 -0
- imio/smartweb/core/upgrades/profiles/1054_to_1055/types/imio.smartweb.NewsView.xml +12 -0
- imio/smartweb/core/upgrades/profiles/1054_to_1055/types/imio.smartweb.Page.xml +12 -0
- imio/smartweb/core/upgrades/profiles/1054_to_1055/types/imio.smartweb.PortalPage.xml +12 -0
- imio/smartweb/core/upgrades/profiles/1054_to_1055/types/imio.smartweb.Procedure.xml +12 -0
- imio/smartweb/core/upgrades/profiles/1055_to_1056/types/imio.smartweb.SectionFiles.xml +12 -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/upgrades/profiles/1057_to_1058/taxonomies/page_category.cfg +9 -0
- imio/smartweb/core/upgrades/profiles/1057_to_1058/taxonomies/page_category.xml +73 -0
- imio/smartweb/core/upgrades/profiles/1057_to_1058/taxonomies/procedure_category.cfg +9 -0
- imio/smartweb/core/upgrades/profiles/1057_to_1058/taxonomies/procedure_category.xml +118 -0
- imio/smartweb/core/upgrades/profiles/1058_to_1059/registry/linkedin-icon.xml +126 -0
- imio/smartweb/core/upgrades/profiles/1059_to_1060/registry/iadeliberation.xml +9 -0
- imio/smartweb/core/upgrades/profiles/1060_to_1061/types/imio.smartweb.Publication.xml +38 -0
- imio/smartweb/core/upgrades/profiles/1060_to_1061/types/imio.smartweb.SectionFiles.xml +11 -0
- imio/smartweb/core/upgrades/profiles/1060_to_1061/types.xml +4 -0
- imio/smartweb/core/upgrades/profiles/1060_to_1061/workflows.xml +6 -0
- imio/smartweb/core/utils.py +65 -3
- imio/smartweb/core/viewlets/configure.zcml +43 -0
- imio/smartweb/core/viewlets/external_content.py +13 -5
- imio/smartweb/core/viewlets/footer.pt +5 -0
- imio/smartweb/core/viewlets/footer.py +5 -0
- imio/smartweb/core/viewlets/htmx.py +15 -0
- imio/smartweb/core/viewlets/htmx_js_header.pt +59 -0
- imio/smartweb/core/viewlets/httpheaders.py +13 -0
- imio/smartweb/core/viewlets/odwb_widget_header.pt +19 -0
- imio/smartweb/core/viewlets/offcanvas.pt +2 -1
- imio/smartweb/core/viewlets/ogp_tag_header.pt +19 -0
- imio/smartweb/core/viewlets/ogptags.py +144 -0
- imio/smartweb/core/viewlets/social.py +23 -0
- imio/smartweb/core/vocabularies.py +66 -2
- imio/smartweb/core/vocabularies.zcml +18 -0
- imio/smartweb/core/webcomponents/build/1c1605a5fe9a2b10a88f.png +1 -0
- imio/smartweb/core/webcomponents/build/524db40e119aa11f4478.png +1 -0
- imio/smartweb/core/webcomponents/build/57d3b7cb1ab874660b39.svg +1 -0
- imio/smartweb/core/webcomponents/build/6cf03871df23ed2ee8b3.png +1 -0
- imio/smartweb/core/webcomponents/build/css/373.smartweb-webcomponents-compiled.css +1 -0
- imio/smartweb/core/webcomponents/build/css/486.smartweb-webcomponents-compiled.css +1 -0
- imio/smartweb/core/webcomponents/build/css/884.smartweb-webcomponents-compiled.css +1 -0
- imio/smartweb/core/webcomponents/build/css/919.smartweb-webcomponents-compiled.css +1 -0
- imio/smartweb/core/webcomponents/build/css/smartweb-webcomponents-compiled.css +1 -1
- imio/smartweb/core/webcomponents/build/js/218.smartweb-webcomponents-compiled.js +2 -0
- imio/smartweb/core/webcomponents/build/js/218.smartweb-webcomponents-compiled.js.LICENSE.txt +16 -0
- imio/smartweb/core/webcomponents/build/js/373.smartweb-webcomponents-compiled.js +2 -0
- imio/smartweb/core/webcomponents/build/js/373.smartweb-webcomponents-compiled.js.LICENSE.txt +10 -0
- imio/smartweb/core/webcomponents/build/js/486.smartweb-webcomponents-compiled.js +1 -0
- imio/smartweb/core/webcomponents/build/js/499.smartweb-webcomponents-compiled.js +2 -0
- imio/smartweb/core/webcomponents/build/js/{212.smartweb-webcomponents-compiled.js.LICENSE.txt → 499.smartweb-webcomponents-compiled.js.LICENSE.txt} +1 -8
- imio/smartweb/core/webcomponents/build/js/799.smartweb-webcomponents-compiled.js +2 -0
- imio/smartweb/core/webcomponents/build/js/824.smartweb-webcomponents-compiled.js +2 -0
- imio/smartweb/core/webcomponents/build/js/828.smartweb-webcomponents-compiled.js +2 -0
- imio/smartweb/core/webcomponents/build/js/828.smartweb-webcomponents-compiled.js.LICENSE.txt +32 -0
- imio/smartweb/core/webcomponents/build/js/884.smartweb-webcomponents-compiled.js +1 -0
- imio/smartweb/core/webcomponents/build/js/919.smartweb-webcomponents-compiled.js +1 -0
- imio/smartweb/core/webcomponents/build/js/963.smartweb-webcomponents-compiled.js +2 -0
- 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/build/js/smartweb-webcomponents-compiled.js.LICENSE.txt +11 -14
- imio/smartweb/core/webcomponents/package.json +46 -44
- imio/smartweb/core/webcomponents/src/assets/contentIcon/download.svg +1 -0
- imio/smartweb/core/webcomponents/src/components/Annuaire/Annuaire.jsx +160 -92
- imio/smartweb/core/webcomponents/src/components/Annuaire/Annuaire.scss +250 -157
- imio/smartweb/core/webcomponents/src/components/Annuaire/ContactCard/ContactCard.jsx +113 -81
- imio/smartweb/core/webcomponents/src/components/Annuaire/ContactContent/ContactContent.jsx +394 -188
- imio/smartweb/core/webcomponents/src/components/Annuaire/ContactList/ContactList.jsx +26 -9
- imio/smartweb/core/webcomponents/src/components/Annuaire/Filters/Filter.jsx +213 -100
- imio/smartweb/core/webcomponents/src/components/Annuaire/index.js +1 -1
- imio/smartweb/core/webcomponents/src/components/Events/EventCard/EventCard.jsx +86 -0
- imio/smartweb/core/webcomponents/src/components/Events/EventContent/EventContent.jsx +615 -0
- imio/smartweb/core/webcomponents/src/components/Events/EventList/EventList.jsx +67 -0
- imio/smartweb/core/webcomponents/src/components/Events/Events.jsx +181 -103
- imio/smartweb/core/webcomponents/src/components/Events/Events.scss +316 -182
- imio/smartweb/core/webcomponents/src/components/Events/Filters/Filter.jsx +275 -80
- imio/smartweb/core/webcomponents/src/components/Filters/DateFilter.jsx +136 -0
- imio/smartweb/core/webcomponents/src/components/Filters/DateFilter.scss +104 -0
- imio/smartweb/core/webcomponents/src/components/Filters/IamData.jsx +42 -0
- imio/smartweb/core/webcomponents/src/components/Filters/MainFilter.scss +227 -0
- imio/smartweb/core/webcomponents/src/components/Filters/PublicTargetData.jsx +94 -0
- imio/smartweb/core/webcomponents/src/components/Filters/SelectStyles.js +58 -0
- imio/smartweb/core/webcomponents/src/components/Filters/TaxonomyFilter.jsx +149 -0
- imio/smartweb/core/webcomponents/src/components/Filters/TaxonomyFilter.scss +70 -0
- imio/smartweb/core/webcomponents/src/components/News/Filters/Filter.jsx +139 -83
- imio/smartweb/core/webcomponents/src/components/News/News.jsx +141 -74
- imio/smartweb/core/webcomponents/src/components/News/News.scss +41 -15
- imio/smartweb/core/webcomponents/src/components/News/NewsCard/NewsCard.jsx +96 -0
- imio/smartweb/core/webcomponents/src/components/News/NewsContent/NewsContent.jsx +309 -0
- imio/smartweb/core/webcomponents/src/components/News/NewsList/NewsList.jsx +76 -0
- imio/smartweb/core/webcomponents/src/components/Search/ContactResult/ContactResult.jsx +28 -14
- imio/smartweb/core/webcomponents/src/components/Search/EventsResult/EventsResult.jsx +28 -14
- imio/smartweb/core/webcomponents/src/components/Search/Filters/Filter.jsx +51 -32
- imio/smartweb/core/webcomponents/src/components/Search/NewsResult/NewsResult.jsx +29 -15
- imio/smartweb/core/webcomponents/src/components/Search/Search.jsx +18 -13
- imio/smartweb/core/webcomponents/src/components/Search/Search.scss +125 -105
- imio/smartweb/core/webcomponents/src/components/Search/WebResult/WebResult.jsx +19 -6
- imio/smartweb/core/webcomponents/src/components/Search/index.js +1 -1
- imio/smartweb/core/webcomponents/src/hooks/ScrollContext.jsx +3 -0
- imio/smartweb/core/webcomponents/src/hooks/useAxios.js +3 -6
- imio/smartweb/core/webcomponents/src/hooks/useFilterQuery.js +1 -2
- imio/smartweb/core/webcomponents/src/index.scss +246 -211
- imio/smartweb/core/webcomponents/src/utils/Map.jsx +159 -0
- imio/smartweb/core/webcomponents/src/{components/Annuaire/ContactMap/ContactMap.scss → utils/Map.scss} +2 -2
- imio/smartweb/core/webcomponents/src/utils/translation.js +283 -14
- imio.smartweb.core-1.2.68-py3.11-nspkg.pth +2 -0
- {imio.smartweb.core-1.2.12.dist-info → imio.smartweb.core-1.2.68.dist-info}/METADATA +548 -3
- {imio.smartweb.core-1.2.12.dist-info → imio.smartweb.core-1.2.68.dist-info}/RECORD +317 -240
- {imio.smartweb.core-1.2.12.dist-info → imio.smartweb.core-1.2.68.dist-info}/WHEEL +1 -1
- imio/smartweb/core/webcomponents/build/assets/location-bla.1423bcce16ddcb21141430cac1428dc1.svg +0 -1
- imio/smartweb/core/webcomponents/build/assets/next-react-white.819cb069ac8eec300a9db6a7707712d6.svg +0 -1
- imio/smartweb/core/webcomponents/build/assets/next-react.17bc43ff4a6a86f4520f5782f6a89a72.svg +0 -1
- imio/smartweb/core/webcomponents/build/assets/search.57bdbf5b191499cd77514097d1c4972c.svg +0 -1
- imio/smartweb/core/webcomponents/build/css/267.smartweb-webcomponents-compiled.css +0 -1
- imio/smartweb/core/webcomponents/build/css/323.smartweb-webcomponents-compiled.css +0 -1
- imio/smartweb/core/webcomponents/build/css/552.smartweb-webcomponents-compiled.css +0 -1
- imio/smartweb/core/webcomponents/build/css/779.smartweb-webcomponents-compiled.css +0 -1
- imio/smartweb/core/webcomponents/build/js/144.smartweb-webcomponents-compiled.js +0 -2
- imio/smartweb/core/webcomponents/build/js/212.smartweb-webcomponents-compiled.js +0 -2
- imio/smartweb/core/webcomponents/build/js/267.smartweb-webcomponents-compiled.js +0 -1
- imio/smartweb/core/webcomponents/build/js/323.smartweb-webcomponents-compiled.js +0 -2
- imio/smartweb/core/webcomponents/build/js/323.smartweb-webcomponents-compiled.js.LICENSE.txt +0 -1
- imio/smartweb/core/webcomponents/build/js/552.smartweb-webcomponents-compiled.js +0 -2
- imio/smartweb/core/webcomponents/build/js/552.smartweb-webcomponents-compiled.js.LICENSE.txt +0 -1
- imio/smartweb/core/webcomponents/build/js/565.smartweb-webcomponents-compiled.js +0 -1
- imio/smartweb/core/webcomponents/build/js/612.smartweb-webcomponents-compiled.js +0 -2
- imio/smartweb/core/webcomponents/build/js/612.smartweb-webcomponents-compiled.js.LICENSE.txt +0 -1
- imio/smartweb/core/webcomponents/build/js/779.smartweb-webcomponents-compiled.js +0 -1
- imio/smartweb/core/webcomponents/build/js/9.smartweb-webcomponents-compiled.js +0 -2
- imio/smartweb/core/webcomponents/build/js/969.smartweb-webcomponents-compiled.js +0 -2
- imio/smartweb/core/webcomponents/build/js/969.smartweb-webcomponents-compiled.js.LICENSE.txt +0 -642
- imio/smartweb/core/webcomponents/pnpm-lock.yaml +0 -7066
- imio/smartweb/core/webcomponents/src/assets/facebook-news.svg +0 -1
- imio/smartweb/core/webcomponents/src/assets/location-bla.svg +0 -1
- imio/smartweb/core/webcomponents/src/assets/next-react.svg +0 -1
- imio/smartweb/core/webcomponents/src/assets/search.svg +0 -1
- imio/smartweb/core/webcomponents/src/assets/skeleton.svg +0 -1
- imio/smartweb/core/webcomponents/src/components/Annuaire/ContactMap/ContactMap.jsx +0 -156
- imio/smartweb/core/webcomponents/src/components/Annuaire/Skeleton/LoaderCss.jsx +0 -7
- imio/smartweb/core/webcomponents/src/components/Annuaire/Skeleton/Skeleton.jsx +0 -20
- imio/smartweb/core/webcomponents/src/components/Events/ContactCard/ContactCard.jsx +0 -49
- imio/smartweb/core/webcomponents/src/components/Events/ContactContent/ContactContent.jsx +0 -400
- imio/smartweb/core/webcomponents/src/components/Events/ContactList/ContactList.jsx +0 -42
- imio/smartweb/core/webcomponents/src/components/Events/ContactMap/ContactMap.jsx +0 -156
- imio/smartweb/core/webcomponents/src/components/Events/Skeleton/Skeleton.jsx +0 -20
- imio/smartweb/core/webcomponents/src/components/News/ContactCard/ContactCard.jsx +0 -78
- imio/smartweb/core/webcomponents/src/components/News/ContactContent/ContactContent.jsx +0 -261
- imio/smartweb/core/webcomponents/src/components/News/ContactList/ContactList.jsx +0 -37
- imio/smartweb/core/webcomponents/src/components/News/ContactMap/ContactMap.jsx +0 -127
- imio/smartweb/core/webcomponents/src/components/News/ContactMap/ContactMap.scss +0 -4
- imio/smartweb/core/webcomponents/src/components/News/Skeleton/Skeleton.jsx +0 -20
- imio/smartweb/core/webcomponents/src/components/Search/Skeleton/Skeleton.jsx +0 -20
- imio.smartweb.core-1.2.12-py3.10-nspkg.pth +0 -3
- /imio/smartweb/core/{webcomponents/src/components/Events/ContactMap/ContactMap.scss → contents/publication/__init__.py} +0 -0
- /imio/smartweb/core/webcomponents/build/js/{144.smartweb-webcomponents-compiled.js.LICENSE.txt → 799.smartweb-webcomponents-compiled.js.LICENSE.txt} +0 -0
- /imio/smartweb/core/webcomponents/build/js/{9.smartweb-webcomponents-compiled.js.LICENSE.txt → 824.smartweb-webcomponents-compiled.js.LICENSE.txt} +0 -0
- {imio.smartweb.core-1.2.12.dist-info → imio.smartweb.core-1.2.68.dist-info}/LICENSE.GPL +0 -0
- {imio.smartweb.core-1.2.12.dist-info → imio.smartweb.core-1.2.68.dist-info}/LICENSE.rst +0 -0
- {imio.smartweb.core-1.2.12.dist-info → imio.smartweb.core-1.2.68.dist-info}/namespace_packages.txt +0 -0
- {imio.smartweb.core-1.2.12.dist-info → imio.smartweb.core-1.2.68.dist-info}/top_level.txt +0 -0
@@ -1,5 +1,6 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
|
3
|
+
from base64 import b64encode
|
3
4
|
from freezegun import freeze_time
|
4
5
|
from imio.smartweb.core import config
|
5
6
|
from imio.smartweb.core.contents.rest.base import BaseEndpoint
|
@@ -8,16 +9,22 @@ from imio.smartweb.core.contents.rest.events.endpoint import EventsEndpoint
|
|
8
9
|
from imio.smartweb.core.contents.rest.news.endpoint import NewsEndpoint
|
9
10
|
from imio.smartweb.core.testing import IMIO_SMARTWEB_CORE_ACCEPTANCE_TESTING
|
10
11
|
from imio.smartweb.core.testing import ImioSmartwebTestCase
|
12
|
+
from imio.smartweb.core.tests.utils import FakeResponse
|
11
13
|
from imio.smartweb.core.tests.utils import get_json
|
14
|
+
from imio.smartweb.core.tests.utils import make_named_image
|
12
15
|
from plone import api
|
13
16
|
from plone.app.testing import setRoles
|
14
17
|
from plone.app.testing import TEST_USER_ID
|
18
|
+
from plone.app.testing import TEST_USER_PASSWORD
|
19
|
+
from plone.namedfile.file import NamedBlobImage
|
15
20
|
from plone.restapi.testing import RelativeSession
|
16
21
|
from unittest.mock import patch
|
17
22
|
from urllib.parse import urlparse
|
18
23
|
from urllib.parse import parse_qs
|
19
24
|
from zope.component import queryMultiAdapter
|
25
|
+
from zope.event import notify
|
20
26
|
from zope.publisher.browser import TestRequest
|
27
|
+
from ZPublisher.pubevents import PubStart
|
21
28
|
|
22
29
|
import json
|
23
30
|
import requests_mock
|
@@ -73,6 +80,21 @@ class SectionsFunctionalTest(ImioSmartwebTestCase):
|
|
73
80
|
def tearDown(self):
|
74
81
|
self.api_session.close()
|
75
82
|
|
83
|
+
def traverse(self, path="/plone", method="GET"):
|
84
|
+
request = self.layer["request"]
|
85
|
+
request.environ["PATH_INFO"] = path
|
86
|
+
request.environ["PATH_TRANSLATED"] = path
|
87
|
+
request.environ["HTTP_ACCEPT"] = "application/json"
|
88
|
+
request.environ["REQUEST_METHOD"] = method
|
89
|
+
request.other["ACTUAL_URL"] = ""
|
90
|
+
request.other["URL"] = ""
|
91
|
+
request.method = method
|
92
|
+
request.form = {}
|
93
|
+
auth = f"{TEST_USER_ID}:{TEST_USER_PASSWORD}"
|
94
|
+
request._auth = "Basic %s" % b64encode(auth.encode("utf8")).decode("utf8")
|
95
|
+
notify(PubStart(request))
|
96
|
+
return request.traverse(path)
|
97
|
+
|
76
98
|
@freeze_time("2021-09-14 8:00:00")
|
77
99
|
def test_convert_cached_image_scales(self):
|
78
100
|
endpoint = BaseEndpoint(self.portal, self.request)
|
@@ -112,34 +134,37 @@ class SectionsFunctionalTest(ImioSmartwebTestCase):
|
|
112
134
|
endpoint.convert_cached_image_scales(item, modified_hash)
|
113
135
|
self.assertEqual(len(item.keys()), 6)
|
114
136
|
|
115
|
-
def
|
137
|
+
def test_construct_query_string(self):
|
138
|
+
request = TestRequest()
|
139
|
+
endpoint = DirectoryEndpoint(self.portal, request)
|
140
|
+
query = endpoint.construct_query_string([])
|
141
|
+
self.assertEqual(query, "translated_in_en=1")
|
142
|
+
|
143
|
+
query = endpoint.construct_query_string(["param=1", "param2=2"])
|
144
|
+
self.assertEqual(query, "param=1¶m2=2&translated_in_en=1")
|
145
|
+
|
116
146
|
request = TestRequest(
|
117
147
|
form={"taxonomy_contact_category": '("token")', "topics": "education"}
|
118
148
|
)
|
119
149
|
endpoint = DirectoryEndpoint(self.portal, request)
|
120
|
-
|
150
|
+
query = endpoint.construct_query_string([])
|
121
151
|
self.assertEqual(
|
122
|
-
|
123
|
-
|
124
|
-
'taxonomy_contact_category=("token")',
|
125
|
-
"topics=education",
|
126
|
-
"translated_in_en=1",
|
127
|
-
],
|
152
|
+
query,
|
153
|
+
"taxonomy_contact_category=%28%22token%22%29&topics=education&translated_in_en=1",
|
128
154
|
)
|
129
155
|
|
130
156
|
request = TestRequest(
|
131
|
-
form={
|
157
|
+
form={
|
158
|
+
"topics": "education",
|
159
|
+
"metadata_fields": ["topics", "category"],
|
160
|
+
"local_category": "Local & category",
|
161
|
+
}
|
132
162
|
)
|
133
163
|
endpoint = DirectoryEndpoint(self.portal, request)
|
134
|
-
|
164
|
+
query = endpoint.construct_query_string([])
|
135
165
|
self.assertEqual(
|
136
|
-
|
137
|
-
|
138
|
-
"topics=education",
|
139
|
-
"metadata_fields=topics",
|
140
|
-
"metadata_fields=category",
|
141
|
-
"translated_in_en=1",
|
142
|
-
],
|
166
|
+
query,
|
167
|
+
"topics=education&metadata_fields=topics&metadata_fields=category&local_category=Local+%26+category&translated_in_en=1",
|
143
168
|
)
|
144
169
|
|
145
170
|
@requests_mock.Mocker()
|
@@ -215,9 +240,109 @@ class SectionsFunctionalTest(ImioSmartwebTestCase):
|
|
215
240
|
"translated_in_en=1",
|
216
241
|
)
|
217
242
|
|
218
|
-
def
|
219
|
-
|
220
|
-
|
243
|
+
def test_render_rest_auth_sources(self):
|
244
|
+
"""og:tags on rest view"""
|
245
|
+
|
246
|
+
auth_sources = [
|
247
|
+
{"name": "annuaire", "content": self.rest_directory},
|
248
|
+
{"name": "actualites", "content": self.rest_news},
|
249
|
+
{"name": "agenda", "content": self.rest_events},
|
250
|
+
]
|
251
|
+
for auth_source in auth_sources:
|
252
|
+
view = queryMultiAdapter(
|
253
|
+
(auth_source["content"], self.request), name="view"
|
254
|
+
)
|
255
|
+
self.assertEqual(view().count('<meta property="og:title"'), 1)
|
256
|
+
self.assertIn(
|
257
|
+
f'<meta property="og:title" content="{auth_source["content"].title}">',
|
258
|
+
view(),
|
259
|
+
)
|
260
|
+
self.assertIn('<meta property="og:description" content="">', view())
|
261
|
+
self.assertIn('<meta property="og:site_name" content="Plone site">', view())
|
262
|
+
self.assertNotIn('<meta property="og:image" content="">', view())
|
263
|
+
self.assertNotIn('<meta property="og:image:type" content="">', view())
|
264
|
+
self.assertIn('<meta property="og:image:alt" content="">', view())
|
265
|
+
self.assertNotIn('<meta property="og:image:width" content="">', view())
|
266
|
+
self.assertNotIn('<meta property="og:image:height">', view())
|
267
|
+
self.assertIn('<meta property="og:type" content="website">', view())
|
268
|
+
|
269
|
+
auth_source["content"].description = "Kamoulox"
|
270
|
+
auth_source["content"].image = NamedBlobImage(**make_named_image())
|
271
|
+
view = queryMultiAdapter(
|
272
|
+
(auth_source["content"], self.request), name="view"
|
273
|
+
)
|
274
|
+
self.assertIn('<meta property="og:description" content="Kamoulox">', view())
|
275
|
+
pattern = r'<meta property="og:image" content="http://localhost:\d+/plone/{}/@@images/image/paysage_vignette\?cache_key=[a-zA-Z0-9]+">'.format(
|
276
|
+
auth_source["content"].id
|
277
|
+
)
|
278
|
+
self.assertRegex(view(), pattern)
|
279
|
+
self.assertIn('<meta property="og:image:type" content="image/png">', view())
|
280
|
+
self.assertIn('<meta property="og:image:alt" content="">', view())
|
281
|
+
self.assertIn('<meta property="og:image:width" content="400">', view())
|
282
|
+
self.assertIn('<meta property="og:image:height" content="400">', view())
|
283
|
+
|
284
|
+
@patch("imio.smartweb.core.viewlets.ogptags.get_wca_token")
|
285
|
+
@patch("imio.smartweb.core.viewlets.ogptags.get_json")
|
286
|
+
def test_render_rest_auth_sources_item(self, mock_get_json, mock_get_wca_token):
|
287
|
+
"""og:tags on an item in a rest view"""
|
288
|
+
|
289
|
+
auth_sources = [
|
290
|
+
{"name": "annuaire", "content": self.rest_directory},
|
291
|
+
{"name": "actualites", "content": self.rest_news},
|
292
|
+
{"name": "agenda", "content": self.rest_events},
|
293
|
+
]
|
294
|
+
for auth_source in auth_sources:
|
295
|
+
mock_get_wca_token.return_value = "kamoulox"
|
296
|
+
mock_get_json.return_value = {
|
297
|
+
"items": [
|
298
|
+
{
|
299
|
+
"title": "kamoulox",
|
300
|
+
"description": "kamoulox description",
|
301
|
+
"url": f'https://{auth_source["name"]}.preprod.imio.be/braine-l-alleud/d63d28c478bb4269b77e1ceae8410cc5',
|
302
|
+
}
|
303
|
+
]
|
304
|
+
}
|
305
|
+
UID = "3c436a800154449f84797fdb30561297"
|
306
|
+
self.request.form["u"] = UID
|
307
|
+
view = queryMultiAdapter(
|
308
|
+
(auth_source["content"], self.request), name="view"
|
309
|
+
)
|
310
|
+
self.assertEqual(view().count('<meta property="og:title"'), 1)
|
311
|
+
self.assertIn('<meta property="og:title" content="kamoulox">', view())
|
312
|
+
self.assertIn(
|
313
|
+
'<meta property="og:description" content="kamoulox description">',
|
314
|
+
view(),
|
315
|
+
)
|
316
|
+
self.assertNotIn('<meta property="og:image"', view())
|
317
|
+
self.assertNotIn('<meta property="og:image:type"', view())
|
318
|
+
self.assertIn('<meta property="og:image:alt" content="">', view())
|
319
|
+
self.assertNotIn('<meta property="og:image:width"', view())
|
320
|
+
self.assertNotIn('<meta property="og:image:height"', view())
|
321
|
+
default_scale = "paysage_vignette"
|
322
|
+
mock_get_json.return_value["items"][0]["image"] = {
|
323
|
+
"download": f'https://{auth_source["name"]}.preprod.imio.be/braine-lalleud/citoyens/d448b0c80f0e4c57819bf23e6281aa98/@@images/image-400-b963678cd2367410ceec02428ebe093e.jpg',
|
324
|
+
"filename": "kamoulox.jpg",
|
325
|
+
"content-type": "image/jpeg",
|
326
|
+
"scales": {
|
327
|
+
default_scale: {
|
328
|
+
"width": "400",
|
329
|
+
"height": "400",
|
330
|
+
}
|
331
|
+
},
|
332
|
+
}
|
333
|
+
view = queryMultiAdapter(
|
334
|
+
(auth_source["content"], self.request), name="view"
|
335
|
+
)
|
336
|
+
self.assertIn(
|
337
|
+
f'<meta property="og:image" content="https://{auth_source["name"]}.preprod.imio.be/braine-lalleud/citoyens/d448b0c80f0e4c57819bf23e6281aa98/@@images/image-400-b963678cd2367410ceec02428ebe093e.jpg">',
|
338
|
+
view(),
|
339
|
+
)
|
340
|
+
self.assertIn(
|
341
|
+
'<meta property="og:image:type" content="image/jpeg">', view()
|
342
|
+
)
|
343
|
+
self.assertIn('<meta property="og:image:alt" content="">', view())
|
344
|
+
self.assertIn('<meta property="og:image:width" content="400">', view())
|
345
|
+
self.assertIn('<meta property="og:image:height" content="400">', view())
|
221
346
|
|
222
347
|
def test_rest_directory_results(self):
|
223
348
|
params = {}
|
@@ -247,13 +372,13 @@ class SectionsFunctionalTest(ImioSmartwebTestCase):
|
|
247
372
|
"http://localhost:8080/Plone/@events?"
|
248
373
|
"selected_agendas={}&"
|
249
374
|
"metadata_fields=category&"
|
375
|
+
"metadata_fields=local_category&"
|
376
|
+
"metadata_fields=container_uid&"
|
250
377
|
"metadata_fields=topics&"
|
251
378
|
"metadata_fields=start&"
|
252
379
|
"metadata_fields=end&"
|
253
380
|
"metadata_fields=has_leadimage&"
|
254
381
|
"metadata_fields=UID&"
|
255
|
-
"event_dates.query=2021-11-15&"
|
256
|
-
"event_dates.range=min&"
|
257
382
|
"sort_on=event_dates&"
|
258
383
|
"fullobjects=1&"
|
259
384
|
"b_size=20&"
|
@@ -305,6 +430,8 @@ class SectionsFunctionalTest(ImioSmartwebTestCase):
|
|
305
430
|
"selected_news_folders={}&"
|
306
431
|
"portal_type=imio.news.NewsItem&"
|
307
432
|
"metadata_fields=category&"
|
433
|
+
"metadata_fields=local_category&"
|
434
|
+
"metadata_fields=container_uid&"
|
308
435
|
"metadata_fields=topics&"
|
309
436
|
"metadata_fields=has_leadimage&"
|
310
437
|
"metadata_fields=UID&"
|
@@ -366,3 +493,137 @@ class SectionsFunctionalTest(ImioSmartwebTestCase):
|
|
366
493
|
self.rest_events.display_map = True
|
367
494
|
view = queryMultiAdapter((self.rest_events, self.request), name="view")
|
368
495
|
self.assertIn('display-map="True"', view())
|
496
|
+
|
497
|
+
def test_show_categories_or_topics(self):
|
498
|
+
rest_events = api.content.create(
|
499
|
+
container=self.portal,
|
500
|
+
type="imio.smartweb.EventsView",
|
501
|
+
title="events view",
|
502
|
+
)
|
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 = "category"
|
506
|
+
view = queryMultiAdapter((rest_events, self.request), name="view")
|
507
|
+
self.assertIn('show-categories-or-topics="category"', view())
|
508
|
+
rest_events.show_categories_or_topics = "topic"
|
509
|
+
view = queryMultiAdapter((rest_events, self.request), name="view")
|
510
|
+
self.assertIn('show-categories-or-topics="topic"', view())
|
511
|
+
rest_events.show_categories_or_topics = ""
|
512
|
+
view = queryMultiAdapter((rest_events, self.request), name="view")
|
513
|
+
self.assertIn('show-categories-or-topics=""', view())
|
514
|
+
rest_news = api.content.create(
|
515
|
+
container=self.portal,
|
516
|
+
type="imio.smartweb.NewsView",
|
517
|
+
title="news view",
|
518
|
+
)
|
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 = "category"
|
522
|
+
view = queryMultiAdapter((rest_news, self.request), name="view")
|
523
|
+
self.assertIn('show-categories-or-topics="category"', view())
|
524
|
+
rest_news.show_categories_or_topics = "topic"
|
525
|
+
view = queryMultiAdapter((rest_news, self.request), name="view")
|
526
|
+
self.assertIn('show-categories-or-topics="topic"', view())
|
527
|
+
rest_news.show_categories_or_topics = ""
|
528
|
+
view = queryMultiAdapter((rest_news, self.request), name="view")
|
529
|
+
self.assertIn('show-categories-or-topics=""', view())
|
530
|
+
|
531
|
+
@patch("imio.smartweb.core.rest.authentic_sources.get_wca_token")
|
532
|
+
@patch("imio.smartweb.core.rest.authentic_sources.requests.request")
|
533
|
+
@patch("imio.smartweb.core.rest.authentic_sources.get_default_view_url")
|
534
|
+
def test_request_forwarder(self, mock_view_url, mock_request, mock_get_wca_token):
|
535
|
+
mock_view_url.return_value = "http://view-url"
|
536
|
+
mock_get_wca_token.return_value = "kamoulox"
|
537
|
+
mock_request.return_value = FakeResponse(
|
538
|
+
status_code=200,
|
539
|
+
headers={"test-header": "True"},
|
540
|
+
)
|
541
|
+
|
542
|
+
# traversal stack
|
543
|
+
service = self.traverse("/plone/@news_request_forwarder/belleville/@search")
|
544
|
+
self.assertListEqual(service.traversal_stack, ["belleville", "@search"])
|
545
|
+
|
546
|
+
# add_smartweb_urls
|
547
|
+
json_data = {}
|
548
|
+
self.assertEqual(service.add_smartweb_urls(json_data), json_data)
|
549
|
+
json_data = {"foo": "bar"}
|
550
|
+
self.assertEqual(service.add_smartweb_urls(json_data), json_data)
|
551
|
+
json_data = {"@id": "http://news/my-news"}
|
552
|
+
self.assertEqual(service.add_smartweb_urls(json_data), json_data)
|
553
|
+
json_data = {"@id": "http://news/my-news", "UID": "12345678"}
|
554
|
+
json_result = service.add_smartweb_urls(json_data)
|
555
|
+
self.assertEqual(
|
556
|
+
json_result["smartweb_url"], "http://view-url/content?u=12345678"
|
557
|
+
)
|
558
|
+
json_data = {"items": []}
|
559
|
+
self.assertEqual(service.add_smartweb_urls(json_data), json_data)
|
560
|
+
json_data = {"items": [{"@id": "http://news/my-news"}]}
|
561
|
+
self.assertEqual(service.add_smartweb_urls(json_data), json_data)
|
562
|
+
json_data = {"items": [{"@id": "http://news/my-news", "UID": "12345678"}]}
|
563
|
+
json_result = service.add_smartweb_urls(json_data)
|
564
|
+
self.assertIn("smartweb_url", json_result["items"][0])
|
565
|
+
self.assertEqual(
|
566
|
+
json_data["items"][0]["smartweb_url"], "http://view-url/content?u=12345678"
|
567
|
+
)
|
568
|
+
|
569
|
+
# add_missing_metadatas
|
570
|
+
params = {}
|
571
|
+
self.assertEqual(
|
572
|
+
service.add_missing_metadatas(params), {"metadata_fields": ["id", "UID"]}
|
573
|
+
)
|
574
|
+
params = {"fullobjects": 1}
|
575
|
+
self.assertEqual(service.add_missing_metadatas(params), params)
|
576
|
+
params = {"metadata_fields": ["other", "UID"]}
|
577
|
+
self.assertEqual(
|
578
|
+
service.add_missing_metadatas(params),
|
579
|
+
{"metadata_fields": ["other", "UID", "id"]},
|
580
|
+
)
|
581
|
+
params = {"metadata_fields": ["other", "id"]}
|
582
|
+
self.assertEqual(
|
583
|
+
service.add_missing_metadatas(params),
|
584
|
+
{"metadata_fields": ["other", "id", "UID"]},
|
585
|
+
)
|
586
|
+
|
587
|
+
# reply
|
588
|
+
response = service.reply()
|
589
|
+
mock_request.assert_called_with(
|
590
|
+
"GET",
|
591
|
+
"http://localhost:8080/Plone/belleville/@search",
|
592
|
+
params={"metadata_fields": ["id", "UID"]},
|
593
|
+
headers={"Accept": "application/json", "Authorization": "kamoulox"},
|
594
|
+
json={},
|
595
|
+
)
|
596
|
+
self.assertEqual(response, {})
|
597
|
+
self.assertEqual(self.request.response.status, 200)
|
598
|
+
self.assertEqual(self.request.response.headers, {"test-header": "True"})
|
599
|
+
|
600
|
+
service = self.traverse(
|
601
|
+
"/plone/@events_request_forwarder/belleville/", method="POST"
|
602
|
+
)
|
603
|
+
service.reply()
|
604
|
+
mock_request.assert_called_with(
|
605
|
+
"POST",
|
606
|
+
"http://localhost:8080/Plone/belleville",
|
607
|
+
params={},
|
608
|
+
headers={"Accept": "application/json", "Authorization": "kamoulox"},
|
609
|
+
json={},
|
610
|
+
)
|
611
|
+
|
612
|
+
mock_request.side_effect = None
|
613
|
+
mock_request.return_value = FakeResponse(status_code=204)
|
614
|
+
service = self.traverse(
|
615
|
+
"/plone/@events_request_forwarder/belleville/", method="PATCH"
|
616
|
+
)
|
617
|
+
response = service.reply()
|
618
|
+
self.assertEqual(response, "")
|
619
|
+
self.assertEqual(self.request.response.status, 204)
|
620
|
+
|
621
|
+
self.assertEqual(
|
622
|
+
self.api_session.get("/@directory_request_forwarder/foo/bar").text, ""
|
623
|
+
)
|
624
|
+
self.assertEqual(
|
625
|
+
self.api_session.get("/@events_request_forwarder/foo/bar").text, ""
|
626
|
+
)
|
627
|
+
self.assertEqual(
|
628
|
+
self.api_session.get("/@news_request_forwarder/foo/bar").text, ""
|
629
|
+
)
|
@@ -4,9 +4,9 @@ from bs4 import BeautifulSoup
|
|
4
4
|
from datetime import datetime
|
5
5
|
from datetime import timedelta
|
6
6
|
from freezegun import freeze_time
|
7
|
+
from imio.smartweb.common.contact_utils import formatted_schedule
|
8
|
+
from imio.smartweb.common.contact_utils import get_schedule_for_today
|
7
9
|
from imio.smartweb.core.contents.sections.contact.utils import ContactProperties
|
8
|
-
from imio.smartweb.core.contents.sections.contact.utils import formatted_schedule
|
9
|
-
from imio.smartweb.core.contents.sections.contact.utils import get_schedule_for_today
|
10
10
|
from imio.smartweb.core.contents.sections.views import SECTION_ITEMS_HASH_KEY
|
11
11
|
from imio.smartweb.core.testing import IMIO_SMARTWEB_CORE_FUNCTIONAL_TESTING
|
12
12
|
from imio.smartweb.core.testing import ImioSmartwebTestCase
|
@@ -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=container_uid&metadata_fields=category_title&metadata_fields=local_category&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=container_uid&metadata_fields=category_title&metadata_fields=local_category&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=container_uid&metadata_fields=category_title&metadata_fields=local_category&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=container_uid&metadata_fields=category_title&metadata_fields=local_category&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,32 @@ 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=container_uid&metadata_fields=category_title&metadata_fields=local_category&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=container_uid&metadata_fields=category_title&metadata_fields=local_category&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"], "Local Category title")
|
144
|
+
self.assertEqual(events_view.items[0][1]["category"], "Presse")
|
145
|
+
self.events.show_categories_or_topics = "category"
|
146
|
+
self.assertEqual(events_view.items[0][0]["category"], "Local Category title")
|
147
|
+
self.events.show_categories_or_topics = "topic"
|
148
|
+
self.assertEqual(events_view.items[0][0]["category"], "Education")
|
149
|
+
self.events.show_categories_or_topics = ""
|
150
|
+
self.assertEqual(events_view.items[0][0]["category"], "")
|
@@ -28,28 +28,28 @@ class TestSectionExternalContent(ImioSmartwebTestCase):
|
|
28
28
|
sec.external_content_url = "https://kamoulox.be"
|
29
29
|
section_view = queryMultiAdapter((sec, self.request), name="view")
|
30
30
|
self.assertEqual(
|
31
|
-
section_view.
|
31
|
+
section_view.contents,
|
32
32
|
'<p class="unknow_service">Unknow service</p>',
|
33
33
|
)
|
34
34
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
35
|
+
def test_eaglebe_plugin(self):
|
36
|
+
sec = api.content.create(
|
37
|
+
container=self.page, type="imio.smartweb.SectionExternalContent", id="sec"
|
38
|
+
)
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
40
|
+
sec.external_content_url = ""
|
41
|
+
section_view = queryMultiAdapter((sec, self.request), name="view")
|
42
|
+
self.assertEqual(
|
43
|
+
section_view.contents,
|
44
|
+
'<p class="unknow_service">Unknow service</p>',
|
45
|
+
)
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
47
|
+
sec.external_content_url = "https://app.eaglebe.com/auth/start"
|
48
|
+
section_view = queryMultiAdapter((sec, self.request), name="view")
|
49
|
+
self.assertEqual(
|
50
|
+
section_view.contents,
|
51
|
+
'<iframe class="eaglebe" src="https://app.eaglebe.com/auth/start" scrolling="no" width="100%">',
|
52
|
+
)
|
53
53
|
|
54
54
|
def test_elloha_plugin(self):
|
55
55
|
sec = api.content.create(
|
@@ -62,7 +62,7 @@ class TestSectionExternalContent(ImioSmartwebTestCase):
|
|
62
62
|
)
|
63
63
|
section_view = queryMultiAdapter((sec, self.request), name="view")
|
64
64
|
self.assertEqual(
|
65
|
-
section_view.
|
65
|
+
section_view.contents,
|
66
66
|
'<div class="elloha elloha_error">With an elloha plugin, extra params must contain a dictionary with two keys : ConstellationWidgetContainer, Idoi</div>',
|
67
67
|
)
|
68
68
|
|
@@ -71,9 +71,10 @@ class TestSectionExternalContent(ImioSmartwebTestCase):
|
|
71
71
|
"ConstellationWidgetContainer" : "11111111-1111-1111-1111-111111111111",
|
72
72
|
"Idoi" : "22222222-2222-2222-2222-222222222222"
|
73
73
|
}"""
|
74
|
+
self.maxDiff = None
|
74
75
|
section_view = queryMultiAdapter((sec, self.request), name="view")
|
75
|
-
result = '<div class="elloha"><div id="ConstellationWidgetContainer11111111-1111-1111-1111-111111111111" style="width:100%" data-id-projet="11111111111111111111111111111111">...</div></div><script type="text/javascript" src="https://reservation.elloha.com/Scripts/widget-loader.min.js?v=42
|
76
|
-
self.assertEqual(section_view.
|
76
|
+
result = '<div class="elloha" style="position:relative;"><div id="ConstellationWidgetContainer11111111-1111-1111-1111-111111111111" style="width:100%" data-id-projet="11111111111111111111111111111111">...</div></div><script type="text/javascript" src="https://reservation.elloha.com/Scripts/widget-loader.min.js?v=42"></script><script type="text/javascript">var constellationWidgetUrl11111111111111111111111111111111, constellationTypeModule11111111111111111111111111111111;constellationWidgetUrl11111111111111111111111111111111 = "https://reservation.elloha.com/Widget/BookingEngine/11111111-1111-1111-1111-111111111111?idoi=22222222-2222-2222-2222-222222222222&culture=fr-FR";constellationTypeModule11111111111111111111111111111111=1; constellationWidgetLoad("ConstellationWidgetContainer11111111-1111-1111-1111-111111111111");constellationWidgetAddEvent(window, "resize", function () {constellationWidgetSetAppearance("ConstellationWidgetContainer11111111-1111-1111-1111-111111111111");});</script>'
|
77
|
+
self.assertEqual(section_view.contents, result)
|
77
78
|
|
78
79
|
# good extra params / dict keys are case insensitive
|
79
80
|
sec.external_content_params = """{
|
@@ -81,21 +82,21 @@ class TestSectionExternalContent(ImioSmartwebTestCase):
|
|
81
82
|
"IDOI" : "22222222-2222-2222-2222-222222222222"
|
82
83
|
}"""
|
83
84
|
section_view = queryMultiAdapter((sec, self.request), name="view")
|
84
|
-
result = '<div class="elloha"><div id="ConstellationWidgetContainer11111111-1111-1111-1111-111111111111" style="width:100%" data-id-projet="11111111111111111111111111111111">...</div></div><script type="text/javascript" src="https://reservation.elloha.com/Scripts/widget-loader.min.js?v=42
|
85
|
-
self.assertEqual(section_view.
|
85
|
+
result = '<div class="elloha" style="position:relative;"><div id="ConstellationWidgetContainer11111111-1111-1111-1111-111111111111" style="width:100%" data-id-projet="11111111111111111111111111111111">...</div></div><script type="text/javascript" src="https://reservation.elloha.com/Scripts/widget-loader.min.js?v=42"></script><script type="text/javascript">var constellationWidgetUrl11111111111111111111111111111111, constellationTypeModule11111111111111111111111111111111;constellationWidgetUrl11111111111111111111111111111111 = "https://reservation.elloha.com/Widget/BookingEngine/11111111-1111-1111-1111-111111111111?idoi=22222222-2222-2222-2222-222222222222&culture=fr-FR";constellationTypeModule11111111111111111111111111111111=1; constellationWidgetLoad("ConstellationWidgetContainer11111111-1111-1111-1111-111111111111");constellationWidgetAddEvent(window, "resize", function () {constellationWidgetSetAppearance("ConstellationWidgetContainer11111111-1111-1111-1111-111111111111");});</script>'
|
86
|
+
self.assertEqual(section_view.contents, result)
|
86
87
|
|
87
88
|
# with bad params
|
88
89
|
sec.external_content_params = "kamoulox"
|
89
90
|
section_view = queryMultiAdapter((sec, self.request), name="view")
|
90
91
|
result = '<div class="elloha elloha_error">With an elloha plugin, extra params must contain a dictionary with two keys : ConstellationWidgetContainer, Idoi</div>'
|
91
|
-
self.assertEqual(section_view.
|
92
|
+
self.assertEqual(section_view.contents, result)
|
92
93
|
|
93
94
|
sec.external_content_params = """{
|
94
95
|
"ConstellationWidgetContainer" : "11111111-1111-1111-1111-111111111111"
|
95
96
|
}"""
|
96
97
|
section_view = queryMultiAdapter((sec, self.request), name="view")
|
97
98
|
result = '<div class="elloha elloha_error">With an elloha plugin, extra params must contain a dictionary with two keys : ConstellationWidgetContainer, Idoi</div>'
|
98
|
-
self.assertEqual(section_view.
|
99
|
+
self.assertEqual(section_view.contents, result)
|
99
100
|
|
100
101
|
sec.external_content_params = """{
|
101
102
|
"CONSTELLATIONWIDGETCONTAINER" : "11111111-1111-1111-1111-111111111111",
|
@@ -103,4 +104,4 @@ class TestSectionExternalContent(ImioSmartwebTestCase):
|
|
103
104
|
"""
|
104
105
|
section_view = queryMultiAdapter((sec, self.request), name="view")
|
105
106
|
result = '<div class="elloha elloha_error">With an elloha plugin, extra params must contain a dictionary with two keys : ConstellationWidgetContainer, Idoi</div>'
|
106
|
-
self.assertEqual(section_view.
|
107
|
+
self.assertEqual(section_view.contents, result)
|