From bdc62dfcc3c65a66e0eaa0238ad1c3b90dac29ff Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 4 Apr 2022 23:53:35 +0200 Subject: [PATCH] mark active sample code as a sample --- InvenTree/plugin/integration.py | 8 ++++++++ InvenTree/templates/InvenTree/settings/plugin.html | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/InvenTree/plugin/integration.py b/InvenTree/plugin/integration.py index de95adb8f8..7797134b14 100644 --- a/InvenTree/plugin/integration.py +++ b/InvenTree/plugin/integration.py @@ -94,6 +94,14 @@ class IntegrationPluginBase(MixinBase, plugin_base.InvenTreePluginBase): """ return getattr(self, 'is_package', False) + @property + def is_sample(self): + """ + Is this plugin part of the samples? + """ + path = str(self.package_path) + return path.startswith('plugin/samples/') + # region properties @property def slug(self): diff --git a/InvenTree/templates/InvenTree/settings/plugin.html b/InvenTree/templates/InvenTree/settings/plugin.html index 139ce0d41a..3ea8d9734c 100644 --- a/InvenTree/templates/InvenTree/settings/plugin.html +++ b/InvenTree/templates/InvenTree/settings/plugin.html @@ -76,6 +76,12 @@ {% endfor %} {% endif %} + {% if plugin.is_sample %} + + {% trans "code sample" %} + + {% endif %} + {% if plugin.website %} {% endif %}