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", "") 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(): def inventreeVersion():
""" Returns the InvenTree version string """ """ Returns the InvenTree version string """
return INVENTREE_SW_VERSION return INVENTREE_SW_VERSION

View File

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

View File

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

View File

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

View File

@ -58,6 +58,13 @@ class InvenTreeSetting(models.Model):
'description': _('String descriptor for the server instance'), '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': { 'INVENTREE_COMPANY_NAME': {
'name': _('Company name'), 'name': _('Company name'),
'description': _('Internal company name'), 'description': _('Internal company name'),

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -73,6 +73,12 @@ def inventree_instance_name(*args, **kwargs):
return version.inventreeInstanceName() 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() @register.simple_tag()
def inventree_version(*args, **kwargs): def inventree_version(*args, **kwargs):
""" Return InvenTree version string """ """ Return InvenTree version string """

View File

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

View File

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

View File

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

View File

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

View File

@ -16,6 +16,7 @@
{% include "InvenTree/settings/header.html" %} {% include "InvenTree/settings/header.html" %}
<tbody> <tbody>
{% include "InvenTree/settings/setting.html" with key="INVENTREE_INSTANCE" icon="fa-info-circle" %} {% 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_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_COMPANY_NAME" icon="fa-building" %}
{% include "InvenTree/settings/setting.html" with key="INVENTREE_DEFAULT_CURRENCY" icon="fa-dollar-sign" %} {% include "InvenTree/settings/setting.html" with key="INVENTREE_DEFAULT_CURRENCY" icon="fa-dollar-sign" %}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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