Skip to content

Commit

Permalink
117274: Themed DSOSelectorComponent
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandrevryghem committed Sep 5, 2024
1 parent f55c02a commit c1e4777
Show file tree
Hide file tree
Showing 15 changed files with 69 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { Component, Input, Output, EventEmitter } from '@angular/core';
import { ThemedComponent } from '../../theme-support/themed.component';
import { DSpaceObjectType } from '../../../core/shared/dspace-object-type.model';
import { SortOptions } from '../../../core/cache/models/sort-options.model';
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
import { DSOSelectorComponent } from './dso-selector.component';

/**
* Themed wrapper for {@link DSOSelectorComponent}
*/
@Component({
selector: 'ds-themed-dso-selector',
templateUrl: '../../theme-support/themed.component.html',
})
export class ThemedDSOSelectorComponent extends ThemedComponent<DSOSelectorComponent> {

@Input() currentDSOId: string;

@Input() types: DSpaceObjectType[];

@Input() sort: SortOptions;

@Output() onSelect: EventEmitter<DSpaceObject> = new EventEmitter();

protected inAndOutputNames: (keyof DSOSelectorComponent & keyof this)[] = [
'currentDSOId',
'types',
'sort',
'onSelect',
];

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

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

protected importUnthemedComponent(): Promise<any> {
return import('./dso-selector.component');
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ <h3 class="position-relative py-1 my-3 font-weight-normal">
</h3>

<h5 class="px-2">{{'dso-selector.create.community.sub-level' | translate}}</h5>
<ds-dso-selector [currentDSOId]="dsoRD?.payload.uuid" [types]="selectorTypes" [sort]="defaultSort" (onSelect)="selectObject($event)"></ds-dso-selector>
<ds-themed-dso-selector [currentDSOId]="dsoRD?.payload.uuid" [types]="selectorTypes" [sort]="defaultSort" (onSelect)="selectObject($event)"></ds-themed-dso-selector>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
</div>
<div class="modal-body">
<h5 *ngIf="header" class="px-2">{{header | translate}}</h5>
<ds-dso-selector [currentDSOId]="dsoRD?.payload.uuid" [types]="selectorTypes" [sort]="defaultSort" (onSelect)="selectObject($event)"></ds-dso-selector>
<ds-themed-dso-selector [currentDSOId]="dsoRD?.payload.uuid" [types]="selectorTypes" [sort]="defaultSort" (onSelect)="selectObject($event)"></ds-themed-dso-selector>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
</div>
<div class="modal-body">
<h5 *ngIf="header" class="px-2">{{header | translate}}</h5>
<ds-dso-selector [currentDSOId]="dsoRD?.payload.uuid" [types]="selectorTypes" (onSelect)="selectObject($event)"></ds-dso-selector>
<ds-themed-dso-selector [currentDSOId]="dsoRD?.payload.uuid" [types]="selectorTypes" (onSelect)="selectObject($event)"></ds-themed-dso-selector>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ <h3 class="position-relative py-1 my-3 font-weight-normal">
</h3>

<h5 class="px-2">{{'dso-selector.' + action + '.' + objectType.toString().toLowerCase() + '.input-header' | translate}}</h5>
<ds-dso-selector [currentDSOId]="dsoRD?.payload.uuid" [types]="selectorTypes" [sort]="defaultSort" (onSelect)="selectObject($event)"></ds-dso-selector>
<ds-themed-dso-selector [currentDSOId]="dsoRD?.payload.uuid" [types]="selectorTypes" [sort]="defaultSort" (onSelect)="selectObject($event)"></ds-themed-dso-selector>
</div>
</div>
2 changes: 2 additions & 0 deletions src/app/shared/shared.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ import { AutoFocusDirective } from './utils/auto-focus.directive';
import { StartsWithDateComponent } from './starts-with/date/starts-with-date.component';
import { StartsWithTextComponent } from './starts-with/text/starts-with-text.component';
import { DSOSelectorComponent } from './dso-selector/dso-selector/dso-selector.component';
import { ThemedDSOSelectorComponent } from './dso-selector/dso-selector/themed-dso-selector.component';
import {
CreateCommunityParentSelectorComponent
} from './dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component';
Expand Down Expand Up @@ -366,6 +367,7 @@ const COMPONENTS = [
ValidationSuggestionsComponent,
DsoInputSuggestionsComponent,
DSOSelectorComponent,
ThemedDSOSelectorComponent,
SearchExportCsvComponent,
PageSizeSelectorComponent,
ListableObjectComponentLoaderComponent,
Expand Down
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Component } from '@angular/core';
import { DSOSelectorComponent as BaseComponent } from '../../../../../../app/shared/dso-selector/dso-selector/dso-selector.component';

@Component({
selector: 'ds-dso-selector',
// styleUrls: ['./dso-selector.component.scss'],
styleUrls: ['../../../../../../app/shared/dso-selector/dso-selector/dso-selector.component.scss'],
// templateUrl: './dso-selector.component.html',
templateUrl: '../../../../../../app/shared/dso-selector/dso-selector/dso-selector.component.html',
})
export class DSOSelectorComponent extends BaseComponent {
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
</div>
<div class="modal-body">
<h5 *ngIf="header" class="px-2">{{header | translate}}</h5>
<ds-dso-selector [currentDSOId]="dsoRD?.payload.uuid" [types]="selectorTypes" [sort]="defaultSort" (onSelect)="selectObject($event)"></ds-dso-selector>
<ds-themed-dso-selector [currentDSOId]="dsoRD?.payload.uuid" [types]="selectorTypes" [sort]="defaultSort" (onSelect)="selectObject($event)"></ds-themed-dso-selector>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ <h3 class="position-relative py-1 my-3 font-weight-normal">
</h3>

<h5 class="px-2">{{'dso-selector.create.community.sub-level' | translate}}</h5>
<ds-dso-selector [currentDSOId]="dsoRD?.payload.uuid" [types]="selectorTypes" [sort]="defaultSort" (onSelect)="selectObject($event)"></ds-dso-selector>
<ds-themed-dso-selector [currentDSOId]="dsoRD?.payload.uuid" [types]="selectorTypes" [sort]="defaultSort" (onSelect)="selectObject($event)"></ds-themed-dso-selector>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
</div>
<div class="modal-body">
<h5 *ngIf="header" class="px-2">{{header | translate}}</h5>
<ds-dso-selector [currentDSOId]="dsoRD?.payload.uuid" [types]="selectorTypes" [sort]="defaultSort" (onSelect)="selectObject($event)"></ds-dso-selector>
<ds-themed-dso-selector [currentDSOId]="dsoRD?.payload.uuid" [types]="selectorTypes" [sort]="defaultSort" (onSelect)="selectObject($event)"></ds-themed-dso-selector>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
</div>
<div class="modal-body">
<h5 *ngIf="header" class="px-2">{{header | translate}}</h5>
<ds-dso-selector [currentDSOId]="dsoRD?.payload.uuid" [types]="selectorTypes" [sort]="defaultSort" (onSelect)="selectObject($event)"></ds-dso-selector>
<ds-themed-dso-selector [currentDSOId]="dsoRD?.payload.uuid" [types]="selectorTypes" [sort]="defaultSort" (onSelect)="selectObject($event)"></ds-themed-dso-selector>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
</div>
<div class="modal-body">
<h5 *ngIf="header" class="px-2">{{header | translate}}</h5>
<ds-dso-selector [currentDSOId]="dsoRD?.payload.uuid" [types]="selectorTypes" (onSelect)="selectObject($event)"></ds-dso-selector>
<ds-themed-dso-selector [currentDSOId]="dsoRD?.payload.uuid" [types]="selectorTypes" (onSelect)="selectObject($event)"></ds-themed-dso-selector>
</div>
</div>
2 changes: 2 additions & 0 deletions src/themes/custom/lazy-theme.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ import { RequestCopyModule } from 'src/app/request-copy/request-copy.module';
import {
AuthorizedCollectionSelectorComponent
} from './app/shared/dso-selector/dso-selector/authorized-collection-selector/authorized-collection-selector.component';
import { DSOSelectorComponent } from './app/shared/dso-selector/dso-selector/dso-selector.component';

const DECLARATIONS = [
FileSectionComponent,
Expand Down Expand Up @@ -243,6 +244,7 @@ const DECLARATIONS = [
ItemStatusComponent,
EditBitstreamPageComponent,
AuthorizedCollectionSelectorComponent,
DSOSelectorComponent,
];

@NgModule({
Expand Down

0 comments on commit c1e4777

Please sign in to comment.