2
0
mirror of https://github.com/inventree/inventree-docs.git synced 2025-04-27 21:26:43 +00:00

Merge pull request #276 from inventree/panel-plugin-mixin

Panel plugin mixin
This commit is contained in:
Oliver 2022-05-08 09:35:49 +10:00 committed by GitHub
commit 21f15fb7f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 33 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 KiB

View File

@ -62,6 +62,7 @@ Supported mixin classes are:
- [EventMixin](./plugins/event.md)
- [LabelPrintingMixin](./plugins/label.md)
- [NavigationMixin](./plugins/navigation.md)
- [PanelMixin](./plugins/panel.md)
- [ScheduleMixin](./plugins/schedule.md)
- [SettingsMixin](./plugins/settings.md)
- [UrlsMixin](./plugins/urls.md)

View File

@ -0,0 +1,27 @@
---
title: Panel Mixin
---
## PanelMixin
The `PanelMixin` enables plugins to render custom content to "panels" on individual pages in the web interface.
Most pages in the web interface support multiple panels, which are selected via the sidebar menu on the left side of the screen:
{% with id="panels", url="plugin/panels.png", description="Display panels" %}
{% include 'img.html' %}
{% endwith %}
Each plugin which implements this mixin can return zero or more custom panels for a particular page. The plugin can decide (at runtime) which panels it wishes to render. This determination can be made based on the page routing, the item being viewed, the particular user, or other considerations.
### Panel Content
Panel content can be rendered by returning HTML directly, or by rendering from a template file.
### Javascript
Custom code can be provided which will run when the particular panel is first loaded (by selecting it from the side menu).
## Example Implementation
Refer to the `CustomPanelSample` example class in the `./plugin/samples/integration/` directory, for a fully worked example of how custom UI panels can be implemented.

View File

@ -75,6 +75,10 @@ Multiple improvements have been made to the docker installation process, most no
[#2770](https://github.com/inventree/InvenTree/pull/2770) implements a major overhaul of the "order parts" wizard, with the form now making use of the API rather than being rendered on the server.
### Panel Plugins
[#2937](https://github.com/inventree/InvenTree/pull/2937) adds a new type of plugin mixin, which allows rendering of custom "panels" on certain pages. This is a powerful new plugin feature which allows custom UI elements to be generated with ease. Read more about this new mixin [here](../extend/plugins/panel.md).
## Bug Fixes
| Pull Request | Description |

View File

@ -130,6 +130,7 @@ nav:
- Event Mixin: extend/plugins/event.md
- Label Printing Mixin: extend/plugins/label.md
- Navigation Mixin: extend/plugins/navigation.md
- Panel Mixin: extend/plugins/panel.md
- Schedule Mixin: extend/plugins/schedule.md
- Settings Mixin: extend/plugins/settings.md
- URL Mixin: extend/plugins/urls.md