From cc3da1439d28e2599fb087e91e512946e1972ffc Mon Sep 17 00:00:00 2001 From: chfhtw Date: Wed, 5 Nov 2025 11:06:45 +0100 Subject: [PATCH] StV: add user menu --- application/views/Studentenverwaltung.php | 2 + public/css/Studentenverwaltung.css | 6 ++ .../js/components/Stv/Studentenverwaltung.js | 35 +++++++++++ public/js/components/navigation/Language.js | 62 +++++++++++++++++++ 4 files changed, 105 insertions(+) create mode 100644 public/js/components/navigation/Language.js diff --git a/application/views/Studentenverwaltung.php b/application/views/Studentenverwaltung.php index 01e611657..16b8c0045 100644 --- a/application/views/Studentenverwaltung.php +++ b/application/views/Studentenverwaltung.php @@ -53,6 +53,8 @@ $configArray = [ active-addons="" stv-root="" cis-root="" + avatar-url="" + logout-url="" :permissions="" :config="" > diff --git a/public/css/Studentenverwaltung.css b/public/css/Studentenverwaltung.css index bb2588926..d92e3dfac 100644 --- a/public/css/Studentenverwaltung.css +++ b/public/css/Studentenverwaltung.css @@ -41,6 +41,12 @@ html { width: 0%; } +#nav-user-btn img { + object-fit: contain; + height: 2.5rem; + width: 2.5rem; +} + .tabulator-row.disabled.tabulator-row-odd .tabulator-cell { color: var(--gray-400); } diff --git a/public/js/components/Stv/Studentenverwaltung.js b/public/js/components/Stv/Studentenverwaltung.js index d0543ad59..c97d7a0bf 100644 --- a/public/js/components/Stv/Studentenverwaltung.js +++ b/public/js/components/Stv/Studentenverwaltung.js @@ -16,6 +16,7 @@ */ import CoreSearchbar from "../searchbar/searchbar.js"; +import NavLanguage from "../navigation/Language.js"; import VerticalSplit from "../verticalsplit/verticalsplit.js"; import StvVerband from "./Studentenverwaltung/Verband.js"; import StvList from "./Studentenverwaltung/List.js"; @@ -31,6 +32,7 @@ export default { name: 'Studentenverwaltung', components: { CoreSearchbar, + NavLanguage, VerticalSplit, StvVerband, StvList, @@ -43,6 +45,8 @@ export default { permissions: Object, stvRoot: String, cisRoot: String, + avatarUrl: String, + logoutUrl: String, activeAddons: String, // semicolon separated list of active addons url_studiensemester_kurzbz: String, url_mode: String, @@ -355,6 +359,37 @@ export default { :searchfunction="searchfunction" class="searchbar position-relative w-100" > +
diff --git a/public/js/components/navigation/Language.js b/public/js/components/navigation/Language.js new file mode 100644 index 000000000..4d26dadc0 --- /dev/null +++ b/public/js/components/navigation/Language.js @@ -0,0 +1,62 @@ +/** + * Copyright (C) 2025 fhcomplete.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +export default { + emits: [ + 'changed' + ], + props: { + activeClass: { + type: String, + default: 'active' + }, + itemClass: { + type: [String, Array, Object], + default: '' + } + }, + data() { + return { + languages: FHC_JS_DATA_STORAGE_OBJECT.server_languages + }; + }, + methods:{ + onChange(lang) { + if (this.languages.some(l => l.sprache === lang)) { + this.$p + .setLanguage(lang) + .then(() => { + if (document.querySelector('[cis4Reload]')) + window.location.reload(); + else + this.$emit('changed', lang); + }); + } + } + }, + template: /*html*/` + ` +}; \ No newline at end of file