website info for plugins

This commit is contained in:
Matthias 2021-10-06 10:54:57 +02:00
parent f1fd1d4da8
commit eeeb69ce12
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076
4 changed files with 24 additions and 0 deletions

View File

@ -261,6 +261,7 @@ class IntegrationPluginBase(MixinBase, plugin.InvenTreePlugin):
AUTHOR = None
PUBLISH_DATE = None
VERSION = None
WEBSITE = None
def __init__(self):
super().__init__()
@ -315,6 +316,12 @@ class IntegrationPluginBase(MixinBase, plugin.InvenTreePlugin):
name = getattr(self, 'VERSION', None)
return name
@property
def website(self):
"""returns website of plugin"""
name = getattr(self, 'WEBSITE', None)
return name
# mixins
def mixin(self, key):
"""check if mixin is registered"""

View File

@ -136,6 +136,7 @@ class IntegrationPluginBaseTests(TestCase):
PLUGIN_TITLE = 'a titel'
PUBLISH_DATE = "1111-11-11"
VERSION = '1.2.3a'
WEBSITE = 'http://aa.bb/cc'
self.plugin_name = NameIntegrationPluginBase()
@ -163,3 +164,8 @@ class IntegrationPluginBaseTests(TestCase):
self.assertEqual(self.plugin.version, None)
self.assertEqual(self.plugin_simple.version, None)
self.assertEqual(self.plugin_name.version, '1.2.3a')
# website
self.assertEqual(self.plugin.website, None)
self.assertEqual(self.plugin_simple.website, None)
self.assertEqual(self.plugin_name.website, 'http://aa.bb/cc')

View File

@ -40,6 +40,10 @@
</a>
{% endfor %}
{% endif %}
{% if plugin.website %}
<a href="{{ plugin.website }}"><i class="fas fa-globe"></i></a>
{% endif %}
</td>
<td>{{ plugin.author }}</td>
<td>{{ plugin.pub_date }}</td>

View File

@ -37,6 +37,13 @@
<td>{% trans "Version" %}</td>
<td>{{ plugin.version }}{% include "clip.html" %}</td>
</tr>
{% if plugin.website %}
<tr>
<td><span class='fas fa-globe'></span></td>
<td>{% trans "Website" %}</td>
<td>{{ plugin.website }}{% include "clip.html" %}</td>
</tr>
{% endif %}
</table>
<p>{% trans 'The code information is pulled from the latest git commit for this plugin. It might not reflect official version numbers or information but the actual code running.' %}</p>