Skip to content

Commit

Permalink
fix(Besoins): répare l'ouverture au clic de 2 liens dfférents (#1148)
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn authored Mar 28, 2024
1 parent a4e2f1f commit f8b741e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 23 deletions.
5 changes: 5 additions & 0 deletions lemarche/static/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ window.addEventListener('DOMContentLoaded', function () {
initSuperBadges();
});
initSuperBadges();

// some elements have their url in data-url attribute
$(document).on("click", ".with-data-url", function(e) {
window.location.href = $(this).data("url");
});
});

let toggleRequiredClasses = (toggle, element) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,3 @@ <h1>Opportunités commerciales reçues par mes adhérents</h1>
</div>
</section>
{% endblock %}

{% block extra_js %}
<script type="text/javascript">
$(document).on("click", ".c-card--link", function(e) {
window.location.href = $(this).data("url");
});
</script>
{% endblock %}
8 changes: 3 additions & 5 deletions lemarche/templates/tenders/_list_item_buyer.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{% load static humanize %}

<div class="card c-card c-card--marche c-card--link siae-card" role="button" data-url="{% url 'tenders:detail' tender.slug %}">
<div class="card c-card c-card--marche siae-card">
<div class="card-body">
<div class="row">
<div class="col-md-8" style="border-right:1px solid;">
<div class="col-md-8 with-data-url" style="border-right:1px solid;cursor:pointer;" data-url="{% url 'tenders:detail' tender.slug %}">
<p class="mb-1">
{% include "tenders/_closed_badge.html" with tender=tender %}
{% if tender.is_draft %}
Expand All @@ -21,9 +21,7 @@
{% endif %}
</p>

<a href="{% url 'tenders:detail' tender.slug %}" class="text-decoration-none">
<h2 class="py-2">{{ tender.title }}</h2>
</a>
<h2 class="py-2">{{ tender.title }}</h2>

<div class="row">
<div class="col-md-4">
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,9 +1,9 @@
{% load static humanize %}

<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 c-card c-card--marche siae-card" role="button">
<div class="card-body">
<div class="row">
<div class="col-md-8" style="border-right:1px solid;">
<div class="col-md-8 with-data-url" style="border-right:1px solid;cursor:pointer;" data-url="{% url 'dashboard_networks:tender_detail' network.slug tender.slug %}">
<div class="row">
<div class="col-md-12">
<p class="mb-1">
Expand Down
8 changes: 0 additions & 8 deletions lemarche/templates/tenders/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,3 @@ <h1>{{ page_title }}</h1>
</div>
</section>
{% endblock %}

{% block extra_js %}
<script type="text/javascript">
$(document).on("click", ".c-card--link", function(e) {
window.location.href = $(this).data("url");
});
</script>
{% endblock %}

0 comments on commit f8b741e

Please sign in to comment.