-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WEB-3732 : Add smartweb settings to customize sendinblue subscribing …
…button (text and position)
- Loading branch information
Showing
11 changed files
with
199 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from imio.smartweb.core.testing import IMIO_SMARTWEB_CORE_FUNCTIONAL_TESTING | ||
from imio.smartweb.core.testing import ImioSmartwebTestCase | ||
from plone import api | ||
from plone.app.testing import setRoles | ||
from plone.app.testing import TEST_USER_ID | ||
from zope.component import queryMultiAdapter | ||
|
||
|
||
class TestSectionNews(ImioSmartwebTestCase): | ||
|
||
layer = IMIO_SMARTWEB_CORE_FUNCTIONAL_TESTING | ||
|
||
def setUp(self): | ||
self.request = self.layer["request"] | ||
self.portal = self.layer["portal"] | ||
setRoles(self.portal, TEST_USER_ID, ["Manager"]) | ||
self.portalpage = api.content.create( | ||
container=self.portal, | ||
type="imio.smartweb.PortalPage", | ||
id="Portal page", | ||
) | ||
|
||
def test_button_position(self): | ||
section_sendinblue = api.content.create( | ||
container=self.portalpage, | ||
type="imio.smartweb.SectionSendinblue", | ||
title="SendInBlue", | ||
) | ||
section_view = queryMultiAdapter( | ||
(section_sendinblue, self.request), name="view" | ||
) | ||
self.assertEquals("button_bottom", section_view.button_position) | ||
|
||
portal_page_view = queryMultiAdapter( | ||
(self.portalpage, self.request), name="full_view" | ||
) | ||
self.assertIn("button_bottom", portal_page_view()) | ||
|
||
api.portal.set_registry_record( | ||
"smartweb.sendinblue_button_position", "button_right" | ||
) | ||
portal_page_view = queryMultiAdapter( | ||
(self.portalpage, self.request), name="full_view" | ||
) | ||
self.assertIn("button_right", portal_page_view()) | ||
|
||
def test_button_text(self): | ||
section_sendinblue = api.content.create( | ||
container=self.portalpage, | ||
type="imio.smartweb.SectionSendinblue", | ||
title="SendInBlue", | ||
) | ||
section_view = queryMultiAdapter( | ||
(section_sendinblue, self.request), name="view" | ||
) | ||
self.assertIsNone(section_view.button_text) | ||
|
||
portal_page_view = queryMultiAdapter( | ||
(self.portalpage, self.request), name="full_view" | ||
) | ||
self.assertIn('value="Subscribe"', portal_page_view()) | ||
|
||
texts = [ | ||
{"language": "fr", "text": "Je m'inscris!"}, | ||
{"language": "en", "text": "Register!"}, | ||
] | ||
api.portal.set_registry_record("smartweb.sendinblue_button_text", texts) | ||
portal_page_view = queryMultiAdapter( | ||
(self.portalpage, self.request), name="full_view" | ||
) | ||
self.assertNotIn('value="Subscribe"', portal_page_view()) | ||
self.assertIn('value="Register!"', portal_page_view()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...io/smartweb/core/upgrades/profiles/1028_to_1029/registry/sendinblue_button_properties.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0"?> | ||
<registry | ||
xmlns:i18n="http://xml.zope.org/namespaces/i18n" | ||
i18n:domain="imio.smartweb"> | ||
|
||
<records interface="imio.smartweb.core.browser.controlpanel.ISmartwebControlPanel" | ||
prefix="smartweb"> | ||
<value key="sendinblue_button_position">button_bottom</value> | ||
</records> | ||
|
||
<records interface="imio.smartweb.core.browser.controlpanel.ISmartwebControlPanel" | ||
prefix="smartweb"> | ||
<value key="sendinblue_button_text"></value> | ||
</records> | ||
|
||
</registry> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters