Skip to content

Commit

Permalink
Merge pull request #1042 from atmire/add-themeable-components
Browse files Browse the repository at this point in the history
Make all non-admin page-level components themeable
  • Loading branch information
tdonohue committed Mar 25, 2021
2 parents a2450b6 + 6cc5617 commit d7daaf4
Show file tree
Hide file tree
Showing 189 changed files with 1,788 additions and 155 deletions.
@@ -0,0 +1,28 @@
import { Component } from '@angular/core';

import { ThemedComponent } from '../../shared/theme-support/themed.component';
import { BrowseBySwitcherComponent } from './browse-by-switcher.component';

/**
* Themed wrapper for BrowseBySwitcherComponent
*/
@Component({
selector: 'ds-themed-browse-by-switcher',
styleUrls: [],
templateUrl: '../../shared/theme-support/themed.component.html'
})
export class ThemedBrowseBySwitcherComponent extends ThemedComponent<BrowseBySwitcherComponent> {
protected getComponentName(): string {
return 'BrowseBySwitcherComponent';
}

protected importThemedComponent(themeName: string): Promise<any> {
return import(`../../../themes/${themeName}/app/+browse-by/+browse-by-switcher/browse-by-switcher.component`);
}

protected importUnthemedComponent(): Promise<any> {
return import(`./browse-by-switcher.component`);
}


}
4 changes: 2 additions & 2 deletions src/app/+browse-by/browse-by-routing.module.ts
@@ -1,9 +1,9 @@
import { RouterModule } from '@angular/router';
import { NgModule } from '@angular/core';
import { BrowseByGuard } from './browse-by-guard';
import { BrowseBySwitcherComponent } from './+browse-by-switcher/browse-by-switcher.component';
import { BrowseByDSOBreadcrumbResolver } from './browse-by-dso-breadcrumb.resolver';
import { BrowseByI18nBreadcrumbResolver } from './browse-by-i18n-breadcrumb.resolver';
import { ThemedBrowseBySwitcherComponent } from './+browse-by-switcher/themed-browse-by-switcher.component';

@NgModule({
imports: [
Expand All @@ -14,7 +14,7 @@ import { BrowseByI18nBreadcrumbResolver } from './browse-by-i18n-breadcrumb.reso
children: [
{
path: ':id',
component: BrowseBySwitcherComponent,
component: ThemedBrowseBySwitcherComponent,
canActivate: [BrowseByGuard],
resolve: { breadcrumb: BrowseByI18nBreadcrumbResolver },
data: { title: 'browse.title', breadcrumbKey: 'browse.metadata' }
Expand Down
2 changes: 2 additions & 0 deletions src/app/+browse-by/browse-by.module.ts
Expand Up @@ -5,6 +5,7 @@ import { SharedModule } from '../shared/shared.module';
import { BrowseByMetadataPageComponent } from './+browse-by-metadata-page/browse-by-metadata-page.component';
import { BrowseByDatePageComponent } from './+browse-by-date-page/browse-by-date-page.component';
import { BrowseBySwitcherComponent } from './+browse-by-switcher/browse-by-switcher.component';
import { ThemedBrowseBySwitcherComponent } from './+browse-by-switcher/themed-browse-by-switcher.component';

const ENTRY_COMPONENTS = [
// put only entry components that use custom decorator
Expand All @@ -20,6 +21,7 @@ const ENTRY_COMPONENTS = [
],
declarations: [
BrowseBySwitcherComponent,
ThemedBrowseBySwitcherComponent,
...ENTRY_COMPONENTS
],
exports: [
Expand Down
4 changes: 2 additions & 2 deletions src/app/+collection-page/collection-page-routing.module.ts
@@ -1,7 +1,6 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';

import { CollectionPageComponent } from './collection-page.component';
import { CollectionPageResolver } from './collection-page.resolver';
import { CreateCollectionPageComponent } from './create-collection-page/create-collection-page.component';
import { AuthenticatedGuard } from '../core/auth/authenticated.guard';
Expand All @@ -21,6 +20,7 @@ import {
import { CollectionPageAdministratorGuard } from './collection-page-administrator.guard';
import { MenuItemType } from '../shared/menu/initial-menus-state';
import { LinkMenuItemModel } from '../shared/menu/menu-item/models/link.model';
import { ThemedCollectionPageComponent } from './themed-collection-page.component';

@NgModule({
imports: [
Expand Down Expand Up @@ -62,7 +62,7 @@ import { LinkMenuItemModel } from '../shared/menu/menu-item/models/link.model';
},
{
path: '',
component: CollectionPageComponent,
component: ThemedCollectionPageComponent,
pathMatch: 'full',
}
],
Expand Down
2 changes: 2 additions & 0 deletions src/app/+collection-page/collection-page.module.ts
Expand Up @@ -13,6 +13,7 @@ import { CollectionItemMapperComponent } from './collection-item-mapper/collecti
import { SearchService } from '../core/shared/search/search.service';
import { StatisticsModule } from '../statistics/statistics.module';
import { CollectionFormModule } from './collection-form/collection-form.module';
import { ThemedCollectionPageComponent } from './themed-collection-page.component';

@NgModule({
imports: [
Expand All @@ -25,6 +26,7 @@ import { CollectionFormModule } from './collection-form/collection-form.module';
],
declarations: [
CollectionPageComponent,
ThemedCollectionPageComponent,
CreateCollectionPageComponent,
DeleteCollectionPageComponent,
EditItemTemplatePageComponent,
Expand Down
26 changes: 26 additions & 0 deletions src/app/+collection-page/themed-collection-page.component.ts
@@ -0,0 +1,26 @@
import { Component } from '@angular/core';
import { ThemedComponent } from '../shared/theme-support/themed.component';
import { CollectionPageComponent } from './collection-page.component';

/**
* Themed wrapper for CollectionPageComponent
*/
@Component({
selector: 'ds-themed-community-page',
styleUrls: [],
templateUrl: '../shared/theme-support/themed.component.html',
})
export class ThemedCollectionPageComponent extends ThemedComponent<CollectionPageComponent> {
protected getComponentName(): string {
return 'CollectionPageComponent';
}

protected importThemedComponent(themeName: string): Promise<any> {
return import(`../../themes/${themeName}/app/+collection-page/collection-page.component`);
}

protected importUnthemedComponent(): Promise<any> {
return import(`./collection-page.component`);
}

}
4 changes: 2 additions & 2 deletions src/app/+community-page/community-page-routing.module.ts
@@ -1,7 +1,6 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';

import { CommunityPageComponent } from './community-page.component';
import { CommunityPageResolver } from './community-page.resolver';
import { CreateCommunityPageComponent } from './create-community-page/create-community-page.component';
import { AuthenticatedGuard } from '../core/auth/authenticated.guard';
Expand All @@ -14,6 +13,7 @@ import { COMMUNITY_EDIT_PATH, COMMUNITY_CREATE_PATH } from './community-page-rou
import { CommunityPageAdministratorGuard } from './community-page-administrator.guard';
import { MenuItemType } from '../shared/menu/initial-menus-state';
import { LinkMenuItemModel } from '../shared/menu/menu-item/models/link.model';
import { ThemedCommunityPageComponent } from './themed-community-page.component';

@NgModule({
imports: [
Expand Down Expand Up @@ -45,7 +45,7 @@ import { LinkMenuItemModel } from '../shared/menu/menu-item/models/link.model';
},
{
path: '',
component: CommunityPageComponent,
component: ThemedCommunityPageComponent,
pathMatch: 'full',
}
],
Expand Down
17 changes: 12 additions & 5 deletions src/app/+community-page/community-page.module.ts
Expand Up @@ -11,6 +11,14 @@ import { CreateCommunityPageComponent } from './create-community-page/create-com
import { DeleteCommunityPageComponent } from './delete-community-page/delete-community-page.component';
import { StatisticsModule } from '../statistics/statistics.module';
import { CommunityFormModule } from './community-form/community-form.module';
import { ThemedCommunityPageComponent } from './themed-community-page.component';

const DECLARATIONS = [CommunityPageComponent,
ThemedCommunityPageComponent,
CommunityPageSubCollectionListComponent,
CommunityPageSubCommunityListComponent,
CreateCommunityPageComponent,
DeleteCommunityPageComponent];

@NgModule({
imports: [
Expand All @@ -21,11 +29,10 @@ import { CommunityFormModule } from './community-form/community-form.module';
CommunityFormModule
],
declarations: [
CommunityPageComponent,
CommunityPageSubCollectionListComponent,
CommunityPageSubCommunityListComponent,
CreateCommunityPageComponent,
DeleteCommunityPageComponent
...DECLARATIONS
],
exports: [
...DECLARATIONS
]
})

Expand Down
26 changes: 26 additions & 0 deletions src/app/+community-page/themed-community-page.component.ts
@@ -0,0 +1,26 @@
import { Component } from '@angular/core';
import { ThemedComponent } from '../shared/theme-support/themed.component';
import { CommunityPageComponent } from './community-page.component';

/**
* Themed wrapper for CommunityPageComponent
*/
@Component({
selector: 'ds-themed-community-page',
styleUrls: [],
templateUrl: '../shared/theme-support/themed.component.html',
})
export class ThemedCommunityPageComponent extends ThemedComponent<CommunityPageComponent> {
protected getComponentName(): string {
return 'CommunityPageComponent';
}

protected importThemedComponent(themeName: string): Promise<any> {
return import(`../../themes/${themeName}/app/+community-page/community-page.component`);
}

protected importUnthemedComponent(): Promise<any> {
return import(`./community-page.component`);
}

}
@@ -1,15 +1,15 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { AuthenticatedGuard } from '../core/auth/authenticated.guard';
import { SubmissionImportExternalComponent } from '../submission/import-external/submission-import-external.component';
import { ThemedSubmissionImportExternalComponent } from '../submission/import-external/themed-submission-import-external.component';

@NgModule({
imports: [
RouterModule.forChild([
{
canActivate: [ AuthenticatedGuard ],
path: '',
component: SubmissionImportExternalComponent,
component: ThemedSubmissionImportExternalComponent,
pathMatch: 'full',
data: {
title: 'submission.import-external.page.title'
Expand Down
3 changes: 1 addition & 2 deletions src/app/+item-page/full/full-item-page.component.ts
Expand Up @@ -18,9 +18,8 @@ import { hasValue } from '../../shared/empty.util';
import { AuthService } from '../../core/auth/auth.service';

/**
* This component renders a simple item page.
* This component renders a full item page.
* The route parameter 'id' is used to request the item it represents.
* All fields of the item that should be displayed, are defined in its template.
*/

@Component({
Expand Down
25 changes: 25 additions & 0 deletions src/app/+item-page/full/themed-full-item-page.component.ts
@@ -0,0 +1,25 @@
import { Component } from '@angular/core';
import { ThemedComponent } from '../../shared/theme-support/themed.component';
import { FullItemPageComponent } from './full-item-page.component';

/**
* Themed wrapper for FullItemPageComponent
*/
@Component({
selector: 'ds-themed-full-item-page',
styleUrls: [],
templateUrl: './../../shared/theme-support/themed.component.html',
})
export class ThemedFullItemPageComponent extends ThemedComponent<FullItemPageComponent> {
protected getComponentName(): string {
return 'FullItemPageComponent';
}

protected importThemedComponent(themeName: string): Promise<any> {
return import(`../../../themes/${themeName}/app/+item-page/full/full-item-page.component`);
}

protected importUnthemedComponent(): Promise<any> {
return import(`./full-item-page.component`);
}
}
11 changes: 5 additions & 6 deletions src/app/+item-page/item-page-routing.module.ts
@@ -1,18 +1,17 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';

import { ItemPageComponent } from './simple/item-page.component';
import { FullItemPageComponent } from './full/full-item-page.component';
import { ItemPageResolver } from './item-page.resolver';
import { AuthenticatedGuard } from '../core/auth/authenticated.guard';
import { ItemBreadcrumbResolver } from '../core/breadcrumbs/item-breadcrumb.resolver';
import { DSOBreadcrumbsService } from '../core/breadcrumbs/dso-breadcrumbs.service';
import { LinkService } from '../core/cache/builders/link.service';
import { UploadBitstreamComponent } from './bitstreams/upload/upload-bitstream.component';
import { UPLOAD_BITSTREAM_PATH, ITEM_EDIT_PATH } from './item-page-routing-paths';
import { ITEM_EDIT_PATH, UPLOAD_BITSTREAM_PATH } from './item-page-routing-paths';
import { ItemPageAdministratorGuard } from './item-page-administrator.guard';
import { MenuItemType } from '../shared/menu/initial-menus-state';
import { LinkMenuItemModel } from '../shared/menu/menu-item/models/link.model';
import { ThemedItemPageComponent } from './simple/themed-item-page.component';
import { ThemedFullItemPageComponent } from './full/themed-full-item-page.component';

@NgModule({
imports: [
Expand All @@ -27,12 +26,12 @@ import { LinkMenuItemModel } from '../shared/menu/menu-item/models/link.model';
children: [
{
path: '',
component: ItemPageComponent,
component: ThemedItemPageComponent,
pathMatch: 'full',
},
{
path: 'full',
component: FullItemPageComponent,
component: ThemedFullItemPageComponent,
},
{
path: ITEM_EDIT_PATH,
Expand Down
4 changes: 4 additions & 0 deletions src/app/+item-page/item-page.module.ts
Expand Up @@ -25,6 +25,8 @@ import { AbstractIncrementalListComponent } from './simple/abstract-incremental-
import { UntypedItemComponent } from './simple/item-types/untyped-item/untyped-item.component';
import { JournalEntitiesModule } from '../entity-groups/journal-entities/journal-entities.module';
import { ResearchEntitiesModule } from '../entity-groups/research-entities/research-entities.module';
import { ThemedItemPageComponent } from './simple/themed-item-page.component';
import { ThemedFullItemPageComponent } from './full/themed-full-item-page.component';

const ENTRY_COMPONENTS = [
// put only entry components that use custom decorator
Expand All @@ -34,7 +36,9 @@ const ENTRY_COMPONENTS = [

const DECLARATIONS = [
ItemPageComponent,
ThemedItemPageComponent,
FullItemPageComponent,
ThemedFullItemPageComponent,
MetadataUriValuesComponent,
ItemPageAuthorFieldComponent,
ItemPageDateFieldComponent,
Expand Down
27 changes: 27 additions & 0 deletions src/app/+item-page/simple/themed-item-page.component.ts
@@ -0,0 +1,27 @@
import { Component } from '@angular/core';
import { ThemedComponent } from '../../shared/theme-support/themed.component';
import { ItemPageComponent } from './item-page.component';

/**
* Themed wrapper for ItemPageComponent
*/
@Component({
selector: 'ds-themed-item-page',
styleUrls: [],
templateUrl: './../../shared/theme-support/themed.component.html',
})

export class ThemedItemPageComponent extends ThemedComponent<ItemPageComponent> {
protected getComponentName(): string {
return 'ItemPageComponent';
}

protected importThemedComponent(themeName: string): Promise<any> {
return import(`../../../themes/${themeName}/app/+item-page/simple/item-page.component`);
}

protected importUnthemedComponent(): Promise<any> {
return import(`./item-page.component`);
}

}
5 changes: 2 additions & 3 deletions src/app/+login-page/login-page-routing.module.ts
@@ -1,14 +1,13 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';

import { LoginPageComponent } from './login-page.component';
import { I18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver';
import { I18nBreadcrumbsService } from '../core/breadcrumbs/i18n-breadcrumbs.service';
import { ThemedLoginPageComponent } from './themed-login-page.component';

@NgModule({
imports: [
RouterModule.forChild([
{ path: '', pathMatch: 'full', component: LoginPageComponent, resolve: { breadcrumb: I18nBreadcrumbResolver }, data: { breadcrumbKey: 'login', title: 'login.title' } }
{ path: '', pathMatch: 'full', component: ThemedLoginPageComponent, resolve: { breadcrumb: I18nBreadcrumbResolver }, data: { breadcrumbKey: 'login', title: 'login.title' } }
])
],
providers: [
Expand Down
4 changes: 3 additions & 1 deletion src/app/+login-page/login-page.module.ts
Expand Up @@ -3,6 +3,7 @@ import { NgModule } from '@angular/core';
import { SharedModule } from '../shared/shared.module';
import { LoginPageComponent } from './login-page.component';
import { LoginPageRoutingModule } from './login-page-routing.module';
import { ThemedLoginPageComponent } from './themed-login-page.component';

@NgModule({
imports: [
Expand All @@ -11,7 +12,8 @@ import { LoginPageRoutingModule } from './login-page-routing.module';
SharedModule,
],
declarations: [
LoginPageComponent
LoginPageComponent,
ThemedLoginPageComponent
]
})
export class LoginPageModule {
Expand Down

0 comments on commit d7daaf4

Please sign in to comment.