Merge pull request #1262 from SchrodingersGat/hide-barcode-button

Hide main QR button if setting is disabled
This commit is contained in:
Oliver 2021-01-29 13:06:48 +11:00 committed by GitHub
commit cb81d8b66a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 4 deletions

View File

@ -2,6 +2,8 @@
{% load i18n %} {% load i18n %}
{% load inventree_extras %} {% load inventree_extras %}
{% settings_value 'BARCODE_ENABLE' as barcodes %}
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
@ -145,9 +147,11 @@ $(document).ready(function () {
showCachedAlerts(); showCachedAlerts();
{% if barcodes %}
$('#barcode-scan').click(function() { $('#barcode-scan').click(function() {
barcodeScanDialog(); barcodeScanDialog();
}); });
{% endif %}
}); });

View File

@ -1,5 +1,9 @@
{% load static %} {% load static %}
{% load inventree_extras %}
{% load i18n %} {% load i18n %}
{% settings_value 'BARCODE_ENABLE' as barcodes %}
<nav class="navbar navbar-xs navbar-default navbar-fixed-top "> <nav class="navbar navbar-xs navbar-default navbar-fixed-top ">
<div class="container-fluid"> <div class="container-fluid">
<div class="navbar-header clearfix content-heading"> <div class="navbar-header clearfix content-heading">
@ -46,11 +50,13 @@
</ul> </ul>
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
{% include "search_form.html" %} {% include "search_form.html" %}
{% if barcodes %}
<li id='navbar-barcode-li'> <li id='navbar-barcode-li'>
<button id='barcode-scan' class='btn btn-default' title='{% trans "Scan Barcode" %}'> <button id='barcode-scan' class='btn btn-default' title='{% trans "Scan Barcode" %}'>
<span class='fas fa-qrcode'></span> <span class='fas fa-qrcode'></span>
</button> </button>
</li> </li>
{% endif %}
<li class='dropdown'> <li class='dropdown'>
<a class='dropdown-toggle' data-toggle='dropdown' href="#"> <a class='dropdown-toggle' data-toggle='dropdown' href="#">
{% if not system_healthy %} {% if not system_healthy %}
@ -61,14 +67,13 @@
{% if user.is_authenticated %} {% if user.is_authenticated %}
{% if user.is_staff %} {% if user.is_staff %}
<li><a href="/admin/"><span class="fas fa-user"></span> {% trans "Admin" %}</a></li> <li><a href="/admin/"><span class="fas fa-user"></span> {% trans "Admin" %}</a></li>
<hr>
{% endif %} {% endif %}
<li><a href="{% url 'settings' %}"><span class="fas fa-cog"></span> {% trans "Settings" %}</a></li>
<li><a href="{% url 'logout' %}"><span class="fas fa-sign-out-alt"></span> {% trans "Logout" %}</a></li> <li><a href="{% url 'logout' %}"><span class="fas fa-sign-out-alt"></span> {% trans "Logout" %}</a></li>
{% else %} {% else %}
<li><a href="{% url 'login' %}"><span class="fas fa-sign-in-alt"></span> {% trans "Login" %}</a></li> <li><a href="{% url 'login' %}"><span class="fas fa-sign-in-alt"></span> {% trans "Login" %}</a></li>
{% endif %} {% endif %}
<hr> <hr>
<li><a href="{% url 'settings' %}"><span class="fas fa-cog"></span> {% trans "Settings" %}</a></li>
<li id='launch-stats'><a href='#'> <li id='launch-stats'><a href='#'>
{% if system_healthy %} {% if system_healthy %}
<span class='fas fa-server'> <span class='fas fa-server'>