From 53007dc41617354aa0f8536e570dd262cd68fad6 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Tue, 1 Nov 2022 23:21:16 +1100 Subject: [PATCH] Cleanup rendering of "plugins" display --- .../templates/InvenTree/settings/plugin.html | 50 ++------------ .../InvenTree/settings/plugin_details.html | 67 +++++++++++++++++++ 2 files changed, 71 insertions(+), 46 deletions(-) create mode 100644 InvenTree/templates/InvenTree/settings/plugin_details.html diff --git a/InvenTree/templates/InvenTree/settings/plugin.html b/InvenTree/templates/InvenTree/settings/plugin.html index 8051563d24..5f4d3af055 100644 --- a/InvenTree/templates/InvenTree/settings/plugin.html +++ b/InvenTree/templates/InvenTree/settings/plugin.html @@ -47,52 +47,19 @@ - + + {% plugin_list as pl_list %} {% for plugin_key, plugin in pl_list.items %} - {% mixin_enabled plugin 'urls' as urls %} - {% mixin_enabled plugin 'settings' as settings %} - - - - - - - - + {% include "InvenTree/settings/plugin_details.html" with plugin=plugin plugin_key=plugin_key %} {% endfor %} {% inactive_plugin_list as in_pl_list %} @@ -100,16 +67,7 @@ {% for plugin_key, plugin in in_pl_list.items %} - - - - - + {% include "InvenTree/settings/plugin_details.html" with plugin=plugin plugin_key=plugin_key %} {% endfor %} {% endif %} diff --git a/InvenTree/templates/InvenTree/settings/plugin_details.html b/InvenTree/templates/InvenTree/settings/plugin_details.html new file mode 100644 index 0000000000..9f25b7d8e5 --- /dev/null +++ b/InvenTree/templates/InvenTree/settings/plugin_details.html @@ -0,0 +1,67 @@ +{% load inventree_extras %} +{% load i18n %} + + + + + {% trans "Unvailable" as no_info %} + + + + +
{% trans "Admin" %} {% trans "Name" %}{% trans "Key" %} {% trans "Author" %} {% trans "Date" %} {% trans "Version" %}
- {% if user.is_staff and perms.plugin.change_pluginconfig %} - {% url 'admin:plugin_pluginconfig_change' plugin.pk as url %} - {% include "admin_button.html" with url=url %} - {% endif %} - {{ plugin.human_name }} - {{plugin_key}} - {% define plugin.registered_mixins as mixin_list %} - - {% if plugin.is_sample %} - - {% trans "Sample" %} - - {% endif %} - - {% if mixin_list %} - {% for mixin in mixin_list %} - - {{ mixin.human_name }} - - {% endfor %} - {% endif %} - - {% if plugin.website %} - - {% endif %} - {{ plugin.author }}{% render_date plugin.pub_date %}{% if plugin.version %}{{ plugin.version }}{% endif %}
{% trans 'Inactive plugins' %}
- {% if user.is_staff and perms.plugin.change_pluginconfig %} - {% url 'admin:plugin_pluginconfig_change' plugin.pk as url %} - {% include "admin_button.html" with url=url %} - {% endif %} - {{plugin.name}} - {{plugin.key}}
+ {% if plugin.human_name %} + {{ plugin.human_name }} + {% elif plugin.name %} + {{ plugin.name }} + {% endif %} + + {% define plugin.registered_mixins as mixin_list %} + + {% if mixin_list %} + {% for mixin in mixin_list %} + + {{ mixin.human_name }} + + {% endfor %} + {% endif %} + + {% if plugin.is_builtin %} + + {% trans "Builtin" %} + + {% endif %} + + {% if plugin.is_sample %} + + {% trans "Sample" %} + + {% endif %} + + {% if plugin.website %} + + {% endif %} + {{ plugin_key }} + {% if plugin.author %} + {{ plugin.author }} + {% else %} + {{ no_info }} + {% endif %} + + {% if plugin.pub_date %} + {% render_date plugin.pub_date %} + {% else %} + {{ no_info }} + {% endif %} + + {% if plugin.version %} + {{ plugin.version }} + {% else %} + {{ no_info }} + {% endif %} + + {% if user.is_staff and perms.plugin.change_pluginconfig %} + {% url 'admin:plugin_pluginconfig_change' plugin.pk as url %} + {% include "admin_button.html" with url=url %} + {% endif %} +