Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
christophehenry committed Oct 29, 2024
1 parent 0516b13 commit 8dfc9ff
Show file tree
Hide file tree
Showing 11 changed files with 129 additions and 189 deletions.
5 changes: 5 additions & 0 deletions aidants_connect/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
path("", include("aidants_connect_web.urls")),
path("habilitation/", include("aidants_connect_habilitation.urls")),
path("", include("aidants_connect_pico_cms.urls")),
# APIs
path(
"api/habilitation/",
include("aidants_connect_habilitation.api.urls"),
),
]

if "test" in sys.argv:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,4 @@ details.request-card-details .details-content {
padding: inherit;
position: absolute;
width: 100%;
z-index: 11;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {aidantsConnectApplicationReady, BaseController} from "AidantsConnectAppl
* @property {ProfileEditCard[]} profileEditCardOutlets
* @property {Number} idValue
* @property {Number} stateValue
* @property {Number} displayValue
* @property {Boolean} displayValue
*/
class ProfileEditModal extends BaseController {
static STATES = Object.freeze({
Expand Down
6 changes: 6 additions & 0 deletions aidants_connect_common/templates/layouts/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
<link rel="stylesheet" href="{% static 'dsfr/dist/utility/utility.min.css' %}">
<link href="{% static 'css/main.css' %}" rel="stylesheet">
<link href="{% static 'css/dsfr-theme-tac.min.css' %}" rel="stylesheet">
{% if form.media %}
{{ form.media.render_css }}
{% endif %}
{# Extra styles #}
{% block extracss %}{% endblock %}

Expand Down Expand Up @@ -84,6 +87,9 @@
<script defer src="{{ COOKIE_BANNER_LANG_URL }}"></script>
<script defer src="{{ COOKIE_BANNER_SERVICES_URL }}"></script>
<script defer src="{% static 'js/cookie-banner.js' %}"></script>
{% if form.media %}
{{ form.media.render_js }}
{% endif %}
{% block extrajs %}{% endblock %}
</body>
</html>
9 changes: 9 additions & 0 deletions aidants_connect_habilitation/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ def setup(self, request, *args, **kwargs):
pk=self.kwargs.get("aidant_id"),
)

def dispatch(self, request, *args, **kwargs):
return super().dispatch(request, *args, **kwargs)

def get(self, request, *args, **kwargs):
return super().get(request, *args, **kwargs)

def get_form_kwargs(self):
return {
"organisation": self.organisation,
Expand Down Expand Up @@ -60,6 +66,9 @@ def get_template_names(self):
else:
return "forms/form.html"

def form_invalid(self, form):
return self.render_to_response(self.get_context_data(form=form), status=422)

def form_valid(self, form):
habilitation_request = form.save()
self.success = True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ <h3 class="fr-h5 fr-mb-0">Structure</h3>
{{ issuer.email }}<br>{{ issuer.phone }}
</p>
</div>
{% if show_edit_buttons %}
{% if show_edit_buttons or organisation.status in organisation.Status.validatable %}
<div class="fr-mt-3w flex flex-right fr-link">
<a
class="fr-btn fr-btn--tertiary fr-btn--icon fr-icon-pencil-fill"
Expand Down Expand Up @@ -61,13 +61,13 @@ <h3 class="fr-h5 fr-mb-0">Structure</h3>
<div>{{ organisation.mission_description|linebreaksbr }}</div>
</div>
</div>
{% if show_edit_buttons or organisation.status == organisation.Status.CHANGES_REQUIRED %}
{% if show_edit_buttons or organisation.status in organisation.Status.validatable %}
<div class="fr-mt-3w flex flex-right fr-link">
<a
class="fr-btn fr-btn--tertiary fr-btn--icon fr-icon-pencil-fill"
href="{% url 'habilitation_modify_organisation' issuer_id=issuer.issuer_id uuid=organisation.uuid %}"
>
Éditer
Éditer votre demande
</a>
</div>
{% endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,17 @@ <h3 class="fr-h5">Référents</h3>
<div class="fr-text--sm fr-mb-2w">{{ organisation.manager.organisation }}</div>

<ul class="fr-btns-group fr-btns-group--sm fr-btns-group--right fr-btns-group--inline fr-mb-n4v">
<li>
<a
href="{% url 'habilitation_new_aidants' issuer_id=issuer.issuer_id uuid=organisation.uuid %}"
{% if habilitation_request.details_id %}id="edit-button-{{ habilitation_request.details_id }}"{% endif %}
class="fr-btn fr-btn--tertiary fr-btn--icon fr-icon-edit-fill"
>
Éditer
</a>
</li>
{% if organisation.status in organisation.Status.aidant_registrable %}
<li>
<a
href="{% url 'habilitation_new_aidants' issuer_id=issuer.issuer_id uuid=organisation.uuid %}"
{% if habilitation_request.details_id %}id="edit-button-{{ habilitation_request.details_id }}"{% endif %}
class="fr-btn fr-btn--tertiary fr-btn--icon fr-icon-edit-fill"
>
Éditer
</a>
</li>
{% endif %}
</ul>
{% else %}
<ul class="fr-btns-group fr-m-4v">
Expand Down Expand Up @@ -117,17 +119,7 @@ <h3 class="fr-h5">Aidants</h3>
/>
<section data-profile-edit-modal-target="error" {% hidden %}>
{% mailto SUPPORT_EMAIL as contact_email %}
{% comment %}
Hmmf… Why no multiline tags in Django!? I know Django othodoxes will rebute with "just put this
in context", but dammit! This is front-end code, not data!

I know there's probably a mean to keep that code in the template whil having that long paragraph
spanned on multiple lines. But right now, it's not obvious to me. And if it's not obvious, it's
probably the sign that the UX is wrong here, not the user…
Is it visible that I'm currently frustrated with Django's dev rigidness…?
{% endcomment %}
{% dsfr_alert title="Une erreur sʼest produite" content=contact_email|strfmt:"Quelque-chose sʼest mal passé de notre côté. Ce n'est pas de votre faute. Veuillez fermer la fenêtre et réessayer. Si le problème persiste, veuillez nous contacter à %s" type="error" %}
{% dsfr_alert title="Une erreur sʼest produite" content=contact_email|strfmt:"Quelque-chose sʼest mal passé de notre côté. Ce n'est pas de votre faute. Veuillez fermer la fenêtre et réessayer. Si le problème persiste, veuillez nous contacter à {}" type="error" %}
</section>
</div>
<div class="fr-modal__footer" data-profile-edit-modal-target="footer" {% hidden %}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
<link href="{% static 'css/generic-habilitation-request-profile-card.css' %}" rel="stylesheet">
{% endblock extracss %}

{% block extrajs %}
<script type="module" src="{% static 'js/generic-habilitation-request-profile-card.mjs' %}"></script>
{% endblock extrajs %}

{% block content %}
<div class="fr-container" data-controller="profile-edit-card">
{% if organisation.status == organisation.Status.NEW %}
Expand Down Expand Up @@ -69,3 +65,7 @@ <h2 {% if organisation.status != organisation.Status.NEW %}hidden{% endif %}>Val
</form>
</div>
{% endblock content %}

{% block extrajs %}
<script type="module" src="{% static 'js/generic-habilitation-request-profile-card.mjs' %}"></script>
{% endblock extrajs %}
Original file line number Diff line number Diff line change
@@ -1,36 +1,46 @@
{% extends 'layouts/main.html' %}
{% extends 'layouts/main-habilitation.html' %}
{% load ac_common form_extras static %}

{% block title %}
Demande d'habilitation pour {{ organisation.name }} - Aidants Connect
Aidants Connect — Demande d'habilitation pour {{ organisation.name }}
{% endblock title %}

{% block extracss %}
<link href="{% static 'css/generic-habilitation-request-profile-card.css' %}" rel="stylesheet">
{% endblock extracss %}

{% block content %}
<div class="fr-container">
<h1>Demande n° {{ organisation.data_pass_id }}</h1>
<div class="fr-grid-row fr-grid-row--gutters fr-mb-6w">
<div class="fr-col-12">
<div class="fr-alert fr-alert--{% if organisation.status == organisation.Status.VALIDATED %}success {% elif organisation.status == organisation.status.CHANGES_REQUIRED %}warning{% else %}info{% endif %} fr-height-100">
<h3 class="fr-alert__title fr-mb-0">Statut : {{ organisation.status_enum.label }}</h3>
{% if organisation.status_enum.description %}
<section>{{ organisation.status_enum.description }}</section>
{% endif %}
</div>
</div>
</div>
{% include 'aidants_connect_habilitation/common/_recap_general_info.html' %}
<div class="fr-alert fr-alert--info fr-my-6w">
<h3 class="fr-alert__title fr-mb-0">Une question ?</h3>
<p>
Si vous souhaitez ajouter une précision sur votre formulaire ou nous poser une question,
vous pouvez nous contacter à l’adresse suivante : {% mailto "contact@aidantsconnect.beta.gouv.fr" %}
<h1>Demande d’habilitation n° {{ organisation.data_pass_id }}</h1>
<p class="subtitle">

</p>
<h2>Votre demande</h2>
<p>
Votre demande est actuellement dans l'état <strong>«&nbsp;{{ organisation.status_label }}&nbsp;»</strong>.
<br>
{% include "edito/_aide_etats_demandes_habilitation.html" with status=organisation.status %}
</p>
<h2>Rappel de votre saisie</h2>
{% if organisation.status in organisation.Status.validatable %}
<a
id="modify-btn"
class="fr-btn margin-bottom-1rem"
href="{% url 'habilitation_validation' issuer_id=organisation.issuer.issuer_id uuid=organisation.uuid %}"
>
Modifier votre demande
</a>
{% endif %}

{% include "_display_org_request.html" with show_edit_buttons=False %}

<div class="fr-grid-row fr-grid-row--gutters">
<p class="fr-col more-info">
Pour modifier cette demande (ajouter un aidant, etc.), envoyez votre requête par mail à lʼadresse
{% mailto AC_CONTACT_EMAIL %}.
</p>
</div>
{% include 'aidants_connect_habilitation/common/_recap_personnes.html' %}
</div>

</div>{# fr-container #}
{% endblock content %}

{% block extrajs %}
{% stimulusjs %}
<script defer src="{% static 'js/message-form.mjs' %}"></script>
{% endblock extrajs %}
Loading

0 comments on commit 8dfc9ff

Please sign in to comment.