Merge pull request #1481 from matmair/instance-name-in-title

Instance name in title
This commit is contained in:
Oliver 2021-04-18 21:48:37 +10:00 committed by GitHub
commit 157d58b157
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 72 additions and 38 deletions

View File

@ -19,6 +19,14 @@ def inventreeInstanceName():
return common.models.InvenTreeSetting.get_setting("INVENTREE_INSTANCE", "")
def inventreeInstanceTitle():
""" Returns the InstanceTitle for the current database """
if common.models.InvenTreeSetting.get_setting("INVENTREE_INSTANCE_TITLE", False):
return common.models.InvenTreeSetting.get_setting("INVENTREE_INSTANCE", "")
else:
return 'InvenTree'
def inventreeVersion():
""" Returns the InvenTree version string """
return INVENTREE_SW_VERSION

View File

@ -4,7 +4,7 @@
{% load inventree_extras %}
{% block page_title %}
InvenTree | Allocate Parts
{% inventree_title %} | {% trans "Allocate Parts" %}
{% endblock %}
{% block menubar %}

View File

@ -6,7 +6,7 @@
{% load inventree_extras %}
{% block page_title %}
InvenTree | {% trans "Build Order" %} - {{ build }}
{% inventree_title %} | {% trans "Build Order" %} - {{ build }}
{% endblock %}
{% block pre_content %}

View File

@ -5,7 +5,7 @@
{% load i18n %}
{% block page_title %}
InvenTree | {% trans "Build Orders" %}
{% inventree_title %} | {% trans "Build Orders" %}
{% endblock %}
{% block content %}

View File

@ -58,6 +58,13 @@ class InvenTreeSetting(models.Model):
'description': _('String descriptor for the server instance'),
},
'INVENTREE_INSTANCE_TITLE': {
'name': _('Use instance name'),
'description': _('Use the instance name in the title-bar'),
'validator': bool,
'default': False,
},
'INVENTREE_COMPANY_NAME': {
'name': _('Company name'),
'description': _('Internal company name'),

View File

@ -6,7 +6,7 @@
{% block page_title %}
InvenTree | {% trans "Company" %} - {{ company.name }}
{% inventree_title %} | {% trans "Company" %} - {{ company.name }}
{% endblock %}

View File

@ -2,9 +2,10 @@
{% load static %}
{% load i18n %}
{% load inventree_extras %}
{% block page_title %}
InvenTree | {% trans "Supplier List" %}
{% inventree_title %} | {% trans "Supplier List" %}
{% endblock %}
{% block content %}

View File

@ -1,9 +1,10 @@
{% extends "two_column.html" %}
{% load static %}
{% load i18n %}
{% load inventree_extras %}
{% block page_title %}
InvenTree | {% trans "Supplier Part" %}
{% inventree_title %} | {% trans "Supplier Part" %}
{% endblock %}
{% block thumbnail %}

View File

@ -6,7 +6,7 @@
{% load status_codes %}
{% block page_title %}
InvenTree | {% trans "Purchase Order" %}
{% inventree_title %} | {% trans "Purchase Order" %}
{% endblock %}
{% block thumbnail %}

View File

@ -5,7 +5,7 @@
{% load i18n %}
{% block page_title %}
InvenTree | {% trans "Purchase Orders" %}
{% inventree_title %} | {% trans "Purchase Orders" %}
{% endblock %}
{% block content %}

View File

@ -6,7 +6,7 @@
{% load status_codes %}
{% block page_title %}
InvenTree | {% trans "Sales Order" %}
{% inventree_title %} | {% trans "Sales Order" %}
{% endblock %}
{% block pre_content %}

View File

@ -5,7 +5,7 @@
{% load i18n %}
{% block page_title %}
InvenTree | {% trans "Sales Orders" %}
{% inventree_title %} | {% trans "Sales Orders" %}
{% endblock %}
{% block content %}

View File

@ -1,14 +1,15 @@
{% extends "base.html" %}
{% load static %}
{% load i18n %}
{% load inventree_extras %}
{% block page_title %}
{% if part %}
InvenTree | {% trans "Part" %} - {{ part.full_name }}
{% inventree_title %} | {% trans "Part" %} - {{ part.full_name }}
{% elif category %}
InvenTree | {% trans "Part Category" %} - {{ category }}
{% inventree_title %} | {% trans "Part Category" %} - {{ category }}
{% else %}
InvenTree | {% trans "Part List" %}
{% inventree_title %} | {% trans "Part List" %}
{% endif %}
{% endblock %}

View File

@ -73,6 +73,12 @@ def inventree_instance_name(*args, **kwargs):
return version.inventreeInstanceName()
@register.simple_tag()
def inventree_title(*args, **kwargs):
""" Return the title for the current instance - respecting the settings """
return version.inventreeInstanceTitle()
@register.simple_tag()
def inventree_version(*args, **kwargs):
""" Return InvenTree version string """

View File

@ -5,7 +5,7 @@
{% load i18n %}
{% block page_title %}
InvenTree | {% trans "Stock Item" %} - {{ item }}
{% inventree_title %} | {% trans "Stock Item" %} - {{ item }}
{% endblock %}
{% block sidenav %}

View File

@ -1,12 +1,13 @@
{% extends "base.html" %}
{% load static %}
{% load i18n %}
{% load inventree_extras %}
{% block page_title %}
{% if location %}
InvenTree | {% trans "Stock Location" %} - {{ location }}
{% inventree_title %} | {% trans "Stock Location" %} - {{ location }}
{% else %}
InvenTree | {% trans "Stock" %}
{% inventree_title %} | {% trans "Stock" %}
{% endif %}
{% endblock %}

View File

@ -2,12 +2,13 @@
{% load i18n %}
{% load static %}
{% load inventree_extras %}
{% block page_title %}
InvenTree | {% trans "Index" %}
{% inventree_title %} | {% trans "Index" %}
{% endblock %}
{% block content %}
<h3>InvenTree</h3>
<h3>{% inventree_title %} </h3>
<hr>
<div class='col-sm-3' id='item-panel'>

View File

@ -5,7 +5,7 @@
{% load inventree_extras %}
{% block page_title %}
InvenTree | {% trans "Search Results" %}
{% inventree_title %} | {% trans "Search Results" %}
{% endblock %}
{% block content %}

View File

@ -16,6 +16,7 @@
{% include "InvenTree/settings/header.html" %}
<tbody>
{% include "InvenTree/settings/setting.html" with key="INVENTREE_INSTANCE" icon="fa-info-circle" %}
{% include "InvenTree/settings/setting.html" with key="INVENTREE_INSTANCE_TITLE" icon="fa-info-circle" %}
{% include "InvenTree/settings/setting.html" with key="INVENTREE_BASE_URL" icon="fa-globe" %}
{% include "InvenTree/settings/setting.html" with key="INVENTREE_COMPANY_NAME" icon="fa-building" %}
{% include "InvenTree/settings/setting.html" with key="INVENTREE_DEFAULT_CURRENCY" icon="fa-dollar-sign" %}

View File

@ -2,9 +2,10 @@
{% load i18n %}
{% load static %}
{% load inventree_extras %}
{% block page_title %}
InvenTree | {% trans "Settings" %}
{% inventree_title %} | {% trans "Settings" %}
{% endblock %}
{% block content %}

View File

@ -60,7 +60,7 @@
<title>
{% block page_title %}
InvenTree
{% inventree_title %}
{% endblock %}
</title>
</head>

View File

@ -1,6 +1,7 @@
{% load static %}
{% load i18n %}
{% load crispy_forms_tags %}
{% load crispy_forms_tags %}
{% load inventree_extras %}
<!DOCTYPE html>
<html lang="en">
@ -29,7 +30,7 @@
</style>
<title>
InvenTree
{% inventree_title %}
</title>
</head>
@ -42,7 +43,7 @@
<div class='container-fluid'>
<div class='clearfix content-heading login-header'>
<img class="pull-left" src="{% static 'img/inventree.png' %}" width="60" height="60"/>
<span><h3>InvenTree</h3></span>
<span><h3>{% inventree_title %} </h3></span>
</div>
<hr>

View File

@ -1,5 +1,6 @@
{% load static %}
{% load i18n %}
{% load inventree_extras %}
<!DOCTYPE html>
<html lang="en">
@ -28,7 +29,7 @@
</style>
<title>
InvenTree
{% inventree_title %}
</title>
</head>
@ -44,7 +45,7 @@
<div class='container-fluid'>
<div class='clearfix content-heading login-header'>
<img class="pull-left" src="{% static 'img/inventree.png' %}" width="60" height="60"/>
<span><h3>InvenTree</h3></span>
<span><h3>{% inventree_title %} </h3></span>
</div>
<hr>

View File

@ -1,6 +1,7 @@
{% load static %}
{% load i18n %}
{% load crispy_forms_tags %}
{% load crispy_forms_tags %}
{% load inventree_extras %}
<!DOCTYPE html>
<html lang="en">
@ -29,7 +30,7 @@
</style>
<title>
InvenTree
{% inventree_title %}
</title>
</head>
@ -42,7 +43,7 @@
<div class='container-fluid'>
<div class='clearfix content-heading login-header'>
<img class="pull-left" src="{% static 'img/inventree.png' %}" width="60" height="60"/>
<span><h3>InvenTree</h3></span>
<span><h3>{% inventree_title %} </h3></span>
</div>
<hr>

View File

@ -1,6 +1,7 @@
{% load static %}
{% load i18n %}
{% load crispy_forms_tags %}
{% load crispy_forms_tags %}
{% load inventree_extras %}
<!DOCTYPE html>
<html lang="en">
@ -29,7 +30,7 @@
</style>
<title>
InvenTree
{% inventree_title %}
</title>
</head>
@ -42,7 +43,7 @@
<div class='container-fluid'>
<div class='clearfix content-heading login-header'>
<img class="pull-left" src="{% static 'img/inventree.png' %}" width="60" height="60"/>
<span><h3>InvenTree</h3></span>
<span><h3>{% inventree_title %} </h3></span>
</div>
<hr>

View File

@ -1,6 +1,7 @@
{% load static %}
{% load i18n %}
{% load crispy_forms_tags %}
{% load crispy_forms_tags %}
{% load inventree_extras %}
<!DOCTYPE html>
<html lang="en">
@ -29,7 +30,7 @@
</style>
<title>
InvenTree
{% inventree_title %}
</title>
</head>
@ -42,7 +43,7 @@
<div class='container-fluid'>
<div class='clearfix content-heading login-header'>
<img class="pull-left" src="{% static 'img/inventree.png' %}" width="60" height="60"/>
<span><h3>InvenTree</h3></span>
<span><h3>{% inventree_title %} </h3></span>
</div>
<hr>
<div class='container-fluid'>

View File

@ -1,6 +1,7 @@
{% load static %}
{% load i18n %}
{% load crispy_forms_tags %}
{% load crispy_forms_tags %}
{% load inventree_extras %}
<!DOCTYPE html>
<html lang="en">
@ -29,7 +30,7 @@
</style>
<title>
InvenTree
{% inventree_title %}
</title>
</head>
@ -42,7 +43,7 @@
<div class='container-fluid'>
<div class='clearfix content-heading login-header'>
<img class="pull-left" src="{% static 'img/inventree.png' %}" width="60" height="60"/>
<span><h3>InvenTree</h3></span>
<span><h3>{% inventree_title %} </h3></span>
</div>
<hr>