Skip to content

Commit

Permalink
job_seeker_views: split route to fix nav-tab
Browse files Browse the repository at this point in the history
  • Loading branch information
dejafait committed Dec 23, 2024
1 parent aada9f1 commit 87cce32
Show file tree
Hide file tree
Showing 5 changed files with 153 additions and 19 deletions.
1 change: 1 addition & 0 deletions itou/templates/companies/overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

{% block title_content %}<h1>Structure</h1>{% endblock %}

{% comment %} djaf {% endcomment %}
{% block title_extra %}
<ul class="s-tabs-01__nav nav nav-tabs mb-0" data-it-sliding-tabs="true">
<li class="nav-item">
Expand Down
34 changes: 18 additions & 16 deletions itou/templates/job_seekers_views/details.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,43 @@ <h1 class="mb-0">Candidat : {{ job_seeker.get_full_name|mask_unless:can_view_pe
</div>
{% endblock %}

{% comment %} djaf {% endcomment %}
{% block title_extra %}
<ul class="s-tabs-01__nav nav nav-tabs mb-0" role="tablist" data-it-sliding-tabs="true">
<li class="nav-item" role="presentation">
<a class="nav-link active"
href="{% url 'job_seekers_views:details' public_id=job_seeker.public_id %}?back_url={% url 'job_seekers_views:list' %}"
aria-controls="informations"
aria-selected="true"
{% matomo_event "candidat" "clic-onglet" "informations candidat" %}>
Informations générales
</a>
{% comment %} <a class="nav-link active"
id="informations-tab"
data-bs-toggle="tab"
href="#informations"
role="tab"
aria-controls="informations"
aria-selected="true"
{% matomo_event "candidat" "clic-onglet" "informations candidat" %}>Informations générales</a>
{% endcomment %}
</li>
<li class="nav-item" role="presentation">
<a class="nav-link"
href="{% url 'job_seekers_views:job_applications' public_id=job_seeker.public_id %}?back_url={% url 'job_seekers_views:list' %}"
aria-controls="candidatures"
aria-selected="false"
{% matomo_event "candidat" "clic-onglet" "candidatures" %}>
Candidatures
</a>
{% comment %} <a class="nav-link"
id="job-applications-tab"
data-bs-toggle="tab"
href="#candidatures"
role="tab"
aria-controls="candidatures"
aria-selected="false"
{% matomo_event "candidat" "clic-onglet" "candidatures" %}>Candidatures</a>
{% matomo_event "candidat" "clic-onglet" "candidatures" %}>Candidatures</a> {% endcomment %}
</li>
</ul>
{% endblock %}
Expand All @@ -59,6 +75,7 @@ <h1 class="mb-0">Candidat : {{ job_seeker.get_full_name|mask_unless:can_view_pe
<div class="s-section__row row">
<div class="s-section__col col-12">
<div class="tab-content">
{% comment %} djaf {% endcomment %}
<div class="tab-pane fade show active" id="informations" role="tabpanel" aria-labelledby="informations-tab">
<div class="row">
<div class="col-12 {% if approval %}col-lg-8 order-2 order-lg-1{% endif %}">
Expand All @@ -80,21 +97,6 @@ <h2>Informations</h2>
{% endif %}
</div>
</div>
<div class="tab-pane fade" id="candidatures" role="tabpanel" aria-labelledby="job-applications-tab">
<h2>Candidatures envoyées</h2>
<hr>
{% matomo_event "candidat" "clic" "detail-candidature" as matomo_event_attrs %}
{% for job_application in sent_job_applications %}
{% url 'apply:details_for_prescriber' job_application_id=job_application.id as detail_url %}
{% include "apply/includes/job_application_box_for_user.html" with job_application=job_application detail_url=detail_url matomo_event_attrs=matomo_event_attrs %}
{% empty %}
<div class="c-box c-box--results my-3 my-md-4">
<div class="c-box--results__body">
<p class="mb-0">Aucune candidature envoyée.</p>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
</div>
Expand Down
104 changes: 104 additions & 0 deletions itou/templates/job_seekers_views/job_applications.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
{% extends "layout/base.html" %}
{% load matomo %}
{% load static %}
{% load str_filters %}
{% load format_filters %}
{% load url_add_query %}

{% block title %}
Profil de {{ job_seeker.get_full_name|mask_unless:can_view_personal_information }} {{ block.super }}
{% endblock %}

{% block title_content %}
<div class="d-flex flex-column flex-md-row gap-3 mb-3 justify-content-md-between">
<h1 class="mb-0">Candidat : {{ job_seeker.get_full_name|mask_unless:can_view_personal_information }}</h1>
{% url 'search:employers_results' as search_url %}
{% if can_view_personal_information %}
{% url_add_query search_url job_seeker=job_seeker.public_id city=job_seeker.city_slug as url_query %}
{% else %}
{% url_add_query search_url job_seeker=job_seeker.public_id as url_query %}
{% endif %}
<a href="{{ url_query }}" {% matomo_event "candidature" "clic" "postuler-pour-ce-candidat" %} class="btn btn-lg btn-primary btn-ico">
<i class="ri-draft-line fw-medium" aria-hidden="true"></i>
<span>Postuler pour ce candidat</span>
</a>
</div>
{% endblock %}

{% comment %} djaf {% endcomment %}
{% block title_extra %}
<ul class="s-tabs-01__nav nav nav-tabs mb-0" role="tablist" data-it-sliding-tabs="true">
<li class="nav-item" role="presentation">
<a class="nav-link"
href="{% url 'job_seekers_views:details' public_id=job_seeker.public_id %}?back_url={% url 'job_seekers_views:list' %}"
aria-controls="informations"
aria-selected="true"
{% matomo_event "candidat" "clic-onglet" "informations candidat" %}>
Informations générales
</a>
{% comment %} <a class="nav-link active"
id="informations-tab"
data-bs-toggle="tab"
href="#informations"
role="tab"
aria-controls="informations"
aria-selected="true"
{% matomo_event "candidat" "clic-onglet" "informations candidat" %}>Informations générales</a>
{% endcomment %}
</li>
<li class="nav-item" role="presentation">
<a class="nav-link active"
href="{% url 'job_seekers_views:job_applications' public_id=job_seeker.public_id %}?back_url={% url 'job_seekers_views:list' %}"
aria-controls="candidatures"
aria-selected="false"
{% matomo_event "candidat" "clic-onglet" "candidatures" %}>
Candidatures
</a>
{% comment %} <a class="nav-link"
id="job-applications-tab"
data-bs-toggle="tab"
href="#candidatures"
role="tab"
aria-controls="candidatures"
aria-selected="false"
{% matomo_event "candidat" "clic-onglet" "candidatures" %}>Candidatures</a> {% endcomment %}
</li>
</ul>
{% endblock %}
{% block title_prevstep %}
{% include "layout/previous_step.html" with back_url=back_url only %}
{% endblock %}

{% block content %}
<section class="s-section">
<div class="s-section__container container">
<div class="s-section__row row">
<div class="s-section__col col-12">
<div class="tab-content">
{% comment %} djaf {% endcomment %}
<div class="tab-pane fade show active" id="candidatures" role="tabpanel" aria-labelledby="job-applications-tab">
<h2>Candidatures envoyées</h2>
<hr>
{% matomo_event "candidat" "clic" "detail-candidature" as matomo_event_attrs %}
{% for job_application in sent_job_applications %}
{% url 'apply:details_for_prescriber' job_application_id=job_application.id as detail_url %}
{% include "apply/includes/job_application_box_for_user.html" with job_application=job_application detail_url=detail_url matomo_event_attrs=matomo_event_attrs %}
{% empty %}
<div class="c-box c-box--results my-3 my-md-4">
<div class="c-box--results__body">
<p class="mb-0">Aucune candidature envoyée.</p>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
</div>
</div>
</section>
{% endblock %}

{% block script %}
{{ block.super }}
<script src="{% static 'js/sliding_tabs.js'%}"></script>
{% endblock %}
19 changes: 18 additions & 1 deletion itou/www/job_seekers_views/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,24 @@
app_name = "job_seekers_views"

urlpatterns = [
path("details/<uuid:public_id>", views.JobSeekerDetailView.as_view(), name="details"),

# djaf

# SyntaxError: positional argument follows keyword argument
# path("details/<uuid:public_id>", views.JobSeekerDetailView.as_view(), name="details", {"template_name": "job_seekers_views/details.html"}),
# TypeError: _path() got an unexpected keyword argument 'template_name'
# path("details/<uuid:public_id>", views.JobSeekerDetailView.as_view(), name="details", template_name="job_seekers_views/details.html"),
# Reverse for 'details' not found. 'details' is not a valid view function or pattern name.
# path("details/<uuid:public_id>", views.JobSeekerDetailView.as_view(), {"name": "details", "template_name": "job_seekers_views/details.html"}),
# path("details/<uuid:public_id>", views.JobSeekerDetailView.as_view(), {"template_name": "job_seekers_views/details.html"}, name="details"),
path("details/<uuid:public_id>", views.JobSeekerDetailView.as_view(template_name="job_seekers_views/details.html"), name="details"),

# path("job_applications/<uuid:public_id>", views.JobSeekerDetailView.as_view(), name="job_applications"),
# path("job_applications/<uuid:public_id>", views.JobSeekerDetailView.as_view(), {"template_name": "job_seekers_views/job_applications.html"}, name="job_applications"),
# path("job_applications/<uuid:public_id>", views.JobSeekerDetailView.as_view(), {"template_name": "job_seekers_views/details.html"}, name="job_applications"),
path("job_applications/<uuid:public_id>", views.JobSeekerDetailView.as_view(template_name="job_seekers_views/job_applications.html"), name="job_applications"),

path("details/<uuid:public_id>", views.JobSeekerDetailView.as_view(), {"template_name": "job_seekers_views/details.html"}, name="details"),
path("list", views.JobSeekerListView.as_view(), name="list"),
# For sender
path("<uuid:session_uuid>/sender/check-nir", views.CheckNIRForSenderView.as_view(), name="check_nir_for_sender"),
Expand Down
14 changes: 12 additions & 2 deletions itou/www/job_seekers_views/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,30 @@

logger = logging.getLogger(__name__)


# djaf
class JobSeekerDetailView(LoginRequiredMixin, UserPassesTestMixin, DetailView):
model = User
queryset = User.objects.select_related("jobseeker_profile")
template_name = "job_seekers_views/details.html"
# djaf
# template_name = "job_seekers_views/details.html"
slug_field = "public_id"
slug_url_kwarg = "public_id"
context_object_name = "job_seeker"

# def __init__(self):
# super().__init__()
# # import ipdb; ipdb.set_trace()
# self.foo = "bar"

def test_func(self):
return self.request.user.is_authenticated and (
self.request.user.is_prescriber or self.request.user.is_employer
)

# def get_template_names(self):
# # import ipdb; ipdb.set_trace()
# return ["job_seekers_views/details.html"]

def get_context_data(self, **kwargs):
geiq_eligibility_diagnosis = None
if self.request.user.is_prescriber or (
Expand Down

0 comments on commit 87cce32

Please sign in to comment.