mirror of
https://github.com/inventree/InvenTree.git
synced 2026-09-27 14:16:02 +00:00
feat(frontend): Add option for plugins to add header actions (#9570)
* [FR] PUI - Add option for plugins to add header actions Fixes #8593 * fix parsing * fix merge * reduce diff * fix sample implementation * add support for icons and colors in primary actions * add changelog entry * add docs * add more detailed sample text * pass location into context * fix test --------- Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
@@ -226,6 +226,17 @@ class SampleUserInterfacePlugin(SettingsMixin, UserInterfaceMixin, InvenTreePlug
|
||||
}
|
||||
]
|
||||
|
||||
def get_ui_primary_actions(self, request, context, **kwargs):
|
||||
"""Return a list of custom primary action buttons."""
|
||||
return [
|
||||
{
|
||||
'key': 'sample-primary-action',
|
||||
'title': 'Sample Primary Action',
|
||||
'icon': 'ti:plus:outline',
|
||||
'options': {'url': '/core/sample-primary-action/', 'color': 'orange'},
|
||||
}
|
||||
]
|
||||
|
||||
def get_admin_context(self) -> dict:
|
||||
"""Return custom context data which can be rendered in the admin panel."""
|
||||
return {'apple': 'banana', 'foo': 'bar', 'hello': 'world'}
|
||||
|
||||
Reference in New Issue
Block a user