diff --git a/sapl/base/forms.py b/sapl/base/forms.py index e5ff871c4..a197fc8de 100644 --- a/sapl/base/forms.py +++ b/sapl/base/forms.py @@ -1620,6 +1620,12 @@ class ConfiguracoesAppForm(ModelForm): max_length=256, required=False) + google_analytics_id_metrica = forms.CharField( + label=AppConfig._meta.get_field( + 'google_analytics_id_metrica').verbose_name, + max_length=256, + required=False) + class Meta: model = AppConfig fields = ['documentos_administrativos', @@ -1648,8 +1654,10 @@ class ConfiguracoesAppForm(ModelForm): 'tramitacao_documento', 'google_recaptcha_site_key', 'google_recaptcha_secret_key', + 'google_analytics_id_metrica', 'sapl_as_sapn', - 'identificacao_de_documentos'] + 'identificacao_de_documentos', + ] def __init__(self, *args, **kwargs): super(ConfiguracoesAppForm, self).__init__(*args, **kwargs) diff --git a/sapl/base/migrations/0057_appconfig_google_analytics_id_metrica.py b/sapl/base/migrations/0057_appconfig_google_analytics_id_metrica.py new file mode 100644 index 000000000..7f6623fc6 --- /dev/null +++ b/sapl/base/migrations/0057_appconfig_google_analytics_id_metrica.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.28 on 2023-05-29 19:41 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('base', '0056_auto_20221118_1330'), + ] + + operations = [ + migrations.AddField( + model_name='appconfig', + name='google_analytics_id_metrica', + field=models.CharField(default='', max_length=256, verbose_name='ID da Métrica do Google Analytics'), + ), + ] diff --git a/sapl/base/models.py b/sapl/base/models.py index e60ad589d..43b8ab349 100644 --- a/sapl/base/models.py +++ b/sapl/base/models.py @@ -234,7 +234,8 @@ class AppConfig(models.Model): verbose_name=_('Mostrar brasão da Casa no painel?')) mostrar_voto = models.BooleanField( - verbose_name=_('Exibir voto do Parlamentar antes de encerrar a votação?'), + verbose_name=_( + 'Exibir voto do Parlamentar antes de encerrar a votação?'), choices=YES_NO_CHOICES, default=False) # MÓDULO ESTATÍSTICAS DE ACESSO @@ -259,6 +260,10 @@ class AppConfig(models.Model): verbose_name=_('Chave privada gerada pelo Google Recaptcha'), max_length=256, default='') + google_analytics_id_metrica = models.CharField( + verbose_name=_('ID da Métrica do Google Analytics'), + max_length=256, default='') + class Meta: verbose_name = _('Configurações da Aplicação') verbose_name_plural = _('Configurações da Aplicação') diff --git a/sapl/templates/base.html b/sapl/templates/base.html index ea96d3035..cfb3096b5 100644 --- a/sapl/templates/base.html +++ b/sapl/templates/base.html @@ -264,14 +264,6 @@ {% block extra_js %}{% endblock extra_js %} - - {% if not DEBUG %} - - - {% endif %} - + + + {% if not DEBUG %} + + + + {% if "google_analytics_id_metrica"|get_config_attr %} + + + + {% endif %} + {% endif %} + + {% endblock foot_js %} diff --git a/sapl/templates/base/layouts.yaml b/sapl/templates/base/layouts.yaml index 6ff5ebe44..077bff9e7 100644 --- a/sapl/templates/base/layouts.yaml +++ b/sapl/templates/base/layouts.yaml @@ -52,6 +52,7 @@ AppConfig: {% trans 'Estatísticas de acesso' %}: - estatisticas_acesso_normas + - google_analytics_id_metrica {% trans 'Segurança' %}: - google_recaptcha_site_key google_recaptcha_secret_key