mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Updates for 'admin' buttons:
- Make them work like proper links - Hidden if 'hide_admin_link' customization option is set - Check for user staff status
This commit is contained in:
parent
058587d86c
commit
00e570ca2a
@ -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();
|
||||
|
||||
|
@ -1,4 +1,12 @@
|
||||
{% load inventree_extras %}
|
||||
{% load i18n %}
|
||||
<button id='admin-button' title='{% trans "View in administration panel" %}' type='button' class='btn btn-primary admin-button' url='{{ url }}'>
|
||||
<span class='fas fa-user-shield'></span>
|
||||
</button>
|
||||
|
||||
{% inventree_customize 'hide_admin_link' as hidden %}
|
||||
|
||||
{% if not hidden and user.is_staff %}
|
||||
<a href='{{ url }}'>
|
||||
<button id='admin-button' href='{{ url }}' title='{% trans "View in administration panel" %}' type='button' class='btn btn-primary admin-button'>
|
||||
<span class='fas fa-user-shield'></span>
|
||||
</button>
|
||||
</a>
|
||||
{% endif %}
|
||||
|
Loading…
Reference in New Issue
Block a user