Skip to content

Commit

Permalink
fix(Structures): Détail : améliorer les informations affichées aux ad…
Browse files Browse the repository at this point in the history
…min (#1238)
  • Loading branch information
raphodn authored May 30, 2024
1 parent b352489 commit 73dd4d9
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 26 deletions.
2 changes: 1 addition & 1 deletion lemarche/templates/includes/_tracker_itou.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
// Optionnaly add meta data (in key/value pairs) from url query string
const meta = Object.assign(metaIn, getUrlMeta());
// user info
meta['is_admin'] = {% if user.is_authenticated %}{% if user.kind == 'ADMIN' %}true{% else %}false{% endif %}{% else %}false{% endif %};
meta['is_admin'] = {% if user.is_authenticated %}{% if user.is_admin %}true{% else %}false{% endif %}{% else %}false{% endif %};
meta['user_kind'] = {% if user.is_authenticated %}'{{ user.kind }}'{% else %}null{% endif %};
meta['user_id'] = {% if user.is_authenticated %}{{ user.id }}{% else %}null{% endif %};
meta['siae_id'] = {% if siae %}{{ siae.id }}{% else %}null{% endif %};
Expand Down
36 changes: 16 additions & 20 deletions lemarche/templates/siaes/_detail_admin_extra_info.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,22 @@ <h2 class="h3">Informations Admin</h2>
<div class="row">
<div class="col-12">
<ul class="list-unstyled mb-0">
{% if siae.user_count %}
{% if siae.contact_short_name %}
<li class="mb-2">
<i class="ri-user-line"></i>
<span>{{ siae.contact_short_name }}</span>
</li>
{% endif %}
{% endif %}
{% if siae.contact_email %}
<li class="mb-2">
<i class="ri-at-line"></i>
<a href="mailto:{{ siae.contact_email }}" id="company_email">{{ siae.contact_email }}</a>
</li>
{% endif %}
{% if siae.contact_phone %}
<li class="mb-2">
<i class="ri-phone-line"></i>
<a href="tel:{{ siae.contact_phone }}" id="company_phone">{{ siae.contact_phone }}</a>
</li>
{% endif %}
<li class="mb-2">
<i class="ri-user-line"></i>
<span>{{ siae.contact_full_name }}</span>
</li>
<li class="mb-2">
<i class="ri-at-line"></i>
<a href="mailto:{{ siae.contact_email }}" id="company_email">{{ siae.contact_email }}</a>
</li>
<li class="mb-2">
<i class="ri-phone-line"></i>
<a href="tel:{{ siae.contact_phone }}" id="company_phone">{{ siae.contact_phone }}</a>
</li>
<li class="mb-2">
<i class="ri-group-line"></i>
{{ siae.user_count }} collaborateur{{ siae.user_count|pluralize }}
</li>
<li>
<a href="{{ siae.get_admin_url }}" target="_blank" id="siae-detail-admin-btn" class="btn btn-sm btn-outline-primary btn-ico">
<span>
Expand Down
2 changes: 1 addition & 1 deletion lemarche/templates/siaes/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<aside id="sidebar">
<div class="profile mb-4">
<div class="profile_capsule">
{% if is_admin %}
{% if user.is_authenticated and user.is_admin %}
{% include "siaes/_detail_admin_extra_info.html" with siae=siae %}
{% endif %}
{% if inbound_email_is_activated %}
Expand Down
2 changes: 1 addition & 1 deletion lemarche/templates/tenders/_detail_sidebar.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- admin info -->
{% load info_card_cms %}
{% if is_admin %}
{% if user.is_authenticated and user.is_admin %}
{% include "tenders/_detail_admin_extra_info.html" with tender=tender %}
{% endif %}
<!-- author stats info -->
Expand Down
2 changes: 0 additions & 2 deletions lemarche/www/siaes/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ def get_context_data(self, **kwargs):
context["siaes_json"] = serialize(
"geojson", context["siaes"], geometry_field="coords", fields=("id", "name", "brand", "slug")
)
context["is_admin"] = self.request.user.is_authenticated and self.request.user.is_admin
return context


Expand Down Expand Up @@ -280,7 +279,6 @@ def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["current_search_query"] = self.request.session.get(CURRENT_SEARCH_QUERY_COOKIE_NAME, "")
context["inbound_email_is_activated"] = settings.INBOUND_EMAIL_IS_ACTIVATED
context["is_admin"] = self.request.user.is_authenticated and self.request.user.is_admin
return context


Expand Down
1 change: 0 additions & 1 deletion lemarche/www/tenders/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,6 @@ def get_context_data(self, **kwargs):
user_kind = user.kind if user.is_authenticated else "anonymous"
show_nps = self.request.GET.get("nps", None)
# enrich context
context["is_admin"] = self.request.user.is_authenticated and self.request.user.is_admin
context["parent_title"] = TITLE_DETAIL_PAGE_SIAE if user_kind == User.KIND_SIAE else TITLE_DETAIL_PAGE_OTHERS
context["tender_kind_display"] = (
tender_constants.KIND_PROJECT_SIAE_DISPLAY
Expand Down

0 comments on commit 73dd4d9

Please sign in to comment.