-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d3a0e1a
commit f4a1694
Showing
4 changed files
with
241 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,76 @@ | ||
{% load static %} | ||
{% load theme_inclusion %} | ||
|
||
<style> | ||
.remix { | ||
width: 24px; | ||
height: 24px; | ||
fill: #333; | ||
} | ||
</style> | ||
<div class="modal fade modal-siae" id="login_or_signup_modal" tabindex="-1" role="dialog" aria-modal="true" data-backdrop="static" data-keyboard="false" aria-labelledby="exampleModalLabel"> | ||
<div class="modal-dialog modal-dialog-centered"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<h3 class="modal-title" id="exampleModalLabel">Profitez gratuitement du Marché</h3> | ||
<button type="button" class="close" data-dismiss="modal" aria-label="Fermer"> | ||
<i class="ri-close-line"></i> | ||
</button> | ||
</div> | ||
<div class="modal-body home-content-body"> | ||
<p class="mb-4"> | ||
Ce ne sera pas long ! Inscrivez-vous et accédez à toutes les fonctionnalités du marché. | ||
</p> | ||
<ul class="list-unstyled mb-5"> | ||
<li class="d-flex mb-2"> | ||
<i class="text-success ri-checkbox-circle-fill display-2"></i> | ||
<span class="font-weight-bold ml-2">Publiez vos besoins auprès des structures, et retrouvez celles qui sont intéressées.</span> | ||
</li> | ||
<li class="d-flex mb-2"> | ||
<i class="text-success ri-checkbox-circle-fill display-2"></i> | ||
<span class="font-weight-bold ml-2">Téléchargez la liste complète des structures figurant sur le marché.</span> | ||
</li> | ||
<li class="d-flex mb-2"> | ||
<i class="text-success ri-checkbox-circle-fill display-2"></i> | ||
<span class="font-weight-bold ml-2">Créez des listes d'achat et sauvegardez vos structures favorites.</span> | ||
</li> | ||
<li class="d-flex mb-2"> | ||
<i class="text-success ri-checkbox-circle-fill display-2"></i> | ||
<span class="font-weight-bold ml-2">Accédez aux coordonnées des structures.</span> | ||
</li> | ||
</ul> | ||
<div class="text-center"> | ||
<a href="{% url 'auth:signup' %}?next=next-params-to-replace" id="auth-link" class="btn btn-sm btn-primary">Créer un compte</a> | ||
{% if not user.is_authenticated %} | ||
<style> | ||
.remix { | ||
width: 24px; | ||
height: 24px; | ||
fill: #333; | ||
} | ||
</style> | ||
<div class="modal fade modal-siae" id="login_or_signup_modal" tabindex="-1" role="dialog" aria-modal="true" data-backdrop="static" data-keyboard="false" aria-labelledby="exampleModalLabel"> | ||
<div class="modal-dialog modal-dialog-centered"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<h3 class="modal-title" id="exampleModalLabel">Profitez gratuitement du Marché</h3> | ||
<button type="button" class="close" data-dismiss="modal" aria-label="Fermer"> | ||
<i class="ri-close-line"></i> | ||
</button> | ||
</div> | ||
<hr class="my-5" data-text="ou" /> | ||
<div class="text-center"> | ||
<p class="mb-0">Vous avez déjà un compte ?</p> | ||
<a href="{% url 'auth:login' %}?next=next-params-to-replace" id="auth-link" class="btn btn-sm btn-link">Se connecter</a> | ||
<div class="modal-body home-content-body"> | ||
<p class="mb-4"> | ||
Ce ne sera pas long ! Inscrivez-vous et accédez à toutes les fonctionnalités du marché. | ||
</p> | ||
<ul class="list-unstyled mb-5"> | ||
<li class="d-flex mb-2"> | ||
<i class="text-success ri-checkbox-circle-fill display-2"></i> | ||
<span class="font-weight-bold ml-2">Publiez vos besoins auprès des structures, et retrouvez celles qui sont intéressées.</span> | ||
</li> | ||
<li class="d-flex mb-2"> | ||
<i class="text-success ri-checkbox-circle-fill display-2"></i> | ||
<span class="font-weight-bold ml-2">Téléchargez la liste complète des structures figurant sur le marché.</span> | ||
</li> | ||
<li class="d-flex mb-2"> | ||
<i class="text-success ri-checkbox-circle-fill display-2"></i> | ||
<span class="font-weight-bold ml-2">Créez des listes d'achat et sauvegardez vos structures favorites.</span> | ||
</li> | ||
<li class="d-flex mb-2"> | ||
<i class="text-success ri-checkbox-circle-fill display-2"></i> | ||
<span class="font-weight-bold ml-2">Accédez aux coordonnées des structures.</span> | ||
</li> | ||
</ul> | ||
<div class="text-center"> | ||
<a href="{% url 'auth:signup' %}?next=next-params-to-replace" id="auth-link" class="btn btn-sm btn-primary">Créer un compte</a> | ||
</div> | ||
<hr class="my-5" data-text="ou" /> | ||
<div class="text-center"> | ||
<p class="mb-0">Vous avez déjà un compte ?</p> | ||
<a href="{% url 'auth:login' %}?next=next-params-to-replace" id="auth-link" class="btn btn-sm btn-link">Se connecter</a> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<script type="text/javascript"> | ||
document.addEventListener("DOMContentLoaded", function() { | ||
const MODAL_ID = '#login_or_signup_modal'; | ||
$(MODAL_ID).on('show.bs.modal', function (event) { | ||
// Button that triggered the modal | ||
var button = $(event.relatedTarget); | ||
<script type="text/javascript"> | ||
document.addEventListener("DOMContentLoaded", function() { | ||
const MODAL_ID = '#login_or_signup_modal'; | ||
$(MODAL_ID).on('show.bs.modal', function (event) { | ||
// Button that triggered the modal | ||
var button = $(event.relatedTarget); | ||
|
||
// Extract info from data-* attributes | ||
var nextParams = button.data('next-params'); | ||
// Extract info from data-* attributes | ||
var nextParams = button.data('next-params'); | ||
|
||
// Update the modal's content | ||
// - replace next param for login & signup | ||
var modal = document.querySelector(MODAL_ID); | ||
modal.querySelectorAll('#auth-link').forEach(link => { | ||
var linkUrl = link.getAttribute('href'); | ||
link.setAttribute('href', linkUrl.replace('next-params-to-replace', nextParams)); | ||
// Update the modal's content | ||
// - replace next param for login & signup | ||
var modal = document.querySelector(MODAL_ID); | ||
modal.querySelectorAll('#auth-link').forEach(link => { | ||
var linkUrl = link.getAttribute('href'); | ||
link.setAttribute('href', linkUrl.replace('next-params-to-replace', nextParams)); | ||
}); | ||
}); | ||
}); | ||
}); | ||
</script> | ||
</script> | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
from django.test import TestCase | ||
from django.urls import reverse | ||
|
||
from lemarche.siaes.factories import SiaeFactory | ||
from lemarche.users.factories import UserFactory | ||
from lemarche.users.models import User | ||
|
||
|
||
class PagesHeaderLinkTest(TestCase): | ||
fixtures = [ | ||
"lemarche/fixtures/django/0a_networks.json", | ||
"lemarche/fixtures/django/0e_companies.json", | ||
"lemarche/fixtures/django/02_users.json", | ||
"lemarche/fixtures/django/20_cms.json", | ||
] | ||
|
||
@classmethod | ||
def setUpTestData(cls): | ||
cls.siae = SiaeFactory() | ||
cls.siae_user = UserFactory(kind=User.KIND_SIAE, siaes=[cls.siae]) | ||
cls.user_buyer = UserFactory(kind=User.KIND_BUYER, company_name="Entreprise Buyer") | ||
|
||
def test_anonymous_user_home(self): | ||
response = self.client.get("/") | ||
|
||
self.assertContains(response, "Publier un besoin d'achat") | ||
self.assertContains(response, reverse("tenders:create")) | ||
|
||
self.assertContains(response, "S'inscrire") | ||
self.assertNotContains(response, "Référencé ma structure") | ||
self.assertContains(response, reverse("auth:signup")) | ||
|
||
self.assertContains(response, "Se connecter") | ||
self.assertContains(response, reverse("auth:login")) | ||
|
||
self.assertNotContains(response, "Demandes reçues") | ||
self.assertNotContains(response, f'"{reverse("tenders:list")}"') | ||
|
||
self.assertNotContains(response, "Mon espace") | ||
self.assertNotContains(response, reverse("dashboard:home")) | ||
|
||
def test_anonymous_user_home_for_siae(self): | ||
response = self.client.get("/accueil-structure/") | ||
|
||
self.assertContains(response, "Publier un besoin d") | ||
self.assertContains(response, reverse("tenders:create")) | ||
|
||
self.assertNotContains(response, "S'inscrire") | ||
self.assertContains(response, "Référencé ma structure") | ||
self.assertContains(response, reverse("auth:signup")) | ||
|
||
self.assertContains(response, "Se connecter") | ||
self.assertContains(response, reverse("auth:login")) | ||
|
||
self.assertNotContains(response, "Demandes reçues") | ||
self.assertNotContains(response, f'"{reverse("tenders:list")}"') | ||
|
||
self.assertNotContains(response, "Mon espace") | ||
self.assertNotContains(response, reverse("dashboard:home")) | ||
|
||
def test_siae_user_home(self): | ||
self.client.force_login(self.siae_user) | ||
response = self.client.get("/") | ||
|
||
self.assertContains(response, "Publier un besoin d'achat") | ||
self.assertContains(response, reverse("tenders:create")) | ||
|
||
self.assertNotContains(response, "S'inscrire") | ||
self.assertNotContains(response, "Référencé ma structure") | ||
self.assertNotContains(response, reverse("auth:signup")) | ||
|
||
self.assertNotContains(response, "Se connecter") | ||
self.assertNotContains(response, reverse("auth:login")) | ||
|
||
self.assertContains(response, "Demandes reçues") | ||
self.assertContains(response, f'"{reverse("tenders:list")}"') | ||
|
||
self.assertContains(response, "Mon espace") | ||
self.assertContains(response, reverse("dashboard:home")) | ||
|
||
def test_buyer_user_home(self): | ||
self.client.force_login(self.user_buyer) | ||
response = self.client.get("/") | ||
|
||
self.assertContains(response, "Publier un besoin d'achat") | ||
self.assertContains(response, reverse("tenders:create")) | ||
|
||
self.assertNotContains(response, "S'inscrire") | ||
self.assertNotContains(response, "Référencé ma structure") | ||
self.assertNotContains(response, reverse("auth:signup")) | ||
|
||
self.assertNotContains(response, "Se connecter") | ||
self.assertNotContains(response, reverse("auth:login")) | ||
|
||
self.assertNotContains(response, "Demandes reçues") | ||
self.assertNotContains(response, f'"{reverse("tenders:list")}"') | ||
|
||
self.assertContains(response, "Mon espace") | ||
self.assertContains(response, reverse("dashboard:home")) |