Skip to content

Commit

Permalink
fix: dropdown structure
Browse files Browse the repository at this point in the history
  • Loading branch information
hellodeloo committed Apr 29, 2024
1 parent 5ee2233 commit c91cf43
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions itou/templates/layout/_header_nav_primary_items.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
</li>
{% if user.is_authenticated %}
{% if request.organizations|length > 1 %}
{# If the name of the organisation.display_name is longer than the .dropdown-structure width, it will be automatically truncated in css and it will be displayed in full in a tooltip. #}
<li class="dropdown dropdown-structure">
<button type="button"
class="btn btn-outline-primary btn-ico dropdown-toggle"
Expand All @@ -56,27 +57,28 @@
{% elif user.is_prescriber %}
<i class="ri-home-smile-line" aria-hidden="true"></i>
{% endif %}

<span>{{ request.current_organization.kind }} - {{ request.current_organization.display_name|truncatechars:40 }}</span>
<span>{{ request.current_organization.kind }} - {{ request.current_organization.display_name }}</span>
</button>
<div class="dropdown-menu {% if is_mobile %}w-auto{% else %}w-100{% endif %}" id="switchUserDropdown{% if is_mobile %}Mobile{% endif %}">
<form action="{% url 'dashboard:switch_organization' %}" method="post">
{% csrf_token %}
<ul class="list-unstyled">
{% for org in request.organizations %}
{% if org.pk != request.current_organization.pk %}
<li>
<button class="dropdown-item dropdown-item__summary" name="organization_id" value="{{ org.pk }}">
{% if user.is_employer %}
<i class="ri-community-line" aria-hidden="true"></i>
{% elif user.is_prescriber %}
<i class="ri-home-smile-line" aria-hidden="true"></i>
{% endif %}
<span>{{ org.kind }}</span>
<strong>{{ org.display_name|truncatechars:50 }}</strong>
</button>
</li>
{% endif %}
<li>
<button class="dropdown-item dropdown-item__summary{% if org.pk == request.current_organization.pk %} active{% endif %}" name="organization_id" value="{{ org.pk }}">
{% if user.is_employer %}
<i class="ri-community-line" aria-hidden="true"></i>
{% elif user.is_prescriber %}
<i class="ri-home-smile-line" aria-hidden="true"></i>
{% endif %}
<span>{{ org.kind }}</span>
{% if not is_mobile and org.display_name|length > 18 %}
<strong data-bs-toggle="tooltip" data-bs-title="{{ org.display_name }}">{{ org.display_name }}</strong>
{% else %}
<strong>{{ org.display_name }}</strong>
{% endif %}
</button>
</li>
{% endfor %}
</ul>
</form>
Expand Down

0 comments on commit c91cf43

Please sign in to comment.