Skip to content

Commit

Permalink
Add Matomo names to forms editing first and last name
Browse files Browse the repository at this point in the history
Allows tracking these changes and creating metrics, hoping that
connecting with more identity related API will help lower the number of
edits to these fields.
  • Loading branch information
francoisfreitag committed Jul 4, 2024
1 parent 879692a commit 01826c8
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ <h2>
{% endif %}
<hr class="mt-5">
{% bootstrap_form_errors form type="all" %}
<form method="post" class="js-collapsable-subfields js-format-nir">
<form method="post" class="js-collapsable-subfields js-format-nir" data-matomo-name="{{ matomo_form_name }}">
{% csrf_token %}

{% block form_content %}{% endblock %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{% load django_bootstrap5 %}
{% load buttons_form %}

<form method="post" class="js-prevent-multiple-submit js-format-nir">
<form method="post" class="js-prevent-multiple-submit js-format-nir" data-matomo-name="dashboard-edit-job-seeker-info">
{% csrf_token %}

{% if form.nir_error %}{{ form.nir_error|safe }}{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion itou/templates/employee_record/includes/create_step_1.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<div class="row">
<div class="col-12 col-lg-8">
<div class="c-form">
<form method="post" class="js-prevent-multiple-submit">
<form method="post" class="js-prevent-multiple-submit" data-matomo-name="employee-record-identity">
{% csrf_token %}
<fieldset>
<legend>Etat civil du salarié</legend>
Expand Down
2 changes: 1 addition & 1 deletion itou/templates/signup/job_seeker_signup.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ <h1>
<b>Ou utilisez votre adresse e-mail</b>
</div>

<form method="post" action="{% url 'signup:job_seeker' %}" role="form" class="js-prevent-multiple-submit">
<form method="post" action="{% url 'signup:job_seeker' %}" role="form" class="js-prevent-multiple-submit" data-matomo-name="signup-job-seeker-identity">

{% csrf_token %}

Expand Down
6 changes: 6 additions & 0 deletions itou/www/apply/views/submit_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,7 @@ def post(self, request, *args, **kwargs):
def get_context_data(self, **kwargs):
return super().get_context_data(**kwargs) | {
"form": self.form,
"matomo_form_name": "apply-create-job-seeker-identity",
"progress": "20",
}

Expand Down Expand Up @@ -595,6 +596,7 @@ def post(self, request, *args, **kwargs):
def get_context_data(self, **kwargs):
return super().get_context_data(**kwargs) | {
"form": self.form,
"matomo_form_name": "apply-create-job-seeker-contact-info",
"progress": "40",
}

Expand Down Expand Up @@ -629,6 +631,7 @@ def post(self, request, *args, **kwargs):
def get_context_data(self, **kwargs):
return super().get_context_data(**kwargs) | {
"form": self.form,
"matomo_form_name": "apply-create-job-seeker-situation",
"progress": "60",
}

Expand Down Expand Up @@ -1367,6 +1370,7 @@ def get_context_data(self, **kwargs):
return super().get_context_data(**kwargs) | {
"confirmation_needed": False,
"form": self.form,
"matomo_form_name": "apply-update-job-seeker-identity",
"readonly_form": not self.request.user.can_edit_personal_information(self.job_seeker),
"progress": "20",
}
Expand Down Expand Up @@ -1408,6 +1412,7 @@ def get_context_data(self, **kwargs):
return super().get_context_data(**kwargs) | {
"form": self.form,
"readonly_form": not self.request.user.can_edit_personal_information(self.job_seeker),
"matomo_form_name": "apply-update-job-seeker-contact-info",
"progress": "40",
}

Expand Down Expand Up @@ -1463,6 +1468,7 @@ def post(self, request, *args, **kwargs):
def get_context_data(self, **kwargs):
return super().get_context_data(**kwargs) | {
"form": self.form,
"matomo_form_name": "apply-update-job-seeker-situation",
"progress": "60",
}

Expand Down
2 changes: 1 addition & 1 deletion tests/www/signup/__snapshots__/test_job_seeker.ambr
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# serializer version: 1
# name: JobSeekerSignupTest.test_job_seeker_signup[job_seeker_signup_form]
'''
<form action="/signup/job_seeker" class="js-prevent-multiple-submit" method="post" role="form">
<form action="/signup/job_seeker" class="js-prevent-multiple-submit" data-matomo-name="signup-job-seeker-identity" method="post" role="form">

<input name="csrfmiddlewaretoken" type="hidden" value="NORMALIZED_CSRF_TOKEN"/>

Expand Down

0 comments on commit 01826c8

Please sign in to comment.