-
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.
[Dépôt de besoin] Faire un encart dédié aux informations admin (#926)
* Tender detail: simple admin only info card * Add tests * Fix siae view count
- Loading branch information
Showing
7 changed files
with
119 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<div class="alert alert-warning"> | ||
<h2 class="h3">Informations Admin</h2> | ||
<div class="row"> | ||
<div class="col-12"> | ||
<ul class="list-unstyled mb-0"> | ||
<li class="mb-2"> | ||
Publié le {{ tender.published_at|date }} | ||
</li> | ||
<li class="mb-2"> | ||
{% if tender.is_validated %} | ||
Validé le {{ tender.validated_at|date }} | ||
{% else %} | ||
Statut : {{ tender.get_status_display }} | ||
{% endif %} | ||
</li> | ||
<li class="mb-2"> | ||
<i class="ri-focus-2-line"></i> | ||
{{ tender.siae_email_send_date_count }} prestataire{{ tender.siae_email_send_date_count|pluralize }} ciblé{{ tender.siae_email_send_date_count|pluralize }} | ||
</li> | ||
<li class="mb-2"> | ||
<i class="ri-focus-2-line"></i> | ||
{{ tender.siae_email_link_click_date_or_detail_display_date_count }} prestataire{{ tender.siae_email_link_click_date_or_detail_display_date_count|pluralize }} qui {{ tender.siae_email_link_click_date_or_detail_display_date_count|pluralize:'a,ont' }} vu | ||
</li> | ||
<li class="mb-2"> | ||
<i class="ri-thumb-up-line"></i> | ||
{{ tender.siae_detail_contact_click_date_count }} prestataire{{ tender.siae_detail_contact_click_date_count|pluralize }} intéressé{{ tender.siae_detail_contact_click_date_count|pluralize }} | ||
</li> | ||
{% if not tender.deadline_date_outdated %} | ||
<li class="mb-2"> | ||
Transactionné : | ||
{% if tender.siae_transactioned == None %} | ||
Inconnu | ||
{% else %} | ||
{{ tender.siae_transactioned.value|yesno:"Oui,Non" }} | ||
{% endif %} | ||
</li> | ||
{% endif %} | ||
<li> | ||
<a href="{% url 'admin:tenders_tender_change' tender.id %}" target="_blank" id="tender-detail-admin-btn" class="btn btn-sm btn-outline-primary btn-ico"> | ||
<span> | ||
Lien vers l'admin | ||
<i class="ri-external-link-line" aria-hidden="true"></i> | ||
</span> | ||
</a> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
</div> |
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
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 |
---|---|---|
|
@@ -1088,11 +1088,35 @@ def test_should_bring_the_siae_closer_to_the_city_to_the_top(self): | |
class SiaeDetailTest(TestCase): | ||
@classmethod | ||
def setUpTestData(cls): | ||
cls.user = UserFactory() | ||
cls.user_buyer = UserFactory(kind="BUYER") | ||
cls.user_partner = UserFactory(kind="PARTNER") | ||
cls.user_siae = UserFactory(kind="SIAE") | ||
cls.user_admin = UserFactory(kind="ADMIN") | ||
cls.siae = SiaeFactory(name="ABC Insertion") | ||
cls.siae.users.add(cls.user_siae) | ||
|
||
def test_should_display_contact_fields_to_authenticated_users(self): | ||
siae = SiaeFactory(name="Ma boite", contact_email="[email protected]") | ||
self.client.force_login(self.user) | ||
url = reverse("siae:detail", args=[siae.slug]) | ||
def test_should_display_contact_cta(self): | ||
url = reverse("siae:detail", args=[self.siae.slug]) | ||
# anonymous | ||
response = self.client.get(url) | ||
self.assertContains(response, "Contacter la structure") | ||
# authenticated | ||
for user in [self.user_buyer, self.user_partner, self.user_siae, self.user_admin]: | ||
self.client.force_login(user) | ||
response = self.client.get(url) | ||
self.assertContains(response, "Contacter la structure") | ||
|
||
def test_admin_has_extra_info(self): | ||
url = reverse("siae:detail", args=[self.siae.slug]) | ||
# anonymous | ||
response = self.client.get(url) | ||
self.assertNotContains(response, "Informations Admin") | ||
# other users | ||
for user in [self.user_buyer, self.user_partner, self.user_siae]: | ||
self.client.force_login(user) | ||
response = self.client.get(url) | ||
self.assertNotContains(response, "Informations Admin") | ||
# admin | ||
self.client.force_login(self.user_admin) | ||
response = self.client.get(url) | ||
self.assertContains(response, "Informations Admin") |
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