Skip to content

Commit

Permalink
wip: deco update views
Browse files Browse the repository at this point in the history
  • Loading branch information
EwenKorr committed Nov 29, 2024
1 parent 50e1703 commit 949cadb
Show file tree
Hide file tree
Showing 7 changed files with 601 additions and 201 deletions.
2 changes: 1 addition & 1 deletion itou/templates/apply/submit/application/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ <h1 class="flex-grow-1">{% include 'apply/includes/_submit_title.html' %}</h1>
<p>
Dernière actualisation du profil : {{ job_seeker.last_checked_at|date }} à {{ job_seeker.last_checked_at|time }}
{% if can_view_personal_information and not request.user.is_job_seeker %}
<a class="btn btn-link" href="{% url "job_seekers_views:update_job_seeker_step_1" company_pk=siae.pk job_seeker_public_id=job_seeker.public_id %}">Vérifier le profil</a>
<a class="btn btn-link" href="{{ update_url }}">Vérifier le profil</a>
{% endif %}
{% if new_check_needed %}<i class="ri-information-line ri-xl text-warning"></i>{% endif %}
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ <h1>
<div class="c-box my-4">
<h2>
Informations personnelles
<a class="btn btn-outline-primary float-end" href="{% url "job_seekers_views:update_job_seeker_step_1_for_hire" company_pk=siae.pk job_seeker_public_id=job_seeker.public_id %}">Mettre à jour</a>
<a class="btn btn-outline-primary float-end" href="{{ update_url }}">Mettre à jour</a>
</h2>

{% include "apply/includes/profile_infos.html" %}
Expand Down
13 changes: 13 additions & 0 deletions itou/www/apply/views/submit_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,18 @@ def setup(self, request, *args, **kwargs):
job_seeker_session.set("job_seeker", {"pk": self.job_seeker.pk})
self.apply_session.set("job_seeker_session_name", job_seeker_session.name)

def update_job_seeker_session_config(self, new_config):
job_seeker_session = SessionNamespace(self.request.session, self.apply_session.get("job_seeker_session_name"))
job_seeker_session.set("config", new_config)

def get_update_url(self):
view_name = (
"job_seekers_views:update_job_seeker_step_1_for_hire"
if self.hire_process
else "job_seekers_views:update_job_seeker_step_1"
)
return reverse(view_name, kwargs={"session_uuid": self.apply_session.get("job_seeker_session_name")})

def get_context_data(self, **kwargs):
return super().get_context_data(**kwargs) | {
"job_seeker": self.job_seeker,
Expand All @@ -232,6 +244,7 @@ def get_context_data(self, **kwargs):
not self.request.user.is_job_seeker
and self.job_seeker.last_checked_at < timezone.now() - JOB_SEEKER_INFOS_CHECK_PERIOD
),
"update_url": self.get_update_url(),
}

def get_previous_applications_queryset(self):
Expand Down
62 changes: 54 additions & 8 deletions itou/www/job_seekers_views/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,29 +144,54 @@
kwargs={"hire_process": True},
),
path(
"<int:company_pk>/hire/update/<uuid:job_seeker_public_id>/1",
"<uuid:session_uuid>/hire/update/1",
views.UpdateJobSeekerStep1View.as_view(),
name="update_job_seeker_step_1_for_hire",
kwargs={"hire_process": True},
),
path(
"<int:company_pk>/hire/update/<uuid:job_seeker_public_id>/2",
"<uuid:session_uuid>/hire/update/2",
views.UpdateJobSeekerStep2View.as_view(),
name="update_job_seeker_step_2_for_hire",
kwargs={"hire_process": True},
),
path(
"<int:company_pk>/hire/update/<uuid:job_seeker_public_id>/3",
"<uuid:session_uuid>/hire/update/3",
views.UpdateJobSeekerStep3View.as_view(),
name="update_job_seeker_step_3_for_hire",
kwargs={"hire_process": True},
),
path(
"<int:company_pk>/hire/update/<uuid:job_seeker_public_id>/end",
"<uuid:session_uuid>/hire/update/end",
views.UpdateJobSeekerStepEndView.as_view(),
name="update_job_seeker_step_end_for_hire",
kwargs={"hire_process": True},
),
# TODO(ewen): deprecated URLs
path(
"<int:company_pk>/hire/update/<uuid:job_seeker_public_id>/1",
views.DeprecatedUpdateJobSeekerStep1View.as_view(),
name="update_job_seeker_step_1_for_hire",
kwargs={"hire_process": True},
),
path(
"<int:company_pk>/hire/update/<uuid:job_seeker_public_id>/2",
views.DeprecatedUpdateJobSeekerStep2View.as_view(),
name="update_job_seeker_step_2_for_hire",
kwargs={"hire_process": True},
),
path(
"<int:company_pk>/hire/update/<uuid:job_seeker_public_id>/3",
views.DeprecatedUpdateJobSeekerStep3View.as_view(),
name="update_job_seeker_step_3_for_hire",
kwargs={"hire_process": True},
),
path(
"<int:company_pk>/hire/update/<uuid:job_seeker_public_id>/end",
views.DeprecatedUpdateJobSeekerStepEndView.as_view(),
name="update_job_seeker_step_end_for_hire",
kwargs={"hire_process": True},
),
path(
"<int:company_pk>/hire/<uuid:job_seeker_public_id>/check-infos",
views.CheckJobSeekerInformationsForHire.as_view(),
Expand All @@ -186,25 +211,46 @@
),
# Job seeker check/updates
path(
"<int:company_pk>/update/<uuid:job_seeker_public_id>/1",
"<uuid:session_uuid>/update/1",
views.UpdateJobSeekerStep1View.as_view(),
name="update_job_seeker_step_1",
),
path(
"<int:company_pk>/update/<uuid:job_seeker_public_id>/2",
"<uuid:session_uuid>/update/2",
views.UpdateJobSeekerStep2View.as_view(),
name="update_job_seeker_step_2",
),
path(
"<int:company_pk>/update/<uuid:job_seeker_public_id>/3",
"<uuid:session_uuid>/update/3",
views.UpdateJobSeekerStep3View.as_view(),
name="update_job_seeker_step_3",
),
path(
"<int:company_pk>/update/<uuid:job_seeker_public_id>/end",
"<uuid:session_uuid>/update/end",
views.UpdateJobSeekerStepEndView.as_view(),
name="update_job_seeker_step_end",
),
# TODO(ewen): deprecated URLs
path(
"<int:company_pk>/update/<uuid:job_seeker_public_id>/1",
views.DeprecatedUpdateJobSeekerStep1View.as_view(),
name="update_job_seeker_step_1",
),
path(
"<int:company_pk>/update/<uuid:job_seeker_public_id>/2",
views.DeprecatedUpdateJobSeekerStep2View.as_view(),
name="update_job_seeker_step_2",
),
path(
"<int:company_pk>/update/<uuid:job_seeker_public_id>/3",
views.DeprecatedUpdateJobSeekerStep3View.as_view(),
name="update_job_seeker_step_3",
),
path(
"<int:company_pk>/update/<uuid:job_seeker_public_id>/end",
views.DeprecatedUpdateJobSeekerStepEndView.as_view(),
name="update_job_seeker_step_end",
),
# Common
path(
"<int:company_pk>/create/<uuid:job_seeker_public_id>/check-infos",
Expand Down
Loading

0 comments on commit 949cadb

Please sign in to comment.