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:
10
InvenTree/templates/panel/plugin_javascript.html
Normal file
10
InvenTree/templates/panel/plugin_javascript.html
Normal 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 %}
|
3
InvenTree/templates/panel/plugin_menu_items.html
Normal file
3
InvenTree/templates/panel/plugin_menu_items.html
Normal 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 %}
|
18
InvenTree/templates/panel/plugin_panels.html
Normal file
18
InvenTree/templates/panel/plugin_panels.html
Normal 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 %}
|
Reference in New Issue
Block a user