From d04d9fd2503f8377168b39fa31825ea5f939ee96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eike=20Martin=20L=C3=B6hden?= Date: Mon, 10 Jul 2023 15:29:14 +0200 Subject: [PATCH 1/5] Added themed-user-menu component. --- .../user-menu/themed-user-menu.component.ts | 33 +++++++++++++++++++ src/app/shared/shared.module.ts | 2 ++ 2 files changed, 35 insertions(+) create mode 100644 src/app/shared/auth-nav-menu/user-menu/themed-user-menu.component.ts diff --git a/src/app/shared/auth-nav-menu/user-menu/themed-user-menu.component.ts b/src/app/shared/auth-nav-menu/user-menu/themed-user-menu.component.ts new file mode 100644 index 00000000000..09f02eb761c --- /dev/null +++ b/src/app/shared/auth-nav-menu/user-menu/themed-user-menu.component.ts @@ -0,0 +1,33 @@ +import {Component, Input} from '@angular/core' +import {ThemedComponent} from '../../theme-support/themed.component'; +import {UserMenuComponent} from './user-menu.component'; + +/** + * This component represents the user nav menu. + */ +@Component({ + selector: 'ds-themed-user-menu', + templateUrl: './../../theme-support/themed.component.html', + styleUrls: [] +}) +export class ThemedUserMenuComponent extends ThemedComponent{ + + /** + * The input flag to show user details in navbar expandable menu + */ + @Input() inExpandableNavbar = false; + + protected inAndOutputNames: (keyof UserMenuComponent & keyof this)[] = ['inExpandableNavbar']; + + protected getComponentName(): string { + return 'UserMenuComponent'; + } + + protected importThemedComponent(themeName: string): Promise { + return import((`../../../../themes/${themeName}/app/shared/auth-nav-menu/user-menu/user-menu.component`)); + } + + protected importUnthemedComponent(): Promise { + return import('./user-menu.component'); + } +} diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts index e3a238670d8..743a47deb14 100644 --- a/src/app/shared/shared.module.ts +++ b/src/app/shared/shared.module.ts @@ -282,6 +282,7 @@ import { import { BitstreamListItemComponent } from './object-list/bitstream-list-item/bitstream-list-item.component'; import { NgxPaginationModule } from 'ngx-pagination'; import { ThemedLangSwitchComponent } from './lang-switch/themed-lang-switch.component'; +import {ThemedUserMenuComponent} from './auth-nav-menu/user-menu/themed-user-menu.component'; const MODULES = [ CommonModule, @@ -330,6 +331,7 @@ const COMPONENTS = [ AuthNavMenuComponent, ThemedAuthNavMenuComponent, UserMenuComponent, + ThemedUserMenuComponent, DsSelectComponent, ErrorComponent, LangSwitchComponent, From de826634c82008dfffb5c5db4d7e1f737590fd87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eike=20Martin=20L=C3=B6hden?= Date: Mon, 10 Jul 2023 15:34:25 +0200 Subject: [PATCH 2/5] Corrected missing semicolon. --- .../auth-nav-menu/user-menu/themed-user-menu.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/shared/auth-nav-menu/user-menu/themed-user-menu.component.ts b/src/app/shared/auth-nav-menu/user-menu/themed-user-menu.component.ts index 09f02eb761c..cecafc9d5cd 100644 --- a/src/app/shared/auth-nav-menu/user-menu/themed-user-menu.component.ts +++ b/src/app/shared/auth-nav-menu/user-menu/themed-user-menu.component.ts @@ -1,4 +1,4 @@ -import {Component, Input} from '@angular/core' +import {Component, Input} from '@angular/core'; import {ThemedComponent} from '../../theme-support/themed.component'; import {UserMenuComponent} from './user-menu.component'; From a4aecce865347d923e982eb88e316cecc0f5d7f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eike=20Martin=20L=C3=B6hden?= Date: Mon, 10 Jul 2023 15:38:32 +0200 Subject: [PATCH 3/5] Replaced tags for ds-user-menu. --- src/app/navbar/navbar.component.html | 2 +- src/app/shared/auth-nav-menu/auth-nav-menu.component.html | 2 +- src/app/shared/auth-nav-menu/auth-nav-menu.component.spec.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/navbar/navbar.component.html b/src/app/navbar/navbar.component.html index edfc4bb8ee0..b691cfb3f9e 100644 --- a/src/app/navbar/navbar.component.html +++ b/src/app/navbar/navbar.component.html @@ -6,7 +6,7 @@
diff --git a/src/app/shared/auth-nav-menu/auth-nav-menu.component.spec.ts b/src/app/shared/auth-nav-menu/auth-nav-menu.component.spec.ts index 58a1edfabde..0b9ea6ef4b4 100644 --- a/src/app/shared/auth-nav-menu/auth-nav-menu.component.spec.ts +++ b/src/app/shared/auth-nav-menu/auth-nav-menu.component.spec.ts @@ -248,7 +248,7 @@ describe('AuthNavMenuComponent', () => { component = null; }); it('should render UserMenuComponent component', () => { - const logoutDropdownMenu = deNavMenuItem.query(By.css('ds-user-menu')); + const logoutDropdownMenu = deNavMenuItem.query(By.css('ds-themed-user-menu')); expect(logoutDropdownMenu.nativeElement).toBeDefined(); }); }); From 2ec90b8273fc0c2134f4069d046c6bd7e1e4adfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eike=20Martin=20L=C3=B6hden?= Date: Mon, 10 Jul 2023 15:54:09 +0200 Subject: [PATCH 4/5] Included user-menu component in custom theme. --- .../user-menu/user-menu.component.html | 0 .../user-menu/user-menu.component.scss | 0 .../user-menu/user-menu.component.ts | 15 +++++++++++++++ src/themes/custom/lazy-theme.module.ts | 2 ++ 4 files changed, 17 insertions(+) create mode 100644 src/themes/custom/app/shared/auth-nav-menu/user-menu/user-menu.component.html create mode 100644 src/themes/custom/app/shared/auth-nav-menu/user-menu/user-menu.component.scss create mode 100644 src/themes/custom/app/shared/auth-nav-menu/user-menu/user-menu.component.ts diff --git a/src/themes/custom/app/shared/auth-nav-menu/user-menu/user-menu.component.html b/src/themes/custom/app/shared/auth-nav-menu/user-menu/user-menu.component.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/themes/custom/app/shared/auth-nav-menu/user-menu/user-menu.component.scss b/src/themes/custom/app/shared/auth-nav-menu/user-menu/user-menu.component.scss new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/themes/custom/app/shared/auth-nav-menu/user-menu/user-menu.component.ts b/src/themes/custom/app/shared/auth-nav-menu/user-menu/user-menu.component.ts new file mode 100644 index 00000000000..f9f1db65ee6 --- /dev/null +++ b/src/themes/custom/app/shared/auth-nav-menu/user-menu/user-menu.component.ts @@ -0,0 +1,15 @@ +import { Component } from '@angular/core'; +import { UserMenuComponent as BaseComponent } from '../../../../../../app/shared/auth-nav-menu/user-menu/user-menu.component'; + +/** + * Component representing the {@link UserMenuComponent} of a page + */ +@Component({ + selector: 'ds-user-menu', + // templateUrl: 'user-menu.component.html', + templateUrl: '../../../../../../app/shared/auth-nav-menu/user-menu/user-menu.component.html', + // styleUrls: ['user-menu.component.scss'], + styleUrls: ['../../../../../../app/shared/auth-nav-menu/user-menu/user-menu.component.scss'], +}) +export class UserMenuComponent extends BaseComponent { +} diff --git a/src/themes/custom/lazy-theme.module.ts b/src/themes/custom/lazy-theme.module.ts index edb3f5478c9..937e174b7f8 100644 --- a/src/themes/custom/lazy-theme.module.ts +++ b/src/themes/custom/lazy-theme.module.ts @@ -156,6 +156,7 @@ import { ItemStatusComponent } from './app/item-page/edit-item-page/item-status/ import { EditBitstreamPageComponent } from './app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component'; import { FormModule } from '../../app/shared/form/form.module'; import { RequestCopyModule } from 'src/app/request-copy/request-copy.module'; +import {UserMenuComponent} from './app/shared/auth-nav-menu/user-menu/user-menu.component'; const DECLARATIONS = [ FileSectionComponent, @@ -239,6 +240,7 @@ const DECLARATIONS = [ SubmissionSectionUploadFileComponent, ItemStatusComponent, EditBitstreamPageComponent, + UserMenuComponent, ]; @NgModule({ From 49454603825ce2d829da9ec8d18b255bfce77458 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eike=20Martin=20L=C3=B6hden?= Date: Thu, 14 Sep 2023 16:28:21 +0200 Subject: [PATCH 5/5] Removed default value from inExpandableNavbar. --- .../auth-nav-menu/user-menu/themed-user-menu.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/shared/auth-nav-menu/user-menu/themed-user-menu.component.ts b/src/app/shared/auth-nav-menu/user-menu/themed-user-menu.component.ts index cecafc9d5cd..9dafe6c4261 100644 --- a/src/app/shared/auth-nav-menu/user-menu/themed-user-menu.component.ts +++ b/src/app/shared/auth-nav-menu/user-menu/themed-user-menu.component.ts @@ -15,7 +15,7 @@ export class ThemedUserMenuComponent extends ThemedComponent{ /** * The input flag to show user details in navbar expandable menu */ - @Input() inExpandableNavbar = false; + @Input() inExpandableNavbar: boolean; protected inAndOutputNames: (keyof UserMenuComponent & keyof this)[] = ['inExpandableNavbar'];