Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

Commit

Permalink
Merge branch 'release/3.0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreJunod committed Jun 30, 2023
2 parents dcfe2db + bc32c90 commit 82f0234
Show file tree
Hide file tree
Showing 8 changed files with 178 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Generated by Django 4.2.1 on 2023-06-30 08:26

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("reports", "0028_datamigration_update_sectionparapgraph"),
]

operations = [
migrations.AddField(
model_name="sectionvalidation",
name="service_style",
field=models.CharField(
choices=[
("bold", "Gras"),
("italic", "Italique"),
("underline", "Souligné"),
("h1", "Titre 1"),
("h2", "Titre 2"),
("h3", "Titre 3"),
("h4", "Titre 4"),
("h5", "Titre 5"),
("h6", "Titre 6"),
],
default="h3",
help_text="S'applique au nom du service",
max_length=255,
verbose_name="Style du service",
),
),
migrations.AddField(
model_name="sectionvalidation",
name="show_empty_comment",
field=models.BooleanField(
default=False,
help_text="Afficher/masquer les validations sans commentaires",
verbose_name="Afficher les commentaires vides",
),
),
migrations.AddField(
model_name="sectionvalidation",
name="show_status",
field=models.BooleanField(default=False, verbose_name="Afficher le statut"),
),
migrations.AddField(
model_name="sectionvalidation",
name="style",
field=models.PositiveSmallIntegerField(
choices=[(0, "champ : valeur"), (1, "valeur")],
default=0,
help_text="Choisir le style d'affichage",
verbose_name="Style",
),
),
]
45 changes: 45 additions & 0 deletions geocity/apps/reports/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,22 @@ class Heading(models.TextChoices):
H6 = "h6", _("Titre 6")


class PropertyTitle(models.TextChoices):
"""
Used to define the style of the property title in each section
"""

BOLD = "bold", _("Gras")
ITALIC = "italic", _("Italique")
UNDERLINE = "underline", _("Souligné")
H1 = "h1", _("Titre 1")
H2 = "h2", _("Titre 2")
H3 = "h3", _("Titre 3")
H4 = "h4", _("Titre 4")
H5 = "h5", _("Titre 5")
H6 = "h6", _("Titre 6")


def padding_top_field(default=0):
return models.PositiveIntegerField(
_("Espace vide au dessus"),
Expand Down Expand Up @@ -562,6 +578,13 @@ class Meta:


class SectionValidation(Section):
STYLE_0 = 0
STYLE_1 = 1
STYLES = (
(STYLE_0, _("champ : valeur")),
(STYLE_1, _("valeur")),
)

padding_top = padding_top_field()
title = models.CharField(
_("Titre"), default="Commentaire·s des services", blank=True, max_length=2000
Expand All @@ -575,6 +598,28 @@ class SectionValidation(Section):
"S'applique au titre des tous les paragraphes. h1 taille la plus grande, h6 la plus petite"
),
)
service_style = models.CharField(
_("Style du service"),
choices=PropertyTitle.choices,
default=PropertyTitle.H3,
max_length=255,
help_text=_("S'applique au nom du service"),
)
style = models.PositiveSmallIntegerField(
_("Style"),
choices=STYLES,
default=STYLE_0,
help_text=_("Choisir le style d'affichage"),
)
show_status = models.BooleanField(
_("Afficher le statut"),
default=False,
)
show_empty_comment = models.BooleanField(
_("Afficher les commentaires vides"),
default=False,
help_text=_("Afficher/masquer les validations sans commentaires"),
)

class Meta:
verbose_name = _("Commentaire·s des services")
Expand Down
8 changes: 8 additions & 0 deletions geocity/apps/reports/templates/reports/report.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ td, th {
font-weight: bold;
}

.italic {
font-style: italic;
}

.underline {
text-decoration: underline;
}

/* sections */
.section-map img {
max-width:100%;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,22 @@
<div class="flex_container">
<div class="flex_item-100">
{% for group, validation in request_data.properties.validations.items %}
<h3>Validation: {{validation.description}}</h3>
<span class="bold">Statut : </span>{{validation.validation_status}}<br>
{% if validation.comment_is_visible_by_author %}
<div class="flex_item-100" style="text-align: justify; text-justify: inter-character;"><span class="bold">Commentaire : </span>{{validation.comment}}</div><br>
{% if section.show_empty_comment or validation.comment %}
<span class="{{section.service_style}}">{{validation.description}}</span>
{% if section.show_status %}
{% if section.style == 0 %}
<span class="bold">Statut : </span>{{validation.validation_status}}<br>
{% elif section.style == 1 %}
{{validation.validation_status}}<br>
{% endif %}
{% endif %}
{% if validation.comment_is_visible_by_author %}
{% if section.style == 0 %}
<div class="flex_item-100" style="text-align: justify; text-justify: inter-character;"><span class="bold">Commentaire : </span>{{validation.comment}}</div><br>
{% elif section.style == 1 %}
<div class="flex_item-100" style="text-align: justify; text-justify: inter-character;">{{validation.comment}}</div><br>
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
</div>
Expand Down
5 changes: 5 additions & 0 deletions geocity/apps/submissions/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,11 @@ def __init__(self, user, *args, **kwargs):

self.fields["status"].choices = tuple(all_statuses_tuple)

# Don't notify anonymous user
if self.instance.forms.filter(is_anonymous=True).exists():
self.fields["notify_author"].widget = forms.HiddenInput()
self.fields["reason"].widget = forms.HiddenInput()

# A permit that is anonymous cannot be notified
if self.instance.forms.filter(is_anonymous=True).exists():
self.fields["notify_author"].disabled = True
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
52 changes: 46 additions & 6 deletions geocity/tests/reports/test_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,49 @@ def test_block_gallery(self):
# "is_new_page": bool,
"title": "Section validation",
"title_size": "h3",
"service_style": "h3",
"style": 0,
"show_status": True,
"show_empty_comment": True,
}
},
13: {
SectionValidation: {
# "padding_top": int,
# "is_new_page": bool,
"title": "Section validation",
"title_size": "h3",
"service_style": "bold",
"style": 1,
"show_status": False,
"show_empty_comment": False,
}
},
14: {
SectionValidation: {
# "padding_top": int,
# "is_new_page": bool,
"title": "Section validation",
"title_size": "h3",
"service_style": "italic",
"style": 1,
"show_status": False,
"show_empty_comment": False,
}
},
15: {
SectionValidation: {
# "padding_top": int,
# "is_new_page": bool,
"title": "Section validation",
"title_size": "h3",
"service_style": "underline",
"style": 1,
"show_status": False,
"show_empty_comment": False,
}
},
16: {
SectionAmendProperty: {
# "padding_top": int,
# "is_new_page": bool,
Expand All @@ -251,7 +291,7 @@ def test_block_gallery(self):
# "undesired_properties": string,
}
},
14: {
17: {
SectionAmendProperty: {
# "padding_top": int,
# "is_new_page": bool,
Expand All @@ -261,7 +301,7 @@ def test_block_gallery(self):
# "undesired_properties": string,
}
},
15: {
18: {
SectionAmendProperty: {
# "padding_top": int,
# "is_new_page": bool,
Expand All @@ -271,7 +311,7 @@ def test_block_gallery(self):
# "undesired_properties": string,
}
},
16: {
19: {
SectionAmendProperty: {
# "padding_top": int,
# "is_new_page": bool,
Expand All @@ -281,23 +321,23 @@ def test_block_gallery(self):
# "undesired_properties": string,
}
},
17: {
20: {
SectionStatus: {
# "padding_top": int,
# "is_new_page": bool,
"title": "Section status",
"title_size": "h3",
}
},
18: {
21: {
SectionCreditor: {
# "padding_top": int,
# "is_new_page": bool,
"title": "Section creditor",
"title_size": "h3",
}
},
19: {
22: {
SectionRecipient: {
"padding_top": 20,
# "is_new_page": bool,
Expand Down

0 comments on commit 82f0234

Please sign in to comment.