Skip to content

Commit

Permalink
feat: Add a bug report link to the menu bar (#4525)
Browse files Browse the repository at this point in the history
This required making some horizontal room for it, mostly by showing a
user photo or shorter tag when they are logged in.
  • Loading branch information
larseggert authored Sep 30, 2022
1 parent 9b896e5 commit 3e2b1fc
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 14 deletions.
7 changes: 7 additions & 0 deletions ietf/static/css/ietf.scss
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,13 @@ th {
}
}

// Style the navbar user photo
.nav-link .user-photo {
object-fit: cover;
height: 40px;
width: 40px;
}

// Style the righthand navigation panel
#righthand-panel {
max-height: 80vh;
Expand Down
31 changes: 20 additions & 11 deletions ietf/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,32 @@
<img alt="IETF Logo" class="me-2"
src="{% static 'ietf/images/ietf-logo-nor-white.svg' %}">
Datatracker
{% if server_mode and server_mode != "production" %}Dev Mode{% endif %}
{% if server_mode and server_mode != "production" %}
<span class="text-danger">&delta;</span>
{% endif %}
</a>
<div class="collapse navbar-collapse" id="navbar-collapse">
<ul class="nav navbar-nav">
{% include "base/menu.html" with flavor="top" %}
</ul>
</div>
{% if not user.is_authenticated %}
<a class="d-none d-sm-block mx-5 btn {% if server_mode and server_mode == "production" %} btn-warning {% else %} btn-info {% endif %}"
rel="nofollow"
href="{% url 'ietf.ietfauth.views.login' %}?next={{ request.get_full_path|removesuffix:'accounts/logout/'|urlencode }}">
Sign
in
<div class="d-flex align-items-center">
<a class="nav-link {% if server_mode and server_mode != "production" %}text-danger{% else %}text-warning{% endif %} d-none d-xl-inline me-xl-4"
target="_blank"
href="https://github.com/ietf-tools/datatracker/issues/new/choose">
Report a bug
<i class="bi bi-bug"></i>
</a>
{% endif %}
<div class="d-flex d-none d-lg-block">
<label aria-label="Document search">

{% if not user.is_authenticated %}
<a class="btn me-1 {% if server_mode and server_mode == "production" %} btn-warning {% else %} btn-info {% endif %} d-none d-sm-block"
rel="nofollow"
href="{% url 'ietf.ietfauth.views.login' %}?next={{ request.get_full_path|removesuffix:'accounts/logout/'|urlencode }}">
Sign in
</a>
{% endif %}

<label class="d-none d-md-block" aria-label="Document search">
<input class="form-control select2-field"
id="navbar-doc-search"
data-select2-ajax-url="{% url 'ietf.doc.views_search.ajax_select2_search_docs' model_name='docalias' doc_type='draft' %}"
Expand Down Expand Up @@ -137,7 +146,7 @@
<span class="mx-2 text-danger">
<i class="bi bi-bug"></i>
Report a bug:
<a class="text-reset" href="https://github.com/ietf-tools/datatracker/issues/new/choose">GitHub</a>
<a class="text-reset" target="_blank" href="https://github.com/ietf-tools/datatracker/issues/new/choose">GitHub</a>
{% if bugreport_email %}
<a class="text-reset" href="mailto:{{ bugreport_email }}">Email</a>
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion ietf/templates/base/menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@
{% endif %}
<li>
<a class="dropdown-item text-danger {% if flavor != 'top' %}text-wrap link-primary{% endif %}"
href="https://github.com/ietf-tools/datatracker/issues/new/choose">
target="_blank" href="https://github.com/ietf-tools/datatracker/issues/new/choose">
<i class="bi bi-bug">
</i>
Report a bug
Expand Down
10 changes: 8 additions & 2 deletions ietf/templates/base/menu_user.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@
<li class="nav-item dropdown">
{% if flavor == "top" %}
<a href="#"
class="nav-link dropdown-toggle"
class="nav-link dropdown-toggle{% if user.person.photo_thumb %} p-0{% endif %}"
role="button"
data-bs-toggle="dropdown"
aria-expanded="false">
{% if user.is_authenticated %}
{{ user }}
{% if user.person.photo_thumb %}
<img class="user-photo rounded-circle ms-1" width="40" height="40"
src="{{ user.person.photo_thumb.url }}"
alt="Photo of {{ user.person.name }}">
{% else %}
{{ user.username|split:'@'|first }}
{% endif %}
{% else %}
User
{% endif %}
Expand Down

0 comments on commit 3e2b1fc

Please sign in to comment.