From 01bc412ed70f277057459cfaf94b50d632c0b6f0 Mon Sep 17 00:00:00 2001 From: Lova Andriarimalala <43842786+Xpirix@users.noreply.github.com> Date: Thu, 17 Oct 2024 09:46:27 +0300 Subject: [PATCH] Fix the navigation bar for smaller screen --- .../models/templatetags/resources_utils.py | 7 +++ qgis-app/settings_docker.py | 61 ++++++++++++++++++- .../style/scss/bulma/components/sidebar.sass | 2 +- qgis-app/templates/layouts/header.html | 50 ++++++++++----- 4 files changed, 103 insertions(+), 17 deletions(-) diff --git a/qgis-app/models/templatetags/resources_utils.py b/qgis-app/models/templatetags/resources_utils.py index 68a88e0e..b7cca011 100755 --- a/qgis-app/models/templatetags/resources_utils.py +++ b/qgis-app/models/templatetags/resources_utils.py @@ -97,6 +97,13 @@ def get_sustaining_members_section(): except requests.RequestException as e: return f"Error: {e}" +@register.simple_tag +def get_navigation_menu(): + """ + Get the navigation menu from the settings + """ + return settings.NAVIGATION_MENU + @register.filter def get_string_tags(tags): """ diff --git a/qgis-app/settings_docker.py b/qgis-app/settings_docker.py index c24126b7..f664d240 100644 --- a/qgis-app/settings_docker.py +++ b/qgis-app/settings_docker.py @@ -169,4 +169,63 @@ 'BUNDLE_DIR_NAME': 'bundles', 'STATS_FILE': os.path.join(SITE_ROOT, 'webpack-stats.json'), } -} \ No newline at end of file +} +# Set the navigation menu +NAVIGATION_MENU = [ + { + 'name': 'QGIS Hub Home', + 'url': '/', + 'icon': 'fa-house', + 'order': 0, + }, + { + 'name': 'Hub', + 'url': '#', + 'icon': 'fa-cubes', + 'order': 1, + 'submenu': [ + { + 'name': 'Styles', + 'url': '/styles', + 'icon': 'fa-paint-brush', + 'order': 1, + }, + { + 'name': 'Projects', + 'url': '/geopackages', + 'icon': 'fa-folder-open', + 'order': 2, + }, + { + 'name': 'Models', + 'url': '/models', + 'icon': 'fa-cogs', + 'order': 3, + }, + { + 'name': '3D Models', + 'url': '/wavefronts', + 'icon': 'fa-cube', + 'order': 4, + }, + { + 'name': 'QLR', + 'url': '/layerdefinitions', + 'icon': 'fa-layer-group', + 'order': 5, + } + ] + }, + { + 'name': 'API', + 'url': '/api/v1/resources/', + 'icon': 'fa-code', + 'order': 2, + }, + { + 'name': 'Metrics', + 'url': METABASE_DOWNLOAD_STATS_URL, + 'icon': 'fa-chart-bar', # Changed to a more accurate icon + 'order': 4, + } +] \ No newline at end of file diff --git a/qgis-app/static/style/scss/bulma/components/sidebar.sass b/qgis-app/static/style/scss/bulma/components/sidebar.sass index 474daa90..7602ee6d 100644 --- a/qgis-app/static/style/scss/bulma/components/sidebar.sass +++ b/qgis-app/static/style/scss/bulma/components/sidebar.sass @@ -6,7 +6,7 @@ .sidebar position: sticky overflow-y: scroll // TODO: unnecessary scroll on mobile and FF windows - top: 100px + top: 125px max-height: calc(100vh - 175px) padding-bottom: 30px &::-webkit-scrollbar diff --git a/qgis-app/templates/layouts/header.html b/qgis-app/templates/layouts/header.html index dd4722d2..df4f2bac 100644 --- a/qgis-app/templates/layouts/header.html +++ b/qgis-app/templates/layouts/header.html @@ -1,4 +1,4 @@ -{% load i18n simplemenu_tags static %} +{% load i18n simplemenu_tags resources_utils static %}