mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
website info for plugins
This commit is contained in:
parent
f1fd1d4da8
commit
eeeb69ce12
@ -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"""
|
||||
|
@ -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')
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user