-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Permettre d'ajouter un lien libre depuis la fiche Zone
Permet d'ajouter et de voir les liens libres depuis la fiche Zone delimitée.
- Loading branch information
Showing
13 changed files
with
113 additions
and
56 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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
.fiche-detail__liens { | ||
grid-column: span 3; | ||
background-color: var(--fiche-detail-bloc-background-color); | ||
padding: var(--fiche-detail-bloc-padding); | ||
} |
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,14 @@ | ||
.fiche-action { | ||
display: flex; | ||
} | ||
|
||
.fiche-action .fr-translate__btn { | ||
line-height: 1.5rem; | ||
min-height: 2.5rem; | ||
padding: .5rem 1rem; | ||
} | ||
|
||
.fiche-action .fr-translate .fr-translate__btn::before { | ||
-webkit-mask-image: url(../../../static/icons/system/add-line.svg); | ||
mask-image: url(../../../static/icons/system/add-line.svg); | ||
} |
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,8 @@ | ||
document.addEventListener('DOMContentLoaded', function() { | ||
new Choices(document.getElementById('id_object_choice'), { | ||
classNames: { | ||
containerInner: 'fr-select', | ||
}, | ||
itemSelectText: '' | ||
}); | ||
}); |
File renamed without changes.
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,13 @@ | ||
<div class="fiche-detail__liens white-container {{ classes }}"> | ||
<h2>Liens libres</h2> | ||
{% for link in free_links_list %} | ||
{% if link.related_object_1 == fiche and not link.related_object_2.is_deleted %} | ||
<a class="fr-link fr-mr-2v" href="{{ link.related_object_2.get_absolute_url }}">{{ link.related_object_2 }}</a> | ||
{% endif %} | ||
{% if link.related_object_2 == fiche and not link.related_object_1.is_deleted %} | ||
<a class="fr-link fr-mr-2v" href="{{ link.related_object_1.get_absolute_url }}">{{ link.related_object_1 }}</a> | ||
{% endif %} | ||
{% empty %} | ||
<p>Pas de liens pour cette fiche.</p> | ||
{% endfor %} | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<nav role="navigation" class="fr-translate fr-nav"> | ||
<div class="fr-nav__item"> | ||
<button class="fr-translate__btn fr-btn fr-btn--lg" aria-controls="action-1" | ||
aria-expanded="false" title="Sélectionner une action">Actions</button> | ||
<div class="fr-collapse fr-translate__menu fr-menu" id="action-1"> | ||
<ul class="fr-menu__list"> | ||
<li><a class="fr-translate__language fr-nav__link" href="#" data-fr-opened="false" aria-controls="fr-modal-freelink"><span class="fr-icon-git-pull-request-fill fr-mr-2v fr-icon--sm" aria-hidden="true"></span>Ajouter un lien libre</a></li> | ||
</ul> | ||
</div> | ||
</div> | ||
</nav> |
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import pytest | ||
from django.contrib.contenttypes.models import ContentType | ||
|
||
from core.models import LienLibre | ||
from playwright.sync_api import expect | ||
|
||
|
||
@pytest.mark.django_db | ||
def test_can_add_free_link(live_server, page, fiche_zone_bakery, choice_js_fill): | ||
fiche = fiche_zone_bakery() | ||
other_fiche = fiche_zone_bakery() | ||
page.goto(f"{live_server.url}{fiche.get_absolute_url()}") | ||
|
||
page.get_by_role("button", name="Actions").click() | ||
page.get_by_role("link", name="Ajouter un lien libre").click() | ||
page.wait_for_selector("#fr-modal-freelink .choices__list--single") | ||
choice_js_fill( | ||
page, | ||
"#fr-modal-freelink .choices__list--single", | ||
f"Fiche Zone Delimitee: {str(other_fiche.numero)}", | ||
f"Fiche Zone Delimitee: {str(other_fiche.numero)}", | ||
) | ||
page.get_by_test_id("submit-freelink").click() | ||
|
||
expect(page.get_by_text("Le lien a été créé avec succès.")).to_be_visible() | ||
|
||
link = LienLibre.objects.get() | ||
assert link.content_type_1 == ContentType.objects.get_for_model(other_fiche) | ||
assert link.content_type_2 == ContentType.objects.get_for_model(other_fiche) | ||
assert link.object_id_1 == fiche.pk | ||
assert link.object_id_2 == other_fiche.pk | ||
|
||
expect(page.get_by_role("link", name=str(other_fiche.numero))).to_be_visible() |
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