From 8093d5ed1adf2815567133e5a33126b887e23edc Mon Sep 17 00:00:00 2001 From: Edo Storm Date: Thu, 26 Sep 2024 16:57:48 +0200 Subject: [PATCH 01/18] fix: update the diff template --- .../proposals/table_with_header_diff.html | 94 +++++++++++-------- 1 file changed, 55 insertions(+), 39 deletions(-) diff --git a/proposals/templates/proposals/table_with_header_diff.html b/proposals/templates/proposals/table_with_header_diff.html index 5ebea6f95..3079b91f4 100644 --- a/proposals/templates/proposals/table_with_header_diff.html +++ b/proposals/templates/proposals/table_with_header_diff.html @@ -1,48 +1,64 @@ {% load diff_tags %} {% load i18n %} + + {% if section_title %}

{% trans section_title %}

{% endif %} {% if sub_title %}

{{ sub_title }}

{% endif %} - - - - - - - {% if warning %} - {% for row in rows|slice:":1" %} - - - {# If the first object is missing, place a warning on the first TD #} - {% if missing_object == 'old' %} - - - {# Otherwise, we're missing the second one, thus we place the warning on the second #} - {% elif missing_object == 'new' %} +
{% trans "Vorige aanvraag" %}{% trans "Huidige aanvraag" %}
{{ row.verbose_name }} -
{{ warning }}
-
{{ row.value }}
+ + + + + + + + + {% if warning %} + {% for row in rows|slice:":1" %} + + + {# If the first object is missing, place a warning on the first TD #} + {% if missing_object == 'old' %} + + + {# Otherwise, we're missing the second one, thus we place the warning on the second #} + {% elif missing_object == 'new' %} + + + {% endif %} + + {% endfor %} + {% for row in rows|slice:"1:" %} + + - - {% endif %} - - {% endfor %} - {% for row in rows|slice:"1:" %} - - - - - {% endfor %} - {% else %} - {% for row in rows %} - - - - - - {% endfor %} - {% endif %} + + {% endfor %} + {% else %} + {% for row in rows %} + + + + + + {% endfor %} + {% endif %} +
{% trans "Vorige aanvraag" %}{% trans "Huidige aanvraag" %}
{{ row.verbose_name }} +
{{ warning }}
+
{{ row.value }}{{ row.value }} +
{{ warning }}
+
{{ row.verbose_name }} {{ row.value }} -
{{ warning }}
-
{{ row.verbose_name }}{{ row.value }}
{{ row.verbose_name }}{{ row.old_value }}{{ row.new_value }}
{{ row.verbose_name }}{{ row.old_value }}{{ row.new_value }}
From cd0996292f3ff4956d0b40b80f0ebd3a2566d7d9 Mon Sep 17 00:00:00 2001 From: Edo Storm Date: Thu, 26 Sep 2024 16:58:18 +0200 Subject: [PATCH 02/18] fix: make sure StudyDesign also deletes study types --- studies/views/study_views.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/studies/views/study_views.py b/studies/views/study_views.py index 3b54454e4..a30527ba7 100644 --- a/studies/views/study_views.py +++ b/studies/views/study_views.py @@ -106,6 +106,13 @@ def form_valid(self, form): for study_type in form.fields["study_types"].choices: form_value = study_type[0] in form.data.getlist("study_types") form.instance.__setattr__(study_type[0], form_value) + if not form.instance.has_intervention and hasattr(form.instance, "intervention"): + form.instance.intervention.delete() + if not form.instance.has_observation and hasattr(form.instance, "observation"): + form.instance.observation.delete() + if not form.instance.has_sessions and form.instance.session_set.all(): + for session in form.instance.session_set.all(): + session.delete() form.instance.save() return super(StudyDesign, self).form_valid(form) From 06a6da9d22ea95f59110a2a590c1a5bd6139b4ca Mon Sep 17 00:00:00 2001 From: Edo Storm Date: Thu, 26 Sep 2024 16:58:33 +0200 Subject: [PATCH 03/18] fix: small bug on task_create --- tasks/views/task_views.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tasks/views/task_views.py b/tasks/views/task_views.py index 82a86969c..24158c3b9 100644 --- a/tasks/views/task_views.py +++ b/tasks/views/task_views.py @@ -65,6 +65,9 @@ def form_valid(self, form): def get_session(self): """Retrieves the Study from the pk kwarg""" return Session.objects.get(pk=self.kwargs["pk"]) + + def get_proposal(self): + return self.get_session().study.proposal class TaskUpdate(TaskMixin, UpdateView): From 82863a60010c41c45b9027735f786a51b74ef48e Mon Sep 17 00:00:00 2001 From: Edo Storm Date: Mon, 30 Sep 2024 15:33:16 +0200 Subject: [PATCH 04/18] feat: dumb css implementation on compare_documents.html --- proposals/templates/proposals/compare_documents.html | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/proposals/templates/proposals/compare_documents.html b/proposals/templates/proposals/compare_documents.html index 41075deac..6904c8b9a 100644 --- a/proposals/templates/proposals/compare_documents.html +++ b/proposals/templates/proposals/compare_documents.html @@ -10,6 +10,17 @@ {% block html_head %} + -