human name for plugins

This commit is contained in:
Matthias 2021-10-04 12:31:12 +02:00
parent d1c2a399eb
commit 258d159093
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076
4 changed files with 12 additions and 4 deletions

View File

@ -255,6 +255,14 @@ class IntegrationPluginBase(MixinBase, plugin.InvenTreePlugin):
name = self.plugin_name()
return slugify(name)
@property
def human_name(self):
"""human readable name for labels etc."""
name = getattr(self, 'PLUGIN_TITLE', None)
if not name:
name = self.plugin_name()
return name
def mixin(self, key):
"""check if mixin is registered"""
return key in self._mixins

View File

@ -30,7 +30,7 @@
{% mixin_enabled plugin 'settings' as settings %}
<tr>
<td>{{plugin_key}} - {{ plugin.plugin_name}}
<td>{{plugin_key}} - {{ plugin.human_name }}
{% if urls %}
<span class='badge'><a class='nav-toggle text-success' id='select-plugin-{{plugin_key}}'>{% trans 'Has urls' %}</a></span>
{% endif %}
@ -42,7 +42,7 @@
{% if mixin_list %}
{% for mixin in mixin_list %}
<span class='badge'><a class='nav-toggle text-success' id='select-plugin-{{plugin_key}}'>
{% blocktrans with name=mixin.human_name%}has {{name}}{% endblocktrans %}</a></span>
{% blocktrans with name=mixin.human_name %}has {{name}}{% endblocktrans %}</a></span>
{% endfor %}
{% endif %}
</td>

View File

@ -7,7 +7,7 @@
{% block heading %}
{% blocktrans with name=plugin.plugin_name %}Plugin details for {{name}}{% endblocktrans %}
{% blocktrans with name=plugin.human_name %}Plugin details for {{name}}{% endblocktrans %}
{% endblock %}
{% block content %}

View File

@ -65,7 +65,7 @@
{% if navigation %}
<li class='nav navbar-nav'>
<a class='dropdown-toggle' data-toggle='dropdown' href='#'><span class='{{plugin.icon}} icon-header'></span>{{plugin.plugin_name}}</a>
<a class='dropdown-toggle' data-toggle='dropdown' href='#'><span class='{{plugin.icon}} icon-header'></span>{{plugin.human_name}}</a>
<ul class='dropdown-menu'>
{% for nav_item in plugin.navigation %}
<li><a href="{% url nav_item.link %}"><span class='{{nav_item.icon}} icon-header'></span>{{nav_item.name}}</a>