Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring : séparer Dashboard & Networks #867

Merged
merged 1 commit into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
path("besoins/", include("lemarche.www.tenders.urls")),
path("prestataires/", include("lemarche.www.siaes.urls")),
path("profil/", include("lemarche.www.dashboard.urls")),
path("profil/reseaux/", include("lemarche.www.dashboard_networks.urls")),
path("profil/listes-dachats/", include("lemarche.www.dashboard_favorites.urls")),
path("select2/", include("django_select2.urls")),
# admin blog
Expand Down
2 changes: 1 addition & 1 deletion lemarche/templates/dashboard/home_buyer.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ <h1 class="s-title-01__title h1"><strong>Tableau de bord</strong></h1>
</div>
</div>
<div class="card-footer pt-0 bg-white text-right">
<a href="{% url 'dashboard:profile_network_detail' user.partner_network.slug %}" id="dashboard_network_detail" class="btn btn-link btn-ico">
<a href="{% url 'dashboard_networks:detail' user.partner_network.slug %}" id="dashboard_network_detail" class="btn btn-link btn-ico">
<span>Animer mon réseau</span>
<i class="ri-arrow-right-s-line ri-xl"></i>
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ <h1 class="s-title-01__title h1">
</p>
</div>
<div class="card-footer pt-0 bg-white text-right">
<a href="{% url 'dashboard:profile_network_siae_list' network.slug %}" id="dashboard-network-siae-list-btn" class="btn btn-link btn-ico">
<a href="{% url 'dashboard_networks:siae_list' network.slug %}" id="dashboard-network-siae-list-btn" class="btn btn-link btn-ico">
<span>Voir la liste</span>
<i class="ri-arrow-right-s-line ri-xl"></i>
</a>
Expand All @@ -67,7 +67,7 @@ <h1 class="s-title-01__title h1">
</p>
</div>
<div class="card-footer pt-0 bg-white text-right">
<a href="{% url 'dashboard:profile_network_tender_list' network.slug %}" id="dashboard-network-tender-list-btn" class="btn btn-link btn-ico">
<a href="{% url 'dashboard_networks:tender_list' network.slug %}" id="dashboard-network-tender-list-btn" class="btn btn-link btn-ico">
<span>Voir les opportunités</span>
<i class="ri-arrow-right-s-line ri-xl"></i>
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{% url 'wagtail_serve' '' %}">Accueil</a></li>
<li class="breadcrumb-item"><a href="{% url 'dashboard:home' %}">Tableau de bord</a></li>
<li class="breadcrumb-item"><a href="{% url 'dashboard:profile_network_detail' network.slug %}">Mon réseau</a></li>
<li class="breadcrumb-item"><a href="{% url 'dashboard_networks:detail' network.slug %}">Mon réseau</a></li>
<li class="breadcrumb-item active" aria-current="page">Mes adhérents</li>
</ol>
</nav>
Expand Down Expand Up @@ -86,21 +86,21 @@ <h2>
</td>
<td>
{% if siae.tender_email_send_count > 0 %}
<a href="{% url 'dashboard:profile_network_siae_tender_list' network.slug siae.slug %}" title="Voir les demandes reçues" id="dashboard-network-siae-show-tender-email-send-list-btn">{{ siae.tender_email_send_count }}</a>
<a href="{% url 'dashboard_networks:siae_tender_list' network.slug siae.slug %}" title="Voir les demandes reçues" id="dashboard-network-siae-show-tender-email-send-list-btn">{{ siae.tender_email_send_count }}</a>
{% else %}
0
{% endif %}
</td>
<td>
{% if siae.tender_detail_display_count > 0 %}
<a href="{% url 'dashboard:profile_network_siae_tender_list' network.slug siae.slug "DISPLAY" %}" title="Voir les demandes vues" id="dashboard-network-siae-show-tender-detail-display-list-btn">{{ siae.tender_detail_display_count }}</a>
<a href="{% url 'dashboard_networks:siae_tender_list' network.slug siae.slug "DISPLAY" %}" title="Voir les demandes vues" id="dashboard-network-siae-show-tender-detail-display-list-btn">{{ siae.tender_detail_display_count }}</a>
{% else %}
0
{% endif %}
</td>
<td>
{% if siae.tender_detail_contact_click_count > 0 %}
<a href="{% url 'dashboard:profile_network_siae_tender_list' network.slug siae.slug "CONTACT-CLICK" %}" title="Voir les demandes intéressées" id="dashboard-network-siae-show-tender-detail-contact-click-list-btn">{{ siae.tender_detail_contact_click_count }}</a>
<a href="{% url 'dashboard_networks:siae_tender_list' network.slug siae.slug "CONTACT-CLICK" %}" title="Voir les demandes intéressées" id="dashboard-network-siae-show-tender-detail-contact-click-list-btn">{{ siae.tender_detail_contact_click_count }}</a>
{% else %}
0
{% endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{% url 'wagtail_serve' '' %}">Accueil</a></li>
<li class="breadcrumb-item"><a href="{% url 'dashboard:home' %}">Tableau de bord</a></li>
<li class="breadcrumb-item"><a href="{% url 'dashboard:profile_network_detail' network.slug %}">Mon réseau</a></li>
<li class="breadcrumb-item"><a href="{% url 'dashboard:profile_network_siae_list' network.slug %}">Mes adhérents</a></li>
<li class="breadcrumb-item"><a href="{% url 'dashboard_networks:detail' network.slug %}">Mon réseau</a></li>
<li class="breadcrumb-item"><a href="{% url 'dashboard_networks:siae_list' network.slug %}">Mes adhérents</a></li>
<li class="breadcrumb-item active" aria-current="page" title="{{ siae.name_display }}">{{ siae.name_display|truncatechars:25 }}</li>
</ol>
</nav>
Expand All @@ -37,9 +37,9 @@ <h1 class="mb-3 mb-lg-5">Cet adhérent a reçu {{ tendersiaes.count }} demande{{
{% block htmx %}
<div id="siaeTenderList">
<ul role="navigation" class="nav nav-tabs nav-tabs--marche">
{% url 'dashboard:profile_network_siae_tender_list' network.slug siae.slug as NETWORK_SIAE_TENDER_LIST_URL %}
{% url 'dashboard:profile_network_siae_tender_list' network.slug siae.slug "DISPLAY" as NETWORK_SIAE_TENDER_DISPLAY_LIST_URL %}
{% url 'dashboard:profile_network_siae_tender_list' network.slug siae.slug "CONTACT-CLICK" as NETWORK_SIAE_TENDER_CONTACT_CLICK_LIST_URL %}
{% url 'dashboard_networks:siae_tender_list' network.slug siae.slug as NETWORK_SIAE_TENDER_LIST_URL %}
{% url 'dashboard_networks:siae_tender_list' network.slug siae.slug "DISPLAY" as NETWORK_SIAE_TENDER_DISPLAY_LIST_URL %}
{% url 'dashboard_networks:siae_tender_list' network.slug siae.slug "CONTACT-CLICK" as NETWORK_SIAE_TENDER_CONTACT_CLICK_LIST_URL %}
<li class="nav-item">
<a role="button" hx-push-url="true" hx-get="{{ NETWORK_SIAE_TENDER_LIST_URL }}"
class="nav-link{% if request.get_full_path == NETWORK_SIAE_TENDER_LIST_URL %} active{% endif %}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{% url 'wagtail_serve' '' %}">Accueil</a></li>
<li class="breadcrumb-item"><a href="{% url 'dashboard:home' %}">Tableau de bord</a></li>
<li class="breadcrumb-item"><a href="{% url 'dashboard:profile_network_detail' network.slug %}">Mon réseau</a></li>
<li class="breadcrumb-item"><a href="{% url 'dashboard:profile_network_tender_list' network.slug %}">Opportunités commerciales</a></li>
<li class="breadcrumb-item"><a href="{% url 'dashboard_networks:detail' network.slug %}">Mon réseau</a></li>
<li class="breadcrumb-item"><a href="{% url 'dashboard_networks:tender_list' network.slug %}">Opportunités commerciales</a></li>
<li class="breadcrumb-item active" aria-current="page" title="{{ tender.title }}">{{ tender.title|truncatechars:25 }}</li>
</ol>
</nav>
Expand All @@ -32,11 +32,11 @@
</div>
{# Sidebar "actions" #}
<div class="col-12 col-lg-4 order-1 order-lg-2">
<a href="{% url 'dashboard:profile_network_tender_siae_list' network.slug tender.slug %}" id="show-tender-siae-list-from-network-tender-detail-btn" class="btn btn-primary mb-3">
<a href="{% url 'dashboard_networks:tender_siae_list' network.slug tender.slug %}" id="show-tender-siae-list-from-network-tender-detail-btn" class="btn btn-primary mb-3">
<i class="ri-focus-2-line"></i>
{{ tender.network_siae_email_send_count }} adhérent{{ tender.network_siae_email_send_count|pluralize }} notifié{{ tender.network_siae_email_send_count|pluralize }}
</a>
<a href="{% url 'dashboard:profile_network_tender_siae_list' network.slug tender.slug "CONTACT-CLICK" %}" id="show-tender-siae-interested-list-from-network-tender-detail-btn" class="btn btn-primary mb-3">
<a href="{% url 'dashboard_networks:tender_siae_list' network.slug tender.slug "CONTACT-CLICK" %}" id="show-tender-siae-interested-list-from-network-tender-detail-btn" class="btn btn-primary mb-3">
<i class="ri-thumb-up-line"></i>
{{ tender.network_siae_detail_contact_click_count }} adhérent{{ tender.network_siae_detail_contact_click_count|pluralize }} intéressé{{ tender.network_siae_detail_contact_click_count|pluralize }}
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{% url 'wagtail_serve' '' %}">Accueil</a></li>
<li class="breadcrumb-item"><a href="{% url 'dashboard:home' %}">Tableau de bord</a></li>
<li class="breadcrumb-item"><a href="{% url 'dashboard:profile_network_detail' network.slug %}">Mon réseau</a></li>
<li class="breadcrumb-item"><a href="{% url 'dashboard_networks:detail' network.slug %}">Mon réseau</a></li>
<li class="breadcrumb-item active" aria-current="page">Opportunités commerciales</li>
</ol>
</nav>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{% url 'wagtail_serve' '' %}">Accueil</a></li>
<li class="breadcrumb-item"><a href="{% url 'dashboard:home' %}">Tableau de bord</a></li>
<li class="breadcrumb-item"><a href="{% url 'dashboard:profile_network_detail' network.slug %}">Mon réseau</a></li>
<li class="breadcrumb-item"><a href="{% url 'dashboard:profile_network_tender_list' network.slug %}">Opportunités commerciales</a></li>
<li class="breadcrumb-item"><a href="{% url 'dashboard:profile_network_tender_detail' network.slug tender.slug %}" title="{{ tender.title }}">{{ tender.title|truncatechars:25 }}</a></li>
<li class="breadcrumb-item"><a href="{% url 'dashboard_networks:detail' network.slug %}">Mon réseau</a></li>
<li class="breadcrumb-item"><a href="{% url 'dashboard_networks:tender_list' network.slug %}">Opportunités commerciales</a></li>
<li class="breadcrumb-item"><a href="{% url 'dashboard_networks:tender_detail' network.slug tender.slug %}" title="{{ tender.title }}">{{ tender.title|truncatechars:25 }}</a></li>
<li class="breadcrumb-item active" aria-current="page">Adhérents notifiés</li>
</ol>
</nav>
Expand All @@ -38,8 +38,8 @@ <h1 class="mb-3 mb-lg-5">Mes adhérents notifiés et intéressés par cette oppo
{% block htmx %}
<div id="siaeTenderList">
<ul role="navigation" class="nav nav-tabs nav-tabs--marche">
{% url 'dashboard:profile_network_tender_siae_list' network.slug tender.slug as NETWORK_TENDER_SIAE_LIST_URL %}
{% url 'dashboard:profile_network_tender_siae_list' network.slug tender.slug "CONTACT-CLICK" as NETWORK_TENDER_SIAE_CONTACT_CLICK_LIST_URL %}
{% url 'dashboard_networks:tender_siae_list' network.slug tender.slug as NETWORK_TENDER_SIAE_LIST_URL %}
{% url 'dashboard_networks:tender_siae_list' network.slug tender.slug "CONTACT-CLICK" as NETWORK_TENDER_SIAE_CONTACT_CLICK_LIST_URL %}
<li class="nav-item">
<a role="button" hx-push-url="true" hx-get="{{ NETWORK_TENDER_SIAE_LIST_URL }}"
class="nav-link{% if request.get_full_path == NETWORK_TENDER_SIAE_LIST_URL %} active{% endif %}"
Expand Down
4 changes: 2 additions & 2 deletions lemarche/templates/tenders/_list_item_network.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% load static humanize %}

<div class="card c-card c-card--marche c-card--link siae-card" role="button" data-url="{% url 'dashboard:profile_network_tender_detail' network.slug tender.slug %}">
<div class="card c-card c-card--marche c-card--link siae-card" role="button" data-url="{% url 'dashboard_networks:tender_detail' network.slug tender.slug %}">
<div class="card-body">
<div class="row">
<div class="col-md-8" style="border-right:1px solid;">
Expand Down Expand Up @@ -51,7 +51,7 @@ <h2 class="py-2">{{ tender.title }}</h2>
<i class="ri-focus-2-line font-weight-light"></i>&nbsp;{{ tender.network_siae_email_send_count|default:0 }} adhérent{{ tender.network_siae_email_send_count|pluralize }} notifié{{ tender.network_siae_email_send_count|pluralize }}
</p>
{% if tender.network_siae_email_send_count %}
<a href="{% url 'dashboard:profile_network_tender_siae_list' network.slug tender.slug %}" id="dashboard-network-tender-show-siae-list-btn" class="btn btn-sm btn-primary">
<a href="{% url 'dashboard_networks:tender_siae_list' network.slug tender.slug %}" id="dashboard-network-tender-show-siae-list-btn" class="btn btn-sm btn-primary">
Voir la liste
</a>
{% endif %}
Expand Down
22 changes: 11 additions & 11 deletions lemarche/www/dashboard/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,11 @@ class DashboardNetworkViewTest(TestCase):
@classmethod
def setUpTestData(cls):
cls.DASHBOARD_NETWORK_URLS = [
"dashboard:profile_network_detail",
"dashboard:profile_network_siae_list",
"dashboard:profile_network_tender_list",
# "dashboard:profile_network_tender_detail"
# "dashboard:profile_network_siae_tender_list"
"dashboard_networks:detail",
"dashboard_networks:siae_list",
"dashboard_networks:tender_list",
# "dashboard_networks:tender_detail"
# "dashboard_networks:siae_tender_list"
]
cls.network_1 = NetworkFactory(name="Liste 1")
cls.network_2 = NetworkFactory(name="Liste 2")
Expand Down Expand Up @@ -321,27 +321,27 @@ def test_only_network_member_can_access_network_pages(self):

def test_siae_list_in_network_siae_list(self):
self.client.force_login(self.user_network_1)
url = reverse("dashboard:profile_network_siae_list", args=[self.network_1.slug])
url = reverse("dashboard_networks:siae_list", args=[self.network_1.slug])
response = self.client.get(url)
self.assertContains(response, self.siae_1.name_display)
self.assertNotContains(response, self.siae_2.name_display)

def test_only_network_siaes_can_display_network_siae_tender_list(self):
self.client.force_login(self.user_network_1)
url = reverse("dashboard:profile_network_siae_tender_list", args=[self.network_1.slug, self.siae_1.slug])
url = reverse("dashboard_networks:siae_tender_list", args=[self.network_1.slug, self.siae_1.slug])
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
self.assertContains(response, self.tender_1.title)
# siae_2 not linked to network
self.client.force_login(self.user_network_1)
url = reverse("dashboard:profile_network_siae_tender_list", args=[self.network_1.slug, self.siae_2.slug])
url = reverse("dashboard_networks:siae_tender_list", args=[self.network_1.slug, self.siae_2.slug])
response = self.client.get(url)
self.assertEqual(response.status_code, 302)
self.assertEqual(response.url, f"/profil/reseaux/{self.network_1.slug}/prestataires/")

def test_tender_list_in_network_tender_list(self):
self.client.force_login(self.user_network_1)
url = reverse("dashboard:profile_network_tender_list", args=[self.network_1.slug])
url = reverse("dashboard_networks:tender_list", args=[self.network_1.slug])
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
self.assertContains(response, self.tender_1.title)
Expand All @@ -350,7 +350,7 @@ def test_tender_list_in_network_tender_list(self):

def test_tender_detail_in_network_tender_detail(self):
self.client.force_login(self.user_network_1)
url = reverse("dashboard:profile_network_tender_detail", args=[self.network_1.slug, self.tender_1.slug])
url = reverse("dashboard_networks:tender_detail", args=[self.network_1.slug, self.tender_1.slug])
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
self.assertContains(response, self.tender_1.title)
Expand All @@ -360,7 +360,7 @@ def test_tender_detail_in_network_tender_detail(self):

def test_network_siae_list_in_network_tender_siae_list(self):
self.client.force_login(self.user_network_1)
url = reverse("dashboard:profile_network_tender_siae_list", args=[self.network_1.slug, self.tender_1.slug])
url = reverse("dashboard_networks:tender_siae_list", args=[self.network_1.slug, self.tender_1.slug])
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
self.assertContains(response, self.siae_1.name_display)
Expand Down
Loading