mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
Merge pull request #1939 from atmire/w2p-96062_theme-collection-dropdown-component
Make the CollectionDropdownComponent themeable
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<ds-collection-dropdown (selectionChange)="selectObject($event)">
|
<ds-themed-collection-dropdown (selectionChange)="selectObject($event)">
|
||||||
</ds-collection-dropdown>
|
</ds-themed-collection-dropdown>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -128,10 +128,13 @@ describe('CollectionSelectorComponent', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
scheduler = getTestScheduler();
|
scheduler = getTestScheduler();
|
||||||
fixture = TestBed.createComponent(CollectionSelectorComponent);
|
fixture = TestBed.overrideComponent(CollectionSelectorComponent, {
|
||||||
|
set: {
|
||||||
|
template: '<ds-collection-dropdown (selectionChange)="selectObject($event)"></ds-collection-dropdown>'
|
||||||
|
}
|
||||||
|
}).createComponent(CollectionSelectorComponent);
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create', () => {
|
it('should create', () => {
|
||||||
|
@@ -0,0 +1,33 @@
|
|||||||
|
import { CollectionDropdownComponent, CollectionListEntry } from './collection-dropdown.component';
|
||||||
|
import { ThemedComponent } from '../theme-support/themed.component';
|
||||||
|
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-themed-collection-dropdown',
|
||||||
|
styleUrls: [],
|
||||||
|
templateUrl: '../../shared/theme-support/themed.component.html',
|
||||||
|
})
|
||||||
|
export class ThemedCollectionDropdownComponent extends ThemedComponent<CollectionDropdownComponent> {
|
||||||
|
|
||||||
|
@Input() entityType: string;
|
||||||
|
|
||||||
|
@Output() searchComplete = new EventEmitter<any>();
|
||||||
|
|
||||||
|
@Output() theOnlySelectable = new EventEmitter<CollectionListEntry>();
|
||||||
|
|
||||||
|
@Output() selectionChange = new EventEmitter<CollectionListEntry>();
|
||||||
|
|
||||||
|
protected inAndOutputNames: (keyof CollectionDropdownComponent & keyof this)[] = ['entityType', 'searchComplete', 'theOnlySelectable', 'selectionChange'];
|
||||||
|
|
||||||
|
protected getComponentName(): string {
|
||||||
|
return 'CollectionDropdownComponent';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected importThemedComponent(themeName: string): Promise<any> {
|
||||||
|
return import(`../../../themes/${themeName}/app/shared/collection-dropdown/collection-dropdown.component`);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected importUnthemedComponent(): Promise<any> {
|
||||||
|
return import(`./collection-dropdown.component`);
|
||||||
|
}
|
||||||
|
}
|
@@ -315,6 +315,7 @@ import { MenuModule } from './menu/menu.module';
|
|||||||
import {
|
import {
|
||||||
ListableNotificationObjectComponent
|
ListableNotificationObjectComponent
|
||||||
} from './object-list/listable-notification-object/listable-notification-object.component';
|
} from './object-list/listable-notification-object/listable-notification-object.component';
|
||||||
|
import { ThemedCollectionDropdownComponent } from './collection-dropdown/themed-collection-dropdown.component';
|
||||||
|
|
||||||
const MODULES = [
|
const MODULES = [
|
||||||
CommonModule,
|
CommonModule,
|
||||||
@@ -484,6 +485,7 @@ const ENTRY_COMPONENTS = [
|
|||||||
ClaimedTaskActionsReturnToPoolComponent,
|
ClaimedTaskActionsReturnToPoolComponent,
|
||||||
ClaimedTaskActionsEditMetadataComponent,
|
ClaimedTaskActionsEditMetadataComponent,
|
||||||
CollectionDropdownComponent,
|
CollectionDropdownComponent,
|
||||||
|
ThemedCollectionDropdownComponent,
|
||||||
FileDownloadLinkComponent,
|
FileDownloadLinkComponent,
|
||||||
BitstreamDownloadPageComponent,
|
BitstreamDownloadPageComponent,
|
||||||
BitstreamRequestACopyPageComponent,
|
BitstreamRequestACopyPageComponent,
|
||||||
|
@@ -35,9 +35,9 @@
|
|||||||
class="dropdown-menu"
|
class="dropdown-menu"
|
||||||
id="collectionControlsDropdownMenu"
|
id="collectionControlsDropdownMenu"
|
||||||
aria-labelledby="collectionControlsMenuButton">
|
aria-labelledby="collectionControlsMenuButton">
|
||||||
<ds-collection-dropdown
|
<ds-themed-collection-dropdown
|
||||||
(selectionChange)="onSelect($event)">
|
(selectionChange)="onSelect($event)">
|
||||||
</ds-collection-dropdown>
|
</ds-themed-collection-dropdown>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -6,11 +6,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<ds-themed-loading *ngIf="isLoading()"></ds-themed-loading>
|
<ds-themed-loading *ngIf="isLoading()"></ds-themed-loading>
|
||||||
<ds-collection-dropdown [ngClass]="{'d-none': isLoading()}"
|
<ds-themed-collection-dropdown [ngClass]="{'d-none': isLoading()}"
|
||||||
(selectionChange)="selectObject($event)"
|
(selectionChange)="selectObject($event)"
|
||||||
(searchComplete)="searchComplete()"
|
(searchComplete)="searchComplete()"
|
||||||
(theOnlySelectable)="theOnlySelectable($event)"
|
(theOnlySelectable)="theOnlySelectable($event)"
|
||||||
[entityType]="entityType">
|
[entityType]="entityType">
|
||||||
</ds-collection-dropdown>
|
</ds-themed-collection-dropdown>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -122,7 +122,7 @@ describe('SubmissionImportExternalCollectionComponent test suite', () => {
|
|||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
fixture.whenStable().then(() => {
|
fixture.whenStable().then(() => {
|
||||||
const dropdownMenu = fixture.debugElement.query(By.css('ds-collection-dropdown')).nativeElement;
|
const dropdownMenu = fixture.debugElement.query(By.css('ds-themed-collection-dropdown')).nativeElement;
|
||||||
expect(dropdownMenu.classList).toContain('d-none');
|
expect(dropdownMenu.classList).toContain('d-none');
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
@@ -0,0 +1,15 @@
|
|||||||
|
import {
|
||||||
|
CollectionDropdownComponent as BaseComponent
|
||||||
|
} from '../../../../../app/shared/collection-dropdown/collection-dropdown.component';
|
||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-collection-dropdown',
|
||||||
|
templateUrl: '../../../../../app/shared/collection-dropdown/collection-dropdown.component.html',
|
||||||
|
// templateUrl: './collection-dropdown.component.html',
|
||||||
|
styleUrls: ['../../../../../app/shared/collection-dropdown/collection-dropdown.component.scss']
|
||||||
|
// styleUrls: ['./collection-dropdown.component.scss']
|
||||||
|
})
|
||||||
|
export class CollectionDropdownComponent extends BaseComponent {
|
||||||
|
|
||||||
|
}
|
@@ -43,6 +43,7 @@ import {
|
|||||||
|
|
||||||
import { CommunityListElementComponent } from './app/shared/object-list/community-list-element/community-list-element.component';
|
import { CommunityListElementComponent } from './app/shared/object-list/community-list-element/community-list-element.component';
|
||||||
import { CollectionListElementComponent} from './app/shared/object-list/collection-list-element/collection-list-element.component';
|
import { CollectionListElementComponent} from './app/shared/object-list/collection-list-element/collection-list-element.component';
|
||||||
|
import { CollectionDropdownComponent } from './app/shared/collection-dropdown/collection-dropdown.component';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -58,6 +59,7 @@ const ENTRY_COMPONENTS = [
|
|||||||
|
|
||||||
CommunityListElementComponent,
|
CommunityListElementComponent,
|
||||||
CollectionListElementComponent,
|
CollectionListElementComponent,
|
||||||
|
CollectionDropdownComponent,
|
||||||
];
|
];
|
||||||
|
|
||||||
const DECLARATIONS = [
|
const DECLARATIONS = [
|
||||||
|
Reference in New Issue
Block a user