Skip to content

Commit

Permalink
Merge pull request #3065 from alexandrevryghem/new-themed-components_…
Browse files Browse the repository at this point in the history
…contribute-main

Made AdminSearchPageComponent themeable
  • Loading branch information
tdonohue authored Dec 10, 2024
2 parents dcea3ba + 446280b commit ac00f88
Show file tree
Hide file tree
Showing 15 changed files with 109 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/app/admin/admin-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import {
REGISTRIES_MODULE_PATH,
REPORTS_MODULE_PATH,
} from './admin-routing-paths';
import { AdminSearchPageComponent } from './admin-search-page/admin-search-page.component';
import { AdminWorkflowPageComponent } from './admin-workflow-page/admin-workflow-page.component';
import { ThemedAdminSearchPageComponent } from './admin-search-page/themed-admin-search-page.component';
import { ThemedAdminWorkflowPageComponent } from './admin-workflow-page/themed-admin-workflow-page.component';

export const ROUTES: Route[] = [
{
Expand All @@ -28,13 +28,13 @@ export const ROUTES: Route[] = [
{
path: 'search',
resolve: { breadcrumb: i18nBreadcrumbResolver },
component: AdminSearchPageComponent,
component: ThemedAdminSearchPageComponent,
data: { title: 'admin.search.title', breadcrumbKey: 'admin.search' },
},
{
path: 'workflow',
resolve: { breadcrumb: i18nBreadcrumbResolver },
component: AdminWorkflowPageComponent,
component: ThemedAdminWorkflowPageComponent,
data: { title: 'admin.workflow.title', breadcrumbKey: 'admin.workflow' },
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Context } from '../../core/shared/context.model';
import { ThemedConfigurationSearchPageComponent } from '../../search-page/themed-configuration-search-page.component';

@Component({
selector: 'ds-admin-search-page',
selector: 'ds-base-admin-search-page',
templateUrl: './admin-search-page.component.html',
styleUrls: ['./admin-search-page.component.scss'],
standalone: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Component } from '@angular/core';

import { ThemedComponent } from '../../shared/theme-support/themed.component';
import { AdminSearchPageComponent } from './admin-search-page.component';

/**
* Themed wrapper for {@link AdminSearchPageComponent}
*/
@Component({
selector: 'ds-admin-search-page',
templateUrl: '../../shared/theme-support/themed.component.html',
standalone: true,
imports: [AdminSearchPageComponent],
})
export class ThemedAdminSearchPageComponent extends ThemedComponent<AdminSearchPageComponent> {

protected getComponentName(): string {
return 'AdminSearchPageComponent';
}

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

protected importUnthemedComponent(): Promise<any> {
return import('./admin-search-page.component');
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import { Context } from '../../core/shared/context.model';
import { ThemedConfigurationSearchPageComponent } from '../../search-page/themed-configuration-search-page.component';

@Component({
selector: 'ds-admin-workflow-page',
selector: 'ds-base-admin-workflow-page',
templateUrl: './admin-workflow-page.component.html',
styleUrls: ['./admin-workflow-page.component.scss'],
standalone: true,
imports: [ThemedConfigurationSearchPageComponent],
imports: [
ThemedConfigurationSearchPageComponent,
],
})

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Component } from '@angular/core';

import { ThemedComponent } from '../../shared/theme-support/themed.component';
import { AdminWorkflowPageComponent } from './admin-workflow-page.component';

/**
* Themed wrapper for {@link AdminWorkflowPageComponent}
*/
@Component({
selector: 'ds-admin-workflow-page',
templateUrl: '../../shared/theme-support/themed.component.html',
standalone: true,
imports: [AdminWorkflowPageComponent],
})
export class ThemedAdminWorkflowPageComponent extends ThemedComponent<AdminWorkflowPageComponent> {

protected getComponentName(): string {
return 'AdminWorkflowPageComponent';
}

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

protected importUnthemedComponent(): Promise<any> {
return import('./admin-workflow-page.component');
}

}
2 changes: 1 addition & 1 deletion src/app/core/metadata/metadata.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class MetadataService {
* Returns undefined otherwise.
*/
public virtualValue(metadataValue: MetadataValue | undefined): string {
if (this.isVirtual) {
if (this.isVirtual(metadataValue)) {
return metadataValue.authority.substring(metadataValue.authority.indexOf(VIRTUAL_METADATA_PREFIX) + VIRTUAL_METADATA_PREFIX.length);
} else {
return undefined;
Expand Down
2 changes: 1 addition & 1 deletion src/app/navbar/navbar.component.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<nav [ngClass]="{'open': (menuCollapsed | async) !== true}"
[@slideMobileNav]="(windowService.isXsOrSm() | async) !== true ? 'default' : ((menuCollapsed | async) ? 'collapsed' : 'expanded')"
class="navbar navbar-light navbar-expand-md px-md-0 pt-md-0 pt-3 navbar-container" role="navigation"
class="navbar navbar-light navbar-expand-md px-md-0 navbar-container" role="navigation"
[attr.aria-label]="'nav.main.description' | translate" id="main-navbar">
<!-- TODO remove navbar-container class when https://github.com/twbs/bootstrap/issues/24726 is fixed -->
<div class="navbar-inner-container w-100" [class.container]="(isMobile$ | async) !== true">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,11 @@ export class InputSuggestionsComponent implements ControlValueAccessor, OnChange
}

/**
* When any key is pressed (except for the Enter button) the query input should move to the input field
* When any key is pressed (except for the Enter & Tab button) the query input should move to the input field
* @param {KeyboardEvent} event The keyboard event
*/
onKeydown(event: KeyboardEvent) {
if (event.key !== 'Enter') {
if (event.key !== 'Enter' && event.key !== 'Tab') {
this.queryInput.nativeElement.focus();
}
}
Expand Down
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Component } from '@angular/core';

import { AdminSearchPageComponent as BaseComponent } from '../../../../../app/admin/admin-search-page/admin-search-page.component';
import { ThemedConfigurationSearchPageComponent } from '../../../../../app/search-page/themed-configuration-search-page.component';

@Component({
selector: 'ds-themed-admin-search-page',
// styleUrls: ['./admin-search-page.component.scss'],
styleUrls: ['../../../../../app/admin/admin-search-page/admin-search-page.component.scss'],
// templateUrl: './admin-search-page.component.html',
templateUrl: '../../../../../app/admin/admin-search-page/admin-search-page.component.html',
standalone: true,
imports: [ThemedConfigurationSearchPageComponent],
})
export class AdminSearchPageComponent extends BaseComponent {
}
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Component } from '@angular/core';

import { AdminWorkflowPageComponent as BaseComponent } from '../../../../../app/admin/admin-workflow-page/admin-workflow-page.component';
import { ThemedConfigurationSearchPageComponent } from '../../../../../app/search-page/themed-configuration-search-page.component';

@Component({
selector: 'ds-themed-admin-workflow-page',
// styleUrls: ['./admin-workflow-page.component.scss'],
styleUrls: ['../../../../../app/admin/admin-workflow-page/admin-workflow-page.component.scss'],
// templateUrl: './admin-workflow-page.component.html',
templateUrl: '../../../../../app/admin/admin-workflow-page/admin-workflow-page.component.html',
standalone: true,
imports: [
ThemedConfigurationSearchPageComponent,
],
})
export class AdminWorkflowPageComponent extends BaseComponent {
}
4 changes: 4 additions & 0 deletions src/themes/custom/lazy-theme.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ import { ScrollToModule } from '@nicky-lenaers/ngx-scroll-to';

import { RootModule } from '../../app/root.module';
import { MetadataImportPageComponent } from './app/admin/admin-import-metadata-page/metadata-import-page.component';
import { AdminSearchPageComponent } from './app/admin/admin-search-page/admin-search-page.component';
import { AdminSidebarComponent } from './app/admin/admin-sidebar/admin-sidebar.component';
import { AdminWorkflowPageComponent } from './app/admin/admin-workflow-page/admin-workflow-page.component';
import { EditBitstreamPageComponent } from './app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component';
import { BreadcrumbsComponent } from './app/breadcrumbs/breadcrumbs.component';
import { BrowseByDateComponent } from './app/browse-by/browse-by-date/browse-by-date.component';
Expand Down Expand Up @@ -194,6 +196,8 @@ const DECLARATIONS = [
ProfilePageMetadataFormComponent,
SubmissionUploadFilesComponent,
ComcolPageContentComponent,
AdminSearchPageComponent,
AdminWorkflowPageComponent,
];

@NgModule({
Expand Down

0 comments on commit ac00f88

Please sign in to comment.