From 00e570ca2a1e4f146fde2be42020e97d6ed24b12 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Tue, 1 Nov 2022 23:17:18 +1100 Subject: [PATCH] Updates for 'admin' buttons: - Make them work like proper links - Hidden if 'hide_admin_link' customization option is set - Check for user staff status --- .../InvenTree/static/script/inventree/inventree.js | 7 ------- InvenTree/templates/admin_button.html | 14 +++++++++++--- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/InvenTree/InvenTree/static/script/inventree/inventree.js b/InvenTree/InvenTree/static/script/inventree/inventree.js index f0d65b9131..0f06ea98ac 100644 --- a/InvenTree/InvenTree/static/script/inventree/inventree.js +++ b/InvenTree/InvenTree/static/script/inventree/inventree.js @@ -127,13 +127,6 @@ function inventreeDocReady() { loadBrandIcon($(this), $(this).attr('brand_name')); }); - // Callback for "admin view" button - $('#admin-button, .admin-button').click(function() { - var url = $(this).attr('url'); - - location.href = url; - }); - // Display any cached alert messages showCachedAlerts(); diff --git a/InvenTree/templates/admin_button.html b/InvenTree/templates/admin_button.html index 221d7f6c8e..abc3d2d91c 100644 --- a/InvenTree/templates/admin_button.html +++ b/InvenTree/templates/admin_button.html @@ -1,4 +1,12 @@ +{% load inventree_extras %} {% load i18n %} - + +{% inventree_customize 'hide_admin_link' as hidden %} + +{% if not hidden and user.is_staff %} + + + +{% endif %}