2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-18 13:05:42 +00:00

Adds a new InvenTreePluginMixin mixin class for enabling custom plugin rendering on a page

- Any view which needs custom plugin code must implement this mixin
- Initially implement for the PartDetail page
This commit is contained in:
Oliver Walters
2022-05-06 22:52:52 +10:00
parent 7b8a10173d
commit c80b36fc2f
8 changed files with 74 additions and 10 deletions

View File

@ -0,0 +1,10 @@
{% if plugin_panels %}
// Run custom javascript when plugin panels are loaded
{% for panel in plugin_panels %}
{% if panel.javascript %}
onPanelLoad('{{ panel.key }}', function() {
{{ panel.javascript | safe }}
});
{% endif %}
{% endfor %}
{% endif %}

View File

@ -0,0 +1,3 @@
{% for panel in plugin_panels %}
{% include "sidebar_item.html" with label=panel.key text=panel.title icon=panel.icon %}
{% endfor %}

View File

@ -0,0 +1,18 @@
{% for panel in plugin_panels %}
<div class='panel panel-hidden' id='panel-{{ panel.key }}'>
<div class='panel-heading'>
<div class='d-flex flex-wrap'>
<h4>{{ panel.title }}</h4>
{% include "spacer.html" %}
<div class='btn-group' role='group'>
<!-- TODO: Implement custom action buttons for plugin panels -->
</div>
</div>
</div>
<div class='panel-content'>
{{ panel.content | safe }}
</div>
</div>
{% endfor %}