2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-28 11:36:44 +00:00

UI link fix (#8508) (#8509)

* Add tags to test if CUI or PUI are enabled

* Fix PUI redirect

(cherry picked from commit 6bf6733268566e9c8810dc60049e453b108f0c53)

Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
github-actions[bot] 2024-11-18 11:39:10 +11:00 committed by GitHub
parent e56d013e2e
commit 847322e474
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 17 additions and 3 deletions

View File

@ -86,6 +86,7 @@ ENABLE_CLASSIC_FRONTEND = get_boolean_setting(
# Disable CUI parts if CUI tests are disabled # Disable CUI parts if CUI tests are disabled
if TESTING and '--exclude-tag=cui' in sys.argv: if TESTING and '--exclude-tag=cui' in sys.argv:
ENABLE_CLASSIC_FRONTEND = False ENABLE_CLASSIC_FRONTEND = False
ENABLE_PLATFORM_FRONTEND = get_boolean_setting( ENABLE_PLATFORM_FRONTEND = get_boolean_setting(
'INVENTREE_PLATFORM_FRONTEND', 'platform_frontend', True 'INVENTREE_PLATFORM_FRONTEND', 'platform_frontend', True
) )

View File

@ -670,3 +670,15 @@ def admin_url(user, table, pk):
pass pass
return url return url
@register.simple_tag()
def cui_enabled():
"""Return True if the CUI is enabled."""
return settings.ENABLE_CLASSIC_FRONTEND
@register.simple_tag()
def pui_enabled():
"""Return True if the PUI is enabled."""
return settings.ENABLE_PLATFORM_FRONTEND

View File

@ -504,14 +504,14 @@ urlpatterns.append(
) )
) )
# Send any unknown URLs to the parts page # Send any unknown URLs to the index page
urlpatterns += [ urlpatterns += [
re_path( re_path(
r'^.*$', r'^.*$',
RedirectView.as_view( RedirectView.as_view(
url='/index/' url='/index/'
if settings.ENABLE_CLASSIC_FRONTEND if settings.ENABLE_CLASSIC_FRONTEND
else settings.FRONTEND_URL_BASE, else f'/{settings.FRONTEND_URL_BASE}/',
permanent=False, permanent=False,
), ),
name='index', name='index',

View File

@ -2,8 +2,9 @@
{% load i18n %} {% load i18n %}
{% inventree_customize 'hide_pui_banner' as hidden %} {% inventree_customize 'hide_pui_banner' as hidden %}
{% pui_enabled as pui %}
{% if not hidden %} {% if pui and not hidden %}
<div class='alert alert-block alert-warning'> <div class='alert alert-block alert-warning'>
{% if mode == 'admin' %} {% if mode == 'admin' %}
{% trans "Platform UI - the new UI for InvenTree - provides more modern administration options." %} {% trans "Platform UI - the new UI for InvenTree - provides more modern administration options." %}