mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-12 10:05:39 +00:00
PUI Template editor (#6541)
* Added first POC for label editor * Added preview item selection * Split code * Fix import * Use liquid lang and added custom tooltips * Auto load first item for preview and add BOM part assembly filter * Make the save&reload action more obvious * Make save optional and use server stored template * Fix icons and inherit model url * Add label/report extra fields to serializer and default templates * Bump api version to v176 * Remove generic and pass template to editor * Added error overlay * Moved default tempaltes in default folder * Only show detail drawer back button if necessary * Rename action dropdown disabled to hidden and add loading disabled to template editor * Fix types * Add icons to editor/preview tabs * Add draggable split pane and make editors use full height * Add SplitButton component * add code editor tag description * fix related model field if empty string * remove debug console.log * move code editor/pdf preview into their own folder * Update api_version.py * add support for multiple editors * fix template editor error handleing while loading/saving code * add documentation for the template editor
This commit is contained in:
BIN
docs/docs/assets/images/report/template-editor.png
Normal file
BIN
docs/docs/assets/images/report/template-editor.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 327 KiB |
BIN
docs/docs/assets/images/report/template-table.png
Normal file
BIN
docs/docs/assets/images/report/template-table.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 422 KiB |
33
docs/docs/report/template_editor.md
Normal file
33
docs/docs/report/template_editor.md
Normal file
@ -0,0 +1,33 @@
|
||||
---
|
||||
title: Template editor
|
||||
---
|
||||
|
||||
## Template editor
|
||||
|
||||
The Template Editor is integrated into the Admin center of Platform UI (PUI). It allows users to create and edit label and report templates directly with a side by side preview for a more productive workflow.
|
||||
|
||||

|
||||
|
||||
On the left side (1) are all possible possible template types for labels and reports listed. With the "+" button (2), above the template table (3), new templates for the selected type can be created. To switch to the template editor click on a template.
|
||||
|
||||
### Editing Templates
|
||||
|
||||
The Template Editor provides a split pane interface, with a [code editor (1)](#code-editor-1) on the left and a [preview area (2)](#previewing-templates-2) on the right. The split view can be resized as required with the drag handler in-between.
|
||||
|
||||

|
||||
|
||||
#### Code editor (1)
|
||||
|
||||
The code editor supports syntax highlighting and making it easier to write and edit templates.
|
||||
|
||||
#### Previewing Templates (2)
|
||||
|
||||
One of the key features of the Template Editor is the ability to preview the rendered output of the templates. Users can select an InvenTree item (3) to render the template for, allowing them to see how the final output will look in production.
|
||||
|
||||
To render the preview currently **overriding the production template is required** due to API limitations. To do so, first select an item (3) to use for the preview and then press the "Save & Reload preview" button at the top right of the code editor. The first time a confirm dialog opens that you need to confirm that the production template now will be overridden.
|
||||
|
||||
If you don't want to override the template, but just render a preview for a template how it is currently stored in InvenTree, click on the down arrow on the right of that button and select "Reload preview". That will just render the selected item (4) with the InvenTree stored template.
|
||||
|
||||
#### Edit template metadata
|
||||
|
||||
Editing metadata such as name, description, filters and even width/height for labels and orientation/page size for reports can be done from the edit modal accessible when clicking on the three dots (4) and select "Edit" in the dropdown menu.
|
@ -135,6 +135,7 @@ nav:
|
||||
- Project Codes: order/project_codes.md
|
||||
- Report:
|
||||
- Templates: report/report.md
|
||||
- Template Editor: report/template_editor.md
|
||||
- Report Types:
|
||||
- Test Reports: report/test.md
|
||||
- Build Order: report/build.md
|
||||
|
Reference in New Issue
Block a user