Adds user option to enable "sticky header"

This commit is contained in:
Oliver 2021-10-27 16:26:41 +11:00
parent 827ff0f58b
commit abf2093ab9
6 changed files with 41 additions and 4 deletions

View File

@ -1017,7 +1017,14 @@ class InvenTreeUserSetting(BaseInvenTreeSetting):
'description': _('Use the escape key to close modal forms'),
'default': False,
'validator': bool,
}
},
'STICKY_HEADER': {
'name': _('Fixed Navbar'),
'description': _('InvenTree navbar position is fixed to the top of the screen'),
'default': False,
'validator': bool,
},
}
class Meta:

View File

@ -42,6 +42,12 @@
</a>
</li>
<li class='list-group-item' title='{% trans "Display" %}'>
<a href='#' class='nav-toggle' id='select-user-display'>
<span class='fas fa-desktop'></span> {% trans "Display" %}
</a>
</li>
<li class='list-group-item' title='{% trans "Forms" %}'>
<a href='#' class='nav-toggle' id='select-user-forms'>
<span class='fas fa-table'></span>{% trans "Forms" %}

View File

@ -16,8 +16,8 @@
<td><strong>{% trans setting.name %}</strong></td>
<td>
{% if setting.is_bool %}
<div>
<input fieldname='{{ setting.key.upper }}' id='setting-value-{{ setting.key.upper }}' type='checkbox' disabled='' {% if setting.as_bool %}checked=''{% endif %}>
<div class='form-check form-switch'>
<input class='form-check-input' fieldname='{{ setting.key.upper }}' id='setting-value-{{ setting.key.upper }}' type='checkbox' disabled='' {% if setting.as_bool %}checked=''{% endif %}>
</div>
{% else %}
<div id='setting-{{ setting.pk }}'>

View File

@ -20,6 +20,7 @@
{% include "InvenTree/settings/user_search.html" %}
{% include "InvenTree/settings/user_labels.html" %}
{% include "InvenTree/settings/user_reports.html" %}
{% include "InvenTree/settings/user_display.html" %}
{% include "InvenTree/settings/user_forms.html" %}
{% if user.is_staff %}

View File

@ -0,0 +1,22 @@
{% extends "panel.html" %}
{% load i18n %}
{% load inventree_extras %}
{% block label %}user-display{% endblock %}
{% block heading %}
{% trans "Display Settings" %}
{% endblock %}
{% block content %}
<div class='row'>
<table class='table table-striped table-condensed'>
<tbody>
{% include "InvenTree/settings/setting.html" with key="STICKY_HEADER" icon="fa-bars" user_setting=True %}
</tbody>
</table>
</div>
{% endblock %}

View File

@ -3,8 +3,9 @@
{% load i18n %}
{% settings_value 'BARCODE_ENABLE' as barcodes %}
{% settings_value 'STICKY_HEADER' user=request.user as sticky %}
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<nav class="navbar {% if sticky %}fixed-top{% endif %} navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<div class="navbar-header clearfix content-heading">
<a class="navbar-brand" id='logo' href="{% url 'index' %}" style="padding-top: 7px; padding-bottom: 5px;"><img src="{% static 'img/inventree.png' %}" width="32" height="32" style="display:block; margin: auto;"/></a>