2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-04 12:40:57 +00:00

Implement new approach for plugin settings

- URL specifies plugin slug and setting key
This commit is contained in:
Oliver Walters
2022-05-08 20:08:22 +10:00
parent f733e23b65
commit 3a9bacb27c
7 changed files with 91 additions and 24 deletions

View File

@ -32,7 +32,7 @@ const plugins_enabled = false;
* Interactively edit a setting value.
* Launches a modal dialog form to adjut the value of the setting.
*/
function editSetting(pk, options={}) {
function editSetting(key, options={}) {
// Is this a global setting or a user setting?
var global = options.global || false;
@ -44,13 +44,13 @@ function editSetting(pk, options={}) {
var url = '';
if (plugin) {
url = `/api/plugin/settings/${pk}/`;
url = `/api/plugin/settings/${plugin}/${key}/`;
} else if (notification) {
url = `/api/settings/notification/${pk}/`;
} else if (global) {
url = `/api/settings/global/${pk}/`;
url = `/api/settings/global/${key}/`;
} else {
url = `/api/settings/user/${pk}/`;
url = `/api/settings/user/${key}/`;
}
var reload_required = false;