2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-08-12 23:00:53 +00:00

Simplify the new template rendering

- No extra template code is required for any new page
- All loaded in base.html or page_base.html
- Oh, so clean!
This commit is contained in:
Oliver Walters
2022-05-06 23:19:21 +10:00
parent 71128a1c8e
commit 0797e9ebf0
7 changed files with 13 additions and 10 deletions

View File

@@ -0,0 +1,19 @@
{% if plugin_panels %}
<!-- Custom panel items, loaded via plugins -->
{% 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 %}
{% endif %}

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,6 @@
{% if plugin_panels %}
<!-- Custom sidebar menu items, loaded via plugins -->
{% for panel in plugin_panels %}
{% include "sidebar_item.html" with label=panel.key text=panel.title icon=panel.icon %}
{% endfor %}
{% endif %}