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/2.1.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreJunod committed Mar 30, 2023
2 parents 4a53360 + 6966eaf commit 6087541
Show file tree
Hide file tree
Showing 25 changed files with 161 additions and 78 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -54,7 +54,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -68,4 +68,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: "Lint Code"
uses: pre-commit/[email protected]
Expand Down
55 changes: 39 additions & 16 deletions geocity/apps/accounts/templates/account/lockout.html
Original file line number Diff line number Diff line change
@@ -1,22 +1,45 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="fr">
<head>
{% load static %}
{% load i18n %}
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Geocity</title>
{% block stylesheets%}
<link rel="stylesheet" type="text/css" href="{% static 'css/main.css' %}">
{% endblock %}
</head>
<body>
<div class="error-page">
<p>
<head>
{% load static %}
{% load i18n %}
{% load bootstrap4 %}
{% bootstrap_css %}
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Geocity</title>
{% block stylesheets%}
<link rel="stylesheet" type="text/css" href="{% static 'css/main.css' %}">
{% endblock %}
</head>
<body class="d-flex flex-column min-vh-100">
<div class="container">
<p>
<h1>Geocity</h1>
<h2>{% trans "Trop de tentatives de connexion!" %}</h2>
<h3>{% trans "Votre compte a été vérouillé par mesure de sécurité. Merci de contacter l'administrateur pour résoudre le problème" %}</h3>
</p>
<img src="{% static 'images/errors/lockout.svg'%}" type="image/gif">
<h3>{% trans "Votre compte a été verrouillé par mesure de sécurité. Merci de contacter l'administrateur pour résoudre le problème." %}</h3>
</p>
<img src="{% static 'images/errors/lockout.svg'%}" class="img-fluid" type="image/gif">
</div>
</body>
<footer class="flex-shrink-0 py-2 bg-light text-dark mt-auto">
<div class="container text-center">
<small>
&copy; {% now "Y" %} Geocity
&nbsp;|&nbsp;
<a href="https://geocity.ch/about" target="_blank" rel="noreferrer">{% trans "A propos" %}</a>
{% if config.CONTACT_URL %}
&nbsp;|&nbsp;
<a href="{{ config.CONTACT_URL }}" target="_blank" rel="noreferrer">{% trans "Contact" %}</a>
{% endif %}
{% if config.GENERAL_CONDITIONS_URL %}
&nbsp;|&nbsp;
<a href="{{ config.GENERAL_CONDITIONS_URL }}" target="_blank" rel="noreferrer">{% trans "Conditions" %}</a>
{% endif %}
{% if config.PRIVACY_POLICY_URL %}
&nbsp;|&nbsp;
<a href="{{ config.PRIVACY_POLICY_URL }}" target="_blank" rel="noreferrer">{% trans "Confidentialité" %}</a>
{% endif %}
</small>
</div>
</footer>
</body>
</html>
14 changes: 11 additions & 3 deletions geocity/apps/accounts/templates/accounts/user_profile_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
{% block scripts %}
<script src="{% static 'libs/js/jquery-ui-custom/jquery-ui.js' %}"></script>
<script src="{% static 'customWidgets/RemoteAutocomplete/remoteautocomplete.js' %}"></script>
<script src="{% static 'js/user_profile_edit.js' %}"></script>
{% endblock %}
{% block content-fluid %}
<div class="container">
<br>
<h3>{% trans "Mon compte" %}</h3>
<h3>{% translate "Mon compte" %}</h3>
<hr>
<form method='POST' action='' enctype="multipart/form-data" novalidate id="actor-form">
{% csrf_token %}
Expand All @@ -26,8 +27,15 @@ <h3>{% trans "Mon compte" %}</h3>
{% if user_profile_form %}
{% bootstrap_form user_profile_form layout='horizontal'%}
{% endif %}
{% bootstrap_button "Confirmer" button_type="submit" button_class="btn-primary mr-3" value="Enregistrer" %}
<a href="{% url 'submissions:submissions_list' %}">{% trans "Annuler" %}</a>
<div class="form-group required row">
<label class="col-md-3 col-form-label" for="id_chk_accept_policy">{% translate "Politique de confidentialité" %}</label>
<div class="col-md-9 login-policy">
<input type="checkbox" id="chk_accept_policy" name="chk_accept_policy">
<label for="chk_accept_policy">{% translate "J'ai lu et j'accepte la " %}<b><a href="{{config.PRIVACY_POLICY_URL}}" target="_blank" rel="noreferrer">{% translate " politique de confidentialité" %}</a></b></label><br>
</div>
</div>
{% bootstrap_button "Confirmer" button_type="submit" id="user_profile_edit" button_class="btn-primary mr-3" value="Enregistrer" name="disabled"%}
<a href="{% url 'submissions:submissions_list' %}">{% translate "Annuler" %}</a>
</form>
<br>
</div>
Expand Down
20 changes: 11 additions & 9 deletions geocity/apps/accounts/templates/registration/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@
<link rel="stylesheet" type="text/css" href="{% static 'css/login.css' %}">

<style>
{% if customization.background_image.url %}
#login-content {
background-image: url("{{ customization.background_image.url }}");
}
{% else %}
#login-content {
background-image: url("{% static 'images/login_geocity.svg' %}");
}
{% endif %}
@media (min-width: 769px) {
{% if customization.background_image.url %}
#login-content {
background-image: url("{{ customization.background_image.url }}");
}
{% else %}
#login-content {
background-image: url("{% static 'images/login_geocity.svg' %}");
}
{% endif %}
}
</style>
{% endblock %}
{% block navbar %}{% endblock %}
Expand Down
20 changes: 11 additions & 9 deletions geocity/apps/accounts/templates/two_factor/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@
<link rel="stylesheet" type="text/css" href="{% static 'css/login.css' %}">

<style>
{% if customization.background_image.url %}
#login-content {
background-image: url("{{ customization.background_image.url }}");
}
{% else %}
#login-content {
background-image: url("{% static 'images/login_geocity.svg' %}");
}
{% endif %}
@media (min-width: 769px) {
{% if customization.background_image.url %}
#login-content {
background-image: url("{{ customization.background_image.url }}");
}
{% else %}
#login-content {
background-image: url("{% static 'images/login_geocity.svg' %}");
}
{% endif %}
}
</style>
{% endblock %}
{% block navbar %}{% endblock %}
Expand Down
13 changes: 10 additions & 3 deletions geocity/apps/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def get_form_fields(
last_wot = ""

if wot_props:
# Flat view is used in the api for geocalandar, the WOT shows only the works_object__name and not the type
# Flat view is used in the api for geocalendar, the WOT shows only the works_object__name and not the type
if value_with_type:
wot_properties = list()
key_for_form = _("Formulaire")
Expand Down Expand Up @@ -280,12 +280,18 @@ class Meta:
)


class SentDateSerializer(serializers.RelatedField):
def to_representation(self, value):
return value.strftime("%d.%m.%Y %H:%M")


class SubmissionSerializer(serializers.ModelSerializer):
administrative_entity = AdministrativeEntitySerializer(read_only=True)
meta_types = MetaTypesField(source="forms", read_only=True)
forms_names = FormsNames(source="forms", read_only=True)
current_inquiry = SubmissionInquirySerializer(read_only=True)
submission_price = SubmissionPriceSerializer(read_only=True)
sent_date = SentDateSerializer(read_only=True)

class Meta:
model = Submission
Expand All @@ -299,6 +305,7 @@ class Meta:
"forms_names",
"current_inquiry",
"submission_price",
"sent_date",
)


Expand Down Expand Up @@ -454,7 +461,7 @@ class SubmissionGeoTimeGeoJSONSerializer(serializers.Serializer):
and external links will be retrieved and grouped from it.
Note: The extract_geom parameter specifies the aggregation function used to represent
the geometries. If not specified, it will return a boudning box. If specified, it
the geometries. If not specified, it will return a bounding box. If specified, it
will return a multigeometry of the given type (1 for point, 2 for lines, 3 for polys).
"""

Expand Down Expand Up @@ -540,7 +547,7 @@ def to_representation(self, value):
return result


# Override of real ListSerialier from django-rest-framework-gis
# Override of real ListSerializer from django-rest-framework-gis
# If you want to add a new structure with dynamic values, just add it to OrderedDict and give him a new function like "super().prefix_to_representation(data)"
# Then in SubmissionPrintSerializer write this class like the existant "to_representation"
class SubmissionPrintListSerialier(gis_serializers.ListSerializer):
Expand Down
4 changes: 2 additions & 2 deletions geocity/apps/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ class SubmissionViewSet(WFS3DescribeModelViewSetMixin, viewsets.ReadOnlyModelVie
Notes:
1.- For forms that do not have geometry, the returned
geometry is a 2x2 square around the centroid of the administrative entity geometry
geometry is a 2x2 meters square around the centroid of the administrative entity geometry
2.- This endpoint does not filter out items without geometry.
For forms types that have only point geometry, the returned geometry
is a polygon of 2 x 2 meters
is a polygon of 2x2 meters
This endpoint is mainly designed for atlas print generation with QGIS Server
For standard geometric endpoints, please use the following endpoints
Expand Down
4 changes: 4 additions & 0 deletions geocity/apps/core/static/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ h5 {
font-weight: bold;
}

.login-policy {
padding-top: 8px;
}

.progress-nav {
display: flex;
justify-content: center;
Expand Down
8 changes: 8 additions & 0 deletions geocity/apps/core/static/js/user_profile_edit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const button = document.getElementById("user_profile_edit");
const checkbox = document.getElementById("chk_accept_policy");

checkbox.addEventListener("click", () => {
button.toggleAttribute("disabled");
});

button.toggleAttribute("disabled");
2 changes: 1 addition & 1 deletion geocity/apps/forms/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ class FormCategoryAdmin(IntegratorFilterMixin, admin.ModelAdmin):
"get__tags",
]
search_fields = [
"id",
"name",
]

def sortable_str(self, obj):
Expand Down
4 changes: 2 additions & 2 deletions geocity/apps/reports/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ class ReportAdmin(
]
search_fields = [
"name",
"layout",
"integrator",
"layout__name",
"integrator__name",
]

class Media:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Generated by Django 4.1.7 on 2023-03-29 08:42

import ckeditor.fields
from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
("reports", "0021_remove_section_padding_top_and_more"),
]

operations = [
migrations.AlterField(
model_name="sectionparagraph",
name="content",
field=ckeditor.fields.RichTextField(
help_text='Il est possible d\'inclure des variables et de la logique avec la <a href="https://jinja.palletsprojects.com/en/3.1.x/templates/" target="_blank">syntaxe Jinja</a>. Les variables de la demande sont accessible dans `{{request_data}}`, celles du formulaire dans `{{form_data}}`, celles des transactions dans `{{transaction_data}}`.',
verbose_name="Contenu",
),
),
]
2 changes: 1 addition & 1 deletion geocity/apps/reports/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ class Location(models.TextChoices):
_("Contenu"),
help_text=(
_(
'Il est possible d\'inclure des variables et de la logique avec la <a href="https://jinja.palletsprojects.com/en/3.1.x/templates/">syntaxe Jinja</a>. Les variables de la demande sont accessible dans `{{request_data}}`, celles du formulaire dans `{{form_data}}`, celles des transactions dans `{{transaction_data}}`.'
'Il est possible d\'inclure des variables et de la logique avec la <a href="https://jinja.palletsprojects.com/en/3.1.x/templates/" target="_blank">syntaxe Jinja</a>. Les variables de la demande sont accessible dans `{{request_data}}`, celles du formulaire dans `{{form_data}}`, celles des transactions dans `{{transaction_data}}`.'
)
),
)
Expand Down
45 changes: 21 additions & 24 deletions geocity/apps/reports/templates/reports/sections/sectiondetail.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,31 @@
{% block content %}
{% if request_data.properties.submission_fields %}
<div class="flex_container">
<div class="flex_item-100">
{% if section.style == 0 %}
{% for form, fields in request_data.properties.submission_fields.items %}
{% if section.show_form_name %}
<h3>{{form}}</h3>
{% if section.style == 0 %}
{% for form, fields in request_data.properties.submission_fields.items %}
{% if section.show_form_name %}
<div class="flex_item-100"><h3>{{form}}</h3></div>
{% endif %}
{% for key, field in fields.items %}
{% if not key in section.undesired_properties %}
<div class="flex_item-100" style="padding-top:{{section.line_height}}px;"><span class="bold">{{key}} : </span>{{field}}<br></div>
{% endif %}
{% for key, field in fields.items %}
{% if not key in section.undesired_properties %}
<div style="padding-top:{{section.line_height}}px;"><span class="bold">{{key}} : </span>{{field}}<br></div>
{% endif %}
{% endfor %}
{% endfor %}
</div>
{% elif section.style == 1 %}
</div>
{% for form, fields in request_data.properties.submission_fields.items %}
{% if section.show_form_name %}
<h3>{{form}}</h3>
{% endfor %}
{% elif section.style == 1 %}
{% for form, fields in request_data.properties.submission_fields.items %}
{% if section.show_form_name %}
<div class="flex_item-100"><h3>{{form}}</h3></div>
{% endif %}
{% for key, field in fields.items %}
{% if not key in section.undesired_properties %}
<div class="flex_item-40"><span class="bold">{{key}}</span></div>
<div class="flex_item-60">{{field}}</div>
<div style="padding-top:{{section.line_height}}px;"></div>
{% endif %}
{% for key, field in fields.items %}
{% if not key in section.undesired_properties %}
<div class="flex_item-40"><span class="bold">{{key}}</span></div>
<div class="flex_item-60">{{field}}</div>
<div style="padding-top:{{section.line_height}}px;"></div>
{% endif %}
{% endfor %}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
</div>
{% else %}
<p>Aucune propriété pour cette demande</p>
Expand Down
10 changes: 10 additions & 0 deletions geocity/apps/submissions/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1142,6 +1142,16 @@ def get_history(self):
history.sort(reverse=True)
return history

@property
def sent_date(self):
# Return the last sent date because the submission can be resent if it was incomplete
last_sent_history = (
self.history.filter(status=Submission.STATUS_SUBMITTED_FOR_VALIDATION)
.order_by("history_date")
.last()
)
return last_sent_history.history_date if last_sent_history is not None else None

def get_last_transaction(self):
if self.get_transactions() is None:
return None
Expand Down
Loading

0 comments on commit 6087541

Please sign in to comment.