Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#1087] Feature/add siteimprove to configurations and admin #444

Merged
merged 1 commit into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/open_inwoner/configurations/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,15 @@ class SiteConfigurarionAdmin(OrderedInlineModelAdminMixin, SingletonModelAdmin):
),
(
_("Analytics"),
{"fields": ("gtm_code", "ga_code", "matomo_url", "matomo_site_id")},
{
"fields": (
"gtm_code",
"ga_code",
"matomo_url",
"matomo_site_id",
"siteimprove_id",
)
},
),
)
inlines = [SiteConfigurationPageInline]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 3.2.15 on 2023-02-01 09:30

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("configurations", "0030_auto_20230120_1331"),
]

operations = [
migrations.AddField(
model_name="siteconfiguration",
name="siteimprove_id",
field=models.CharField(
blank=True,
default="",
help_text="SiteImprove ID - this can be found in the snippet example, which should contain a URL like '//siteimproveanalytics.com/js/siteanalyze_xxxxx.js'. The xxxxx part is the ID.",
max_length=10,
verbose_name="SiteImprove ID",
),
),
]
18 changes: 18 additions & 0 deletions src/open_inwoner/configurations/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,8 @@ class SiteConfiguration(SingletonModel):
default=True,
help_text=_("Whether to send email about each new message the user receives"),
)

# analytics
gtm_code = models.CharField(
verbose_name=_("Google Tag Manager code"),
max_length=50,
Expand Down Expand Up @@ -342,6 +344,18 @@ class SiteConfiguration(SingletonModel):
null=True,
help_text=_("The 'idsite' of the website you're tracking in Matomo."),
)
siteimprove_id = models.CharField(
_("SiteImprove ID"),
max_length=10,
default="",
blank=True,
help_text=_(
"SiteImprove ID - this can be found in the snippet example, "
"which should contain a URL like '//siteimproveanalytics.com/js/siteanalyze_xxxxx.js'. "
"The xxxxx part is the ID."
),
)

show_cases = models.BooleanField(
verbose_name=_("Show cases"),
default=False,
Expand Down Expand Up @@ -425,6 +439,10 @@ def google_enabled(self):
def matomo_enabled(self):
return self.matomo_url and self.matomo_site_id

@property
def siteimprove_enabled(self):
return True if self.siteimprove_id else False

def get_help_text(self, request):
current_path = request.get_full_path()

Expand Down