diff --git a/docs/assets/images/plugin/panels.png b/docs/assets/images/plugin/panels.png new file mode 100644 index 0000000..a16d6b0 Binary files /dev/null and b/docs/assets/images/plugin/panels.png differ diff --git a/docs/extend/plugins.md b/docs/extend/plugins.md index 6d87df8..f0c2679 100644 --- a/docs/extend/plugins.md +++ b/docs/extend/plugins.md @@ -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) diff --git a/docs/extend/plugins/panel.md b/docs/extend/plugins/panel.md new file mode 100644 index 0000000..07788a4 --- /dev/null +++ b/docs/extend/plugins/panel.md @@ -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. \ No newline at end of file diff --git a/docs/releases/0.7.0.md b/docs/releases/0.7.0.md index 6e7d451..65644f6 100644 --- a/docs/releases/0.7.0.md +++ b/docs/releases/0.7.0.md @@ -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 | diff --git a/mkdocs.yml b/mkdocs.yml index c7d1929..e31f449 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -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