Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: menu bar #99

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 48 additions & 1 deletion uipa_org/templates/header.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{% extends "header.html" %}

{% load i18n %}
{% load content_helper %}
{% load static %}

<!-- Disable language selection, since we only support English -->
Expand Down Expand Up @@ -30,4 +31,50 @@
</a>
</li>
</ul>
{% endblock %}
{% endblock %}

{% block nav_account_login %}
{% if request.user.is_authenticated %}
<li class="nav-item dropdown account-dropdown {% block nav_account %}{% endblock %}">
<a class="nav-link dropdown-toggle account-dropdown-link"
data-bs-toggle="dropdown"
href="#"
aria-haspopup="true"
aria-expanded="false"
id="navbaraccount-link">
<span class="d-none d-md-none d-lg-inline">
Profile
Copy link
Member

@russtoku russtoku May 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the logged in user's first name should be kept to provide an indication as to who is logged in. This is accomplished with:

{% blocktrans with name=request.user.first_name|truncatechars:12 %}                               
    Profile ({{ name }})                                                                            
{% endblocktrans %} 

However, if the logged in user doesn't have the First name and the Last name fields populated, the first name won't be shown.

</span>
<span class="d-lg-none fa fa-user-circle-o"></span>
</a>
<div class="dropdown-menu dropdown-menu-right"
aria-labelledby="navbaraccount-link">
{% include "account/menu.html" with menu_items=menu_items %}
<div class="dropdown-divider"></div>
<div class="dropdown-item">
<form action="{% url 'account-logout' %}" method="post" class="text-center">
{% csrf_token %}
<button type="submit" class="btn btn-secondary">{% blocktrans %}Logout{% endblocktrans %}</button>
</form>
</div>
</div>
</li>
{% else %}
<li class="nav-item {% block nav_login %}{% endblock %}">
<a class="nav-link"
href="{% url 'account-login' %}?next={{ request.get_full_path|urlencode }}">
{% blocktrans %}Sign in{% endblocktrans %}
</a>
</li>
{% endif %}
{% endblock nav_account_login %}

{% block nav_secondary %}
<ul class="navbar-nav navbar-nav-secondary col-auto">
<li class="nav-item">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's safe to remove this line item.

</li>
<li class="nav-item special-nav-secondary-item">
<a class="nav-link" href="{% content_url 'help' %}">{% trans "Help" %}</a>
</li>
</ul>
{% endblock nav_secondary %}
17 changes: 17 additions & 0 deletions uipa_org/templates/header_minimal.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% extends "header.html" %}
{% load i18n %}
{% block nav_search %}{% endblock %}
{% block nav %}
{% endblock nav %}
{% block nav_secondary %}
<ul class="navbar-nav navbar-nav-secondary col-auto">
</ul>
{% endblock %}
{% block nav_account_login %}
{% if request.user.is_authenticated %}
<li class="nav-item dropdown account-dropdown {% block nav_account %}{% endblock %}">
<span class="d-none d-md-none d-lg-inline">
Profile
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as header.html.

</li>
{% endif %}
{% endblock nav_account_login %}