-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1128 from maykinmedia/feature/2216-kcm
✨ [#2216] Add KCM survey link
- Loading branch information
Showing
7 changed files
with
129 additions
and
1 deletion.
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
32 changes: 32 additions & 0 deletions
32
...inwoner/configurations/migrations/0065_siteconfiguration_kcm_survey_link_text_and_more.py
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,32 @@ | ||
# Generated by Django 4.2.11 on 2024-04-02 13:15 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("configurations", "0064_auto_20240304_1200"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="siteconfiguration", | ||
name="kcm_survey_link_text", | ||
field=models.CharField( | ||
blank=True, | ||
help_text="The text that is displayed on the customer satisfaction survey link", | ||
max_length=255, | ||
verbose_name="KCM survey link text", | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="siteconfiguration", | ||
name="kcm_survey_link_url", | ||
field=models.URLField( | ||
blank=True, | ||
help_text="The external link for the customer satisfaction survey.", | ||
verbose_name="KCM survey URL", | ||
), | ||
), | ||
] |
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,51 @@ | ||
from unittest.mock import patch | ||
|
||
from django.test import TestCase | ||
|
||
from pyquery import PyQuery as PQ | ||
|
||
from open_inwoner.cms.profile.cms_apps import ProfileApphook | ||
from open_inwoner.cms.tests import cms_tools | ||
from open_inwoner.configurations.models import SiteConfiguration | ||
|
||
|
||
class KCMSurveyTestCase(TestCase): | ||
css_selector = ".kcm-survey" | ||
|
||
def setUp(self): | ||
cms_tools.create_apphook_page(ProfileApphook) | ||
|
||
@patch( | ||
"open_inwoner.configurations.models.SiteConfiguration.get_solo", | ||
return_value=SiteConfiguration( | ||
kcm_survey_link_text="Geef je mening", | ||
kcm_survey_link_url="https://some-kcm-survey.url/foo", | ||
), | ||
) | ||
def test_kcm_survey_configured(self, mock_config): | ||
response = self.client.get("/") | ||
|
||
doc = PQ(response.content) | ||
|
||
self.assertEqual(len(doc.find(self.css_selector)), 1) | ||
|
||
def test_kcm_survey_not_configured(self): | ||
invalid_configs = ( | ||
("Geef je mening", ""), | ||
("", "https://some-kcm-survey.url/foo"), | ||
("", ""), | ||
) | ||
for text, url in invalid_configs: | ||
with self.subTest(text=text, url=url): | ||
|
||
with patch( | ||
"open_inwoner.configurations.models.SiteConfiguration.get_solo", | ||
return_value=SiteConfiguration( | ||
kcm_survey_link_text=text, kcm_survey_link_url=url | ||
), | ||
): | ||
response = self.client.get("/") | ||
|
||
doc = PQ(response.content) | ||
|
||
self.assertEqual(len(doc.find(self.css_selector)), 0) |
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,15 @@ | ||
.kcm-survey { | ||
position: fixed; | ||
inset: 50% -20px auto auto; | ||
transform: rotate(180deg) translateX(50%) translateY(50%); | ||
writing-mode: vertical-rl; | ||
z-index: 1010; | ||
padding: var(--spacing-medium); | ||
background-color: var(--color-info-lighter); | ||
font-size: var(--font-size-heading-card); | ||
font-weight: bold; | ||
|
||
& .link { | ||
color: var(--color-info-darker); | ||
} | ||
} |
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