Skip to content

Commit

Permalink
SUP-38386 : Update "elloha" plugin in external content section. Agent…
Browse files Browse the repository at this point in the history
… can set url field to visitwallonia.elloha.com
  • Loading branch information
boulch committed Jul 31, 2024
1 parent faec4b6 commit b59af61
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ Changelog
1.2.63 (unreleased)
-------------------

- Nothing changed yet.
- SUP-38386 : Update "elloha" plugin in external content section. Agent can set url field to visitwallonia.elloha.com
[boulch]


1.2.62 (2024-07-22)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def contents(self):

class EllohaPlugin(BasePlugin):
def __call__(self, parts, config={}):
if "reservation.elloha.com" in parts.netloc:
if "elloha.com" in parts.netloc:
self.parts = parts
self.config = config
return self
Expand Down Expand Up @@ -173,14 +173,15 @@ def contents(self):
cw1 = res.get("constellationwidgetcontainer")
cw2 = cw1.replace("-", "")
idoi = res.get("idoi")
internal_url = "https://reservation.elloha.com"
return (
f'<div class="elloha">'
f'<div id="ConstellationWidgetContainer{cw1}" '
f'style="width:100%" data-id-projet="{cw2}">...</div></div>'
f'<script type="text/javascript" src="{self.parts.geturl()}/Scripts/widget-loader.min.js?v=42"></script>'
f'<script type="text/javascript" src="{internal_url}/Scripts/widget-loader.min.js?v=42"></script>'
f'<script type="text/javascript">var constellationWidgetUrl{cw2}, '
f"constellationTypeModule{cw2};"
f'constellationWidgetUrl{cw2} = "https://reservation.elloha.com/Widget/BookingEngine/{cw1}?idoi={idoi}&culture=fr-FR";'
f'constellationWidgetUrl{cw2} = "{internal_url}/Widget/BookingEngine/{cw1}?idoi={idoi}&culture=fr-FR";'
f'constellationTypeModule{cw2}=1; constellationWidgetLoad("ConstellationWidgetContainer{cw1}");'
f'constellationWidgetAddEvent(window, "resize", function () {{constellationWidgetSetAppearance("ConstellationWidgetContainer{cw1}");}});</script>'
)
Expand Down
4 changes: 2 additions & 2 deletions src/imio/smartweb/core/tests/test_section_external_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def test_elloha_plugin(self):
"Idoi" : "22222222-2222-2222-2222-222222222222"
}"""
section_view = queryMultiAdapter((sec, self.request), name="view")
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/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>'
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"></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>'
self.assertEqual(section_view.contents, result)

# good extra params / dict keys are case insensitive
Expand All @@ -81,7 +81,7 @@ def test_elloha_plugin(self):
"IDOI" : "22222222-2222-2222-2222-222222222222"
}"""
section_view = queryMultiAdapter((sec, self.request), name="view")
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/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>'
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"></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>'
self.assertEqual(section_view.contents, result)

# with bad params
Expand Down

0 comments on commit b59af61

Please sign in to comment.