Skip to content

Commit

Permalink
add header to encourage buyers to visit their homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastienReuiller committed Apr 12, 2024
1 parent 8ca0f52 commit 0fe22f6
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lemarche/static/itou_marche/base/_custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ a.disabled {

#header-notice,
#header-env-notice,
#header-for-siaes {
#header-for-siaes,
#header-for-buyers {
border-radius: 0;
border: none !important;
margin: 0;
Expand Down
5 changes: 5 additions & 0 deletions lemarche/templates/includes/_header_for_buyers.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div id="header-for-buyers" class="text-center p-3 bg-marche-lightest">
<p class="mb-0">
Vous êtes acheteur ? <a href="{% url 'wagtail_serve' '' %}" class="font-weight-bold">Cliquez ici</a>
</p>
</div>
8 changes: 6 additions & 2 deletions lemarche/templates/layouts/_header.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
{% include "includes/_header_env_notice.html" %}
{% endif %}

{% if not user.is_authenticated and page.slug != "accueil-structure" %}
{% include "includes/_header_for_siaes.html" %}
{% if not user.is_authenticated %}
{% if page.slug == "accueil-structure" %}
{% include "includes/_header_for_buyers.html" %}
{% else %}
{% include "includes/_header_for_siaes.html" %}
{% endif %}
{% endif %}

<header role="banner" id="header">
Expand Down
8 changes: 8 additions & 0 deletions lemarche/www/pages/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ def setUpTestData(cls):
def test_anonymous_user_home(self):
response = self.client.get("/")

# top header banner
self.assertContains(response, "Vous êtes une structure inclusive")
self.assertContains(response, "/accueil-structure/")
self.assertNotContains(response, "Vous êtes acheteur")

self.assertContains(response, "Publier un besoin d'achat")
self.assertContains(response, reverse("tenders:create"))
Expand All @@ -45,8 +47,10 @@ def test_anonymous_user_home(self):
def test_anonymous_user_home_for_siae(self):
response = self.client.get("/accueil-structure/")

# top header banner
self.assertNotContains(response, "Vous êtes une structure inclusive")
self.assertNotContains(response, "/accueil-structure/")
self.assertContains(response, "Vous êtes acheteur")

self.assertContains(response, "Publier un besoin d")
self.assertContains(response, reverse("tenders:create"))
Expand All @@ -68,8 +72,10 @@ def test_siae_user_home(self):
self.client.force_login(self.siae_user)
response = self.client.get("/")

# top header banner
self.assertNotContains(response, "Vous êtes une structure inclusive")
self.assertNotContains(response, "/accueil-structure/")
self.assertNotContains(response, "Vous êtes acheteur")

self.assertContains(response, "Publier un besoin d'achat")
self.assertContains(response, reverse("tenders:create"))
Expand All @@ -91,8 +97,10 @@ def test_buyer_user_home(self):
self.client.force_login(self.user_buyer)
response = self.client.get("/")

# top header banner
self.assertNotContains(response, "Vous êtes une structure inclusive")
self.assertNotContains(response, "/accueil-structure/")
self.assertNotContains(response, "Vous êtes acheteur")

self.assertContains(response, "Publier un besoin d'achat")
self.assertContains(response, reverse("tenders:create"))
Expand Down

0 comments on commit 0fe22f6

Please sign in to comment.