Skip to content

Commit

Permalink
[#1087] Added siteimprove to configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
vaszig committed Feb 1, 2023
1 parent 2755625 commit 14d2516
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 1 deletion.
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

0 comments on commit 14d2516

Please sign in to comment.