From 106182d5fd61630a202d66929dcc97235e5db195 Mon Sep 17 00:00:00 2001 From: Alexandre Vryghem Date: Fri, 26 Jan 2024 11:35:13 +0100 Subject: [PATCH] 111321: Made ComColPageContentComponent themeable --- .../browse-by-metadata-page.component.html | 12 +++--- .../collection-page.component.html | 12 +++--- .../community-page.component.html | 12 +++--- .../comcol-page-content.component.ts | 12 ++++-- .../themed-comcol-page-content.component.ts | 38 +++++++++++++++++++ src/app/shared/comcol/comcol.module.ts | 2 + 6 files changed, 67 insertions(+), 21 deletions(-) create mode 100644 src/app/shared/comcol/comcol-page-content/themed-comcol-page-content.component.ts diff --git a/src/app/browse-by/browse-by-metadata-page/browse-by-metadata-page.component.html b/src/app/browse-by/browse-by-metadata-page/browse-by-metadata-page.component.html index 227fa8aa788..5045d226b9d 100644 --- a/src/app/browse-by/browse-by-metadata-page/browse-by-metadata-page.component.html +++ b/src/app/browse-by/browse-by-metadata-page/browse-by-metadata-page.component.html @@ -11,11 +11,11 @@ [title]="parentContext.type+'.page.handle'" > - - + + - - + + @@ -49,8 +49,8 @@
- - + +
diff --git a/src/app/collection-page/collection-page.component.html b/src/app/collection-page/collection-page.component.html index eebfdbd8292..beae2e6c647 100644 --- a/src/app/collection-page/collection-page.component.html +++ b/src/app/collection-page/collection-page.component.html @@ -22,16 +22,16 @@ [title]="'collection.page.handle'" > - - + - - +
@@ -65,10 +65,10 @@

{{'collection.page.browse.recent.head' | translate}}

- - +
diff --git a/src/app/community-page/community-page.component.html b/src/app/community-page/community-page.component.html index 368fec08a5d..794c177fea5 100644 --- a/src/app/community-page/community-page.component.html +++ b/src/app/community-page/community-page.component.html @@ -13,12 +13,12 @@ - - + + - - +
@@ -35,8 +35,8 @@
- - + +
diff --git a/src/app/shared/comcol/comcol-page-content/comcol-page-content.component.ts b/src/app/shared/comcol/comcol-page-content/comcol-page-content.component.ts index 841b45dd39f..149e13068ea 100644 --- a/src/app/shared/comcol/comcol-page-content/comcol-page-content.component.ts +++ b/src/app/shared/comcol/comcol-page-content/comcol-page-content.component.ts @@ -13,13 +13,19 @@ import { Component, Input } from '@angular/core'; }) export class ComcolPageContentComponent { - // Optional title + /** + * Optional title + */ @Input() title: string; - // The content to render. Might be html + /** + * The content to render. Might be html + */ @Input() content: string; - // flag whether the content contains html syntax or not + /** + * flag whether the content contains html syntax or not + */ @Input() hasInnerHtml: boolean; } diff --git a/src/app/shared/comcol/comcol-page-content/themed-comcol-page-content.component.ts b/src/app/shared/comcol/comcol-page-content/themed-comcol-page-content.component.ts new file mode 100644 index 00000000000..502909b8d18 --- /dev/null +++ b/src/app/shared/comcol/comcol-page-content/themed-comcol-page-content.component.ts @@ -0,0 +1,38 @@ +import { Component, Input } from '@angular/core'; +import { ThemedComponent } from '../../theme-support/themed.component'; +import { ComcolPageContentComponent } from './comcol-page-content.component'; + +/** + * Themed wrapper for {@link ComcolPageContentComponent} + */ +@Component({ + selector: 'ds-themed-comcol-page-content', + templateUrl: '../../theme-support/themed.component.html', +}) +export class ThemedComcolPageContentComponent extends ThemedComponent { + + @Input() title: string; + + @Input() content: string; + + @Input() hasInnerHtml: boolean; + + protected inAndOutputNames: (keyof ComcolPageContentComponent & keyof this)[] = [ + 'title', + 'content', + 'hasInnerHtml', + ]; + + protected getComponentName(): string { + return 'ComcolPageContentComponent'; + } + + protected importThemedComponent(themeName: string): Promise { + return import(`../../../themes/${themeName}/app/admin/admin-sidebar/admin-sidebar.component`); + } + + protected importUnthemedComponent(): Promise { + return import('./comcol-page-content.component'); + } + +} diff --git a/src/app/shared/comcol/comcol.module.ts b/src/app/shared/comcol/comcol.module.ts index 094387929ae..efe145bccd9 100644 --- a/src/app/shared/comcol/comcol.module.ts +++ b/src/app/shared/comcol/comcol.module.ts @@ -15,9 +15,11 @@ import { ThemedComcolPageBrowseByComponent } from './comcol-page-browse-by/theme import { ComcolRoleComponent } from './comcol-forms/edit-comcol-page/comcol-role/comcol-role.component'; import { SharedModule } from '../shared.module'; import { FormModule } from '../form/form.module'; +import { ThemedComcolPageContentComponent } from './comcol-page-content/themed-comcol-page-content.component'; const COMPONENTS = [ ComcolPageContentComponent, + ThemedComcolPageContentComponent, ComcolPageHandleComponent, ComcolPageHeaderComponent, ComcolPageLogoComponent,