mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
small UI tweaks, fix tests
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { switchMap } from 'rxjs/operators';
|
||||
import { HostWindowService } from '../shared/host-window.service';
|
||||
import { SidebarService } from '../shared/sidebar/sidebar.service';
|
||||
import { SearchComponent } from './search.component';
|
||||
|
@@ -1,7 +1,9 @@
|
||||
<ds-truncatable [id]="dso.id">
|
||||
<div class="card" [@focusShadow]="(isCollapsed$ | async)?'blur':'focus'">
|
||||
<div class="card" [@focusShadow]="(isCollapsed$ | async)?'blur':'focus'">
|
||||
<ds-truncatable [id]="dso.id">
|
||||
<ng-content></ng-content>
|
||||
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]"
|
||||
<a *ngIf="linkType != linkTypes.None"
|
||||
[target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'"
|
||||
rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]"
|
||||
class="card-img-top full-width">
|
||||
<div>
|
||||
<ds-grid-thumbnail [thumbnail]="getThumbnail() | async">
|
||||
@@ -19,7 +21,8 @@
|
||||
<ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4">
|
||||
<h4 class="card-title" [innerHTML]="firstMetadataValue('dc.title')"></h4>
|
||||
</ds-truncatable-part>
|
||||
<p *ngIf="dso.hasMetadata('creativework.datePublished')" class="item-date card-text text-muted">
|
||||
<p *ngIf="dso.hasMetadata('creativework.datePublished')"
|
||||
class="item-date card-text text-muted">
|
||||
<ds-truncatable-part [id]="dso.id" [minLines]="1">
|
||||
<span [innerHTML]="firstMetadataValue('creativework.datePublished')"></span>
|
||||
</ds-truncatable-part>
|
||||
@@ -30,10 +33,11 @@
|
||||
</ds-truncatable-part>
|
||||
</p>
|
||||
<div *ngIf="linkType != linkTypes.None" class="text-center">
|
||||
<a [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]"
|
||||
<a [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'"
|
||||
rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]"
|
||||
class="lead btn btn-primary viewButton">View</a>
|
||||
</div>
|
||||
</div>
|
||||
</ds-truncatable>
|
||||
<ng-content></ng-content>
|
||||
</div>
|
||||
</ds-truncatable>
|
||||
</div>
|
||||
|
@@ -1,7 +1,9 @@
|
||||
<ds-truncatable [id]="dso.id">
|
||||
<div class="card" [@focusShadow]="(isCollapsed$ | async)?'blur':'focus'">
|
||||
<div class="card" [@focusShadow]="(isCollapsed$ | async)?'blur':'focus'">
|
||||
<ds-truncatable [id]="dso.id">
|
||||
<ng-content></ng-content>
|
||||
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]"
|
||||
<a *ngIf="linkType != linkTypes.None"
|
||||
[target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'"
|
||||
rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]"
|
||||
class="card-img-top full-width">
|
||||
<div>
|
||||
<ds-grid-thumbnail [thumbnail]="getThumbnail() | async">
|
||||
@@ -19,7 +21,8 @@
|
||||
<ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4">
|
||||
<h4 class="card-title" [innerHTML]="dso.firstMetadataValue('dc.title')"></h4>
|
||||
</ds-truncatable-part>
|
||||
<p *ngIf="dso.hasMetadata('creativework.datePublished')" class="item-date card-text text-muted">
|
||||
<p *ngIf="dso.hasMetadata('creativework.datePublished')"
|
||||
class="item-date card-text text-muted">
|
||||
<ds-truncatable-part [id]="dso.id" [minLines]="1">
|
||||
<span [innerHTML]="firstMetadataValue('creativework.datePublished')"></span>
|
||||
</ds-truncatable-part>
|
||||
@@ -30,10 +33,11 @@
|
||||
</ds-truncatable-part>
|
||||
</p>
|
||||
<div *ngIf="linkType != linkTypes.None" class="text-center">
|
||||
<a [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]"
|
||||
<a [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'"
|
||||
rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]"
|
||||
class="lead btn btn-primary viewButton">View</a>
|
||||
</div>
|
||||
</div>
|
||||
</ds-truncatable>
|
||||
<ng-content></ng-content>
|
||||
</div>
|
||||
</ds-truncatable>
|
||||
</div>
|
||||
|
@@ -1,7 +1,9 @@
|
||||
<ds-truncatable [id]="dso.id">
|
||||
<div class="card" [@focusShadow]="(isCollapsed$ | async)?'blur':'focus'">
|
||||
<div class="card" [@focusShadow]="(isCollapsed$ | async)?'blur':'focus'">
|
||||
<ds-truncatable [id]="dso.id">
|
||||
<ng-content></ng-content>
|
||||
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]"
|
||||
<a *ngIf="linkType != linkTypes.None"
|
||||
[target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'"
|
||||
rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]"
|
||||
class="card-img-top full-width">
|
||||
<div>
|
||||
<ds-grid-thumbnail [thumbnail]="getThumbnail() | async">
|
||||
@@ -35,10 +37,11 @@
|
||||
</ds-truncatable-part>
|
||||
</p>
|
||||
<div *ngIf="linkType != linkTypes.None" class="text-center">
|
||||
<a [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]"
|
||||
<a [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'"
|
||||
rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]"
|
||||
class="lead btn btn-primary viewButton">View</a>
|
||||
</div>
|
||||
</div>
|
||||
</ds-truncatable>
|
||||
<ng-content></ng-content>
|
||||
</div>
|
||||
</ds-truncatable>
|
||||
</div>
|
||||
|
@@ -1,7 +1,9 @@
|
||||
<ds-truncatable [id]="dso.id">
|
||||
<div class="card" [@focusShadow]="(isCollapsed$ | async)?'blur':'focus'">
|
||||
<div class="card" [@focusShadow]="(isCollapsed$ | async)?'blur':'focus'">
|
||||
<ds-truncatable [id]="dso.id">
|
||||
<ng-content></ng-content>
|
||||
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]"
|
||||
<a *ngIf="linkType != linkTypes.None"
|
||||
[target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'"
|
||||
rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]"
|
||||
class="card-img-top full-width">
|
||||
<div>
|
||||
<ds-grid-thumbnail [thumbnail]="getThumbnail() | async">
|
||||
@@ -19,7 +21,8 @@
|
||||
<ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4">
|
||||
<h4 class="card-title" [innerHTML]="firstMetadataValue('organization.legalName')"></h4>
|
||||
</ds-truncatable-part>
|
||||
<p *ngIf="dso.hasMetadata('organization.foundingDate')" class="item-date card-text text-muted">
|
||||
<p *ngIf="dso.hasMetadata('organization.foundingDate')"
|
||||
class="item-date card-text text-muted">
|
||||
<ds-truncatable-part [id]="dso.id" [minLines]="1">
|
||||
<span [innerHTML]="firstMetadataValue('organization.foundingDate')"></span>
|
||||
</ds-truncatable-part>
|
||||
@@ -27,7 +30,8 @@
|
||||
<p *ngIf="dso.hasMetadata('organization.address.addressCountry')"
|
||||
class="item-location card-text">
|
||||
<ds-truncatable-part [id]="dso.id" [minLines]="3">
|
||||
<span class="item-country">{{firstMetadataValue('organization.address.addressCountry')}}</span>
|
||||
<span
|
||||
class="item-country">{{firstMetadataValue('organization.address.addressCountry')}}</span>
|
||||
<span *ngIf="dso.hasMetadata('organization.address.addressLocality')" class="item-city">
|
||||
<span>, </span>
|
||||
{{firstMetadataValue('organization.address.addressLocality')}}
|
||||
@@ -35,10 +39,11 @@
|
||||
</ds-truncatable-part>
|
||||
</p>
|
||||
<div *ngIf="linkType != linkTypes.None" class="text-center">
|
||||
<a [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]"
|
||||
<a [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'"
|
||||
rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]"
|
||||
class="lead btn btn-primary viewButton">View</a>
|
||||
</div>
|
||||
</div>
|
||||
</ds-truncatable>
|
||||
<ng-content></ng-content>
|
||||
</div>
|
||||
</ds-truncatable>
|
||||
</div>
|
||||
|
@@ -1,7 +1,9 @@
|
||||
<ds-truncatable [id]="dso.id">
|
||||
<div class="card" [@focusShadow]="(isCollapsed$ | async)?'blur':'focus'">
|
||||
<div class="card" [@focusShadow]="(isCollapsed$ | async)?'blur':'focus'">
|
||||
<ds-truncatable [id]="dso.id">
|
||||
<ng-content></ng-content>
|
||||
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]"
|
||||
<a *ngIf="linkType != linkTypes.None"
|
||||
[target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'"
|
||||
rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]"
|
||||
class="card-img-top full-width">
|
||||
<div>
|
||||
<ds-grid-thumbnail [thumbnail]="getThumbnail() | async">
|
||||
@@ -17,7 +19,8 @@
|
||||
<div class="card-body">
|
||||
<ds-item-type-badge [object]="dso"></ds-item-type-badge>
|
||||
<ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4">
|
||||
<h4 class="card-title" [innerHTML]="firstMetadataValue('person.familyName') + ', ' + firstMetadataValue('person.givenName')"></h4>
|
||||
<h4 class="card-title"
|
||||
[innerHTML]="firstMetadataValue('person.familyName') + ', ' + firstMetadataValue('person.givenName')"></h4>
|
||||
</ds-truncatable-part>
|
||||
<p *ngIf="dso.hasMetadata('person.email')" class="item-email card-text text-muted">
|
||||
<ds-truncatable-part [id]="dso.id" [minLines]="1">
|
||||
@@ -30,10 +33,11 @@
|
||||
</ds-truncatable-part>
|
||||
</p>
|
||||
<div *ngIf="linkType != linkTypes.None" class="text-center">
|
||||
<a [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]"
|
||||
<a [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'"
|
||||
rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]"
|
||||
class="lead btn btn-primary viewButton">View</a>
|
||||
</div>
|
||||
</div>
|
||||
</ds-truncatable>
|
||||
<ng-content></ng-content>
|
||||
</div>
|
||||
</ds-truncatable>
|
||||
</div>
|
||||
|
@@ -1,7 +1,9 @@
|
||||
<ds-truncatable [id]="dso.id">
|
||||
<div class="card" [@focusShadow]="(isCollapsed$ | async)?'blur':'focus'">
|
||||
<div class="card" [@focusShadow]="(isCollapsed$ | async)?'blur':'focus'">
|
||||
<ds-truncatable [id]="dso.id">
|
||||
<ng-content></ng-content>
|
||||
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]"
|
||||
<a *ngIf="linkType != linkTypes.None"
|
||||
[target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'"
|
||||
rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]"
|
||||
class="card-img-top full-width">
|
||||
<div>
|
||||
<ds-grid-thumbnail [thumbnail]="getThumbnail() | async">
|
||||
@@ -25,10 +27,11 @@
|
||||
</ds-truncatable-part>
|
||||
</p>
|
||||
<div *ngIf="linkType != linkTypes.None" class="text-center">
|
||||
<a [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]"
|
||||
<a [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'"
|
||||
rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]"
|
||||
class="lead btn btn-primary viewButton">View</a>
|
||||
</div>
|
||||
</div>
|
||||
</ds-truncatable>
|
||||
<ng-content></ng-content>
|
||||
</div>
|
||||
</ds-truncatable>
|
||||
</div>
|
||||
|
19
src/app/shared/mocks/mock-trucatable.service.ts
Normal file
19
src/app/shared/mocks/mock-trucatable.service.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { of as observableOf } from 'rxjs/internal/observable/of';
|
||||
|
||||
export const mockTruncatableService: any = {
|
||||
/* tslint:disable:no-empty */
|
||||
isCollapsed: (id: string) => {
|
||||
if (id === '1') {
|
||||
return observableOf(true)
|
||||
} else {
|
||||
return observableOf(false);
|
||||
}
|
||||
},
|
||||
expand: (id: string) => {
|
||||
},
|
||||
collapse: (id: string) => {
|
||||
},
|
||||
toggle: (id: string) => {
|
||||
}
|
||||
/* tslint:enable:no-empty */
|
||||
};
|
@@ -2,10 +2,12 @@
|
||||
[index]="index"
|
||||
[linkType]="linkType"
|
||||
[listID]="listID">
|
||||
<div class="card-footer text-center">
|
||||
<a class="btn btn-light btn-sm btn-auto my-1" [routerLink]="[getEditPath()]">
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item text-center">
|
||||
<a class="btn btn-light btn-sm btn-auto my-1 edit-link" [routerLink]="[editPath]">
|
||||
<i class="fa fa-edit"></i>
|
||||
</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</ds-collection-search-result-grid-element>
|
||||
|
||||
|
@@ -1,6 +1,10 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { BitstreamDataService } from '../../../../core/data/bitstream-data.service';
|
||||
import { mockTruncatableService } from '../../../mocks/mock-trucatable.service';
|
||||
import { SharedModule } from '../../../shared.module';
|
||||
import { CollectionAdminSearchResultGridElementComponent } from './collection-admin-search-result-grid-element.component';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { TruncatableService } from '../../../truncatable/truncatable.service';
|
||||
@@ -12,7 +16,7 @@ import { By } from '@angular/platform-browser';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { getCollectionEditPath } from '../../../../+collection-page/collection-page-routing.module';
|
||||
|
||||
describe('CollectionAdminSearchResultListElementComponent', () => {
|
||||
describe('CollectionAdminSearchResultGridElementComponent', () => {
|
||||
let component: CollectionAdminSearchResultGridElementComponent;
|
||||
let fixture: ComponentFixture<CollectionAdminSearchResultGridElementComponent>;
|
||||
let id;
|
||||
@@ -28,12 +32,15 @@ describe('CollectionAdminSearchResultListElementComponent', () => {
|
||||
init();
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
NoopAnimationsModule,
|
||||
TranslateModule.forRoot(),
|
||||
RouterTestingModule.withRoutes([])
|
||||
RouterTestingModule.withRoutes([]),
|
||||
SharedModule
|
||||
],
|
||||
declarations: [CollectionAdminSearchResultGridElementComponent],
|
||||
providers: [{ provide: TruncatableService, useValue: {} }],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
providers: [
|
||||
{ provide: TruncatableService, useValue: mockTruncatableService },
|
||||
{ provide: BitstreamDataService, useValue: {} },
|
||||
]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
@@ -53,7 +60,7 @@ describe('CollectionAdminSearchResultListElementComponent', () => {
|
||||
});
|
||||
|
||||
it('should render an edit button with the correct link', () => {
|
||||
const a = fixture.debugElement.query(By.css('a'));
|
||||
const a = fixture.debugElement.query(By.css('a.edit-link'));
|
||||
const link = a.nativeElement.href;
|
||||
expect(link).toContain(getCollectionEditPath(id));
|
||||
})
|
||||
|
@@ -17,11 +17,10 @@ import { SearchResultGridElementComponent } from '../../search-result-grid-eleme
|
||||
* The component for displaying a list element for a collection search result on the admin search page
|
||||
*/
|
||||
export class CollectionAdminSearchResultGridElementComponent extends SearchResultGridElementComponent<CollectionSearchResult, Collection> {
|
||||
editPath: string;
|
||||
|
||||
/**
|
||||
* Returns the path to the edit page of this collection
|
||||
*/
|
||||
getEditPath(): string {
|
||||
return getCollectionEditPath(this.dso.uuid)
|
||||
ngOnInit() {
|
||||
super.ngOnInit();
|
||||
this.editPath = getCollectionEditPath(this.dso.uuid);
|
||||
}
|
||||
}
|
||||
|
@@ -2,10 +2,12 @@
|
||||
[index]="index"
|
||||
[linkType]="linkType"
|
||||
[listID]="listID">
|
||||
<div class="card-footer text-center">
|
||||
<a class="btn btn-light btn-sm btn-auto my-1" [routerLink]="[getEditPath()]">
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item text-center">
|
||||
<a class="btn btn-light btn-sm btn-auto my-1 edit-link" [routerLink]="[editPath]">
|
||||
<i class="fa fa-edit"></i>
|
||||
</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</ds-community-search-result-grid-element>
|
||||
|
||||
|
@@ -1,7 +1,11 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { BitstreamDataService } from '../../../../core/data/bitstream-data.service';
|
||||
import { mockTruncatableService } from '../../../mocks/mock-trucatable.service';
|
||||
import { SharedModule } from '../../../shared.module';
|
||||
import { TruncatableService } from '../../../truncatable/truncatable.service';
|
||||
import { CollectionElementLinkType } from '../../../object-collection/collection-element-link.type';
|
||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||
@@ -12,7 +16,7 @@ import { CommunityAdminSearchResultGridElementComponent } from './community-admi
|
||||
import { CommunitySearchResult } from '../../../object-collection/shared/community-search-result.model';
|
||||
import { getCommunityEditPath } from '../../../../+community-page/community-page-routing.module';
|
||||
|
||||
describe('CommunityAdminSearchResultListElementComponent', () => {
|
||||
describe('CommunityAdminSearchResultGridElementComponent', () => {
|
||||
let component: CommunityAdminSearchResultGridElementComponent;
|
||||
let fixture: ComponentFixture<CommunityAdminSearchResultGridElementComponent>;
|
||||
let id;
|
||||
@@ -28,11 +32,15 @@ describe('CommunityAdminSearchResultListElementComponent', () => {
|
||||
init();
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
NoopAnimationsModule,
|
||||
TranslateModule.forRoot(),
|
||||
RouterTestingModule.withRoutes([])
|
||||
RouterTestingModule.withRoutes([]),
|
||||
SharedModule
|
||||
],
|
||||
providers: [
|
||||
{ provide: TruncatableService, useValue: mockTruncatableService },
|
||||
{ provide: BitstreamDataService, useValue: {} },
|
||||
],
|
||||
declarations: [CommunityAdminSearchResultGridElementComponent],
|
||||
providers: [{ provide: TruncatableService, useValue: {} }],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
})
|
||||
.compileComponents();
|
||||
@@ -53,7 +61,7 @@ describe('CommunityAdminSearchResultListElementComponent', () => {
|
||||
});
|
||||
|
||||
it('should render an edit button with the correct link', () => {
|
||||
const a = fixture.debugElement.query(By.css('a'));
|
||||
const a = fixture.debugElement.query(By.css('a.edit-link'));
|
||||
const link = a.nativeElement.href;
|
||||
expect(link).toContain(getCommunityEditPath(id));
|
||||
})
|
||||
|
@@ -17,11 +17,10 @@ import { SearchResultGridElementComponent } from '../../search-result-grid-eleme
|
||||
* The component for displaying a list element for a community search result on the admin search page
|
||||
*/
|
||||
export class CommunityAdminSearchResultGridElementComponent extends SearchResultGridElementComponent<CommunitySearchResult, Community> {
|
||||
editPath: string;
|
||||
|
||||
/**
|
||||
* Returns the path to the edit page of this community
|
||||
*/
|
||||
getEditPath(): string {
|
||||
return getCommunityEditPath(this.dso.uuid)
|
||||
ngOnInit() {
|
||||
super.ngOnInit();
|
||||
this.editPath = getCommunityEditPath(this.dso.uuid);
|
||||
}
|
||||
}
|
||||
|
@@ -8,17 +8,18 @@
|
||||
<span class="badge badge-warning">{{ "admin.search.item.withdrawn" | translate }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div #buttons class="card-footer d-flex justify-content-between">
|
||||
<ul #buttons class="list-group list-group-flush">
|
||||
<li class="list-group-item d-flex justify-content-between">
|
||||
<a class="btn btn-light btn-sm my-1 edit-link" [routerLink]="[getEditPath()]" [title]="'admin.search.item.edit' | translate">
|
||||
<i class="fa fa-edit"></i>
|
||||
</a>
|
||||
|
||||
<a *ngIf="dso && !dso.isWithdrawn" class="btn btn-light btn-sm my-1 withdraw-link" [routerLink]="[getWithdrawPath()]" [title]="'admin.search.item.withdraw' | translate">
|
||||
<i class="fa fa-box"></i>
|
||||
<i class="fa fa-ban"></i>
|
||||
</a>
|
||||
|
||||
<a *ngIf="dso && dso.isWithdrawn" class="btn btn-light btn-sm my-1 reinstate-link" [routerLink]="[getReinstatePath()]" [title]="'admin.search.item.reinstate' | translate">
|
||||
<i class="fa fa-box-open"></i>
|
||||
<i class="fa fa-undo"></i>
|
||||
</a>
|
||||
|
||||
<a *ngIf="dso && dso.isDiscoverable" class="btn btn-light btn-sm my-1 private-link" [routerLink]="[getPrivatePath()]" [title]="'admin.search.item.make-private' | translate">
|
||||
@@ -36,4 +37,5 @@
|
||||
<a class="btn btn-light btn-sm my-1 move-link" [routerLink]="[getMovePath()]" [title]="'admin.search.item.move' | translate">
|
||||
<i class="fa fa-arrow-circle-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
@@ -1,7 +1,16 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
import { BitstreamDataService } from '../../../../core/data/bitstream-data.service';
|
||||
import { RemoteData } from '../../../../core/data/remote-data';
|
||||
import { Bitstream } from '../../../../core/shared/bitstream.model';
|
||||
import { Item } from '../../../../core/shared/item.model';
|
||||
import { mockTruncatableService } from '../../../mocks/mock-trucatable.service';
|
||||
import { SharedModule } from '../../../shared.module';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../../../testing/utils';
|
||||
import { TruncatableService } from '../../../truncatable/truncatable.service';
|
||||
import { CollectionElementLinkType } from '../../../object-collection/collection-element-link.type';
|
||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||
@@ -20,6 +29,12 @@ describe('ItemAdminSearchResultListElementComponent', () => {
|
||||
let id;
|
||||
let searchResult;
|
||||
|
||||
const mockBitstreamDataService = {
|
||||
getThumbnailFor(item: Item): Observable<RemoteData<Bitstream>> {
|
||||
return createSuccessfulRemoteDataObject$(new Bitstream());
|
||||
}
|
||||
};
|
||||
|
||||
function init() {
|
||||
id = '780b2588-bda5-4112-a1cd-0b15000a5339';
|
||||
searchResult = new ItemSearchResult();
|
||||
@@ -30,11 +45,15 @@ describe('ItemAdminSearchResultListElementComponent', () => {
|
||||
init();
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
NoopAnimationsModule,
|
||||
TranslateModule.forRoot(),
|
||||
RouterTestingModule.withRoutes([])
|
||||
RouterTestingModule.withRoutes([]),
|
||||
SharedModule
|
||||
],
|
||||
providers: [
|
||||
{ provide: TruncatableService, useValue: mockTruncatableService },
|
||||
{ provide: BitstreamDataService, useValue: mockBitstreamDataService },
|
||||
],
|
||||
declarations: [ItemAdminSearchResultGridElementComponent],
|
||||
providers: [{ provide: TruncatableService, useValue: {} }],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
})
|
||||
.compileComponents();
|
||||
|
@@ -6,6 +6,7 @@ import { Store } from '@ngrx/store';
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import { RemoteDataBuildService } from '../../../../core/cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../../../../core/cache/object-cache.service';
|
||||
import { BitstreamDataService } from '../../../../core/data/bitstream-data.service';
|
||||
import { CommunityDataService } from '../../../../core/data/community-data.service';
|
||||
import { DefaultChangeAnalyzer } from '../../../../core/data/default-change-analyzer.service';
|
||||
import { DSOChangeAnalyzer } from '../../../../core/data/dso-change-analyzer.service';
|
||||
@@ -62,6 +63,7 @@ describe('CollectionSearchResultGridElementComponent', () => {
|
||||
{ provide: UUIDService, useValue: {} },
|
||||
{ provide: Store, useValue: {} },
|
||||
{ provide: RemoteDataBuildService, useValue: {} },
|
||||
{ provide: BitstreamDataService, useValue: {} },
|
||||
{ provide: CommunityDataService, useValue: {} },
|
||||
{ provide: HALEndpointService, useValue: {} },
|
||||
{ provide: NotificationsService, useValue: {} },
|
||||
|
@@ -6,6 +6,7 @@ import { Store } from '@ngrx/store';
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import { RemoteDataBuildService } from '../../../../core/cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../../../../core/cache/object-cache.service';
|
||||
import { BitstreamDataService } from '../../../../core/data/bitstream-data.service';
|
||||
import { CommunityDataService } from '../../../../core/data/community-data.service';
|
||||
import { DefaultChangeAnalyzer } from '../../../../core/data/default-change-analyzer.service';
|
||||
import { DSOChangeAnalyzer } from '../../../../core/data/dso-change-analyzer.service';
|
||||
@@ -62,6 +63,7 @@ describe('CommunitySearchResultGridElementComponent', () => {
|
||||
{ provide: UUIDService, useValue: {} },
|
||||
{ provide: Store, useValue: {} },
|
||||
{ provide: RemoteDataBuildService, useValue: {} },
|
||||
{ provide: BitstreamDataService, useValue: {} },
|
||||
{ provide: CommunityDataService, useValue: {} },
|
||||
{ provide: HALEndpointService, useValue: {} },
|
||||
{ provide: NotificationsService, useValue: {} },
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<ds-truncatable [id]="dso.id">
|
||||
<div class="card" [@focusShadow]="(isCollapsed$ | async)?'blur':'focus'">
|
||||
<ds-truncatable [id]="dso.id">
|
||||
<ng-content></ng-content>
|
||||
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]"
|
||||
class="card-img-top full-width">
|
||||
@@ -38,6 +38,7 @@
|
||||
class="lead btn btn-primary viewButton">View</a>
|
||||
</div>
|
||||
</div>
|
||||
</ds-truncatable>
|
||||
<ng-content></ng-content>
|
||||
</div>
|
||||
</ds-truncatable>
|
||||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
[linkType]="linkType"
|
||||
[listID]="listID"></ds-collection-search-result-list-element>
|
||||
<div>
|
||||
<a class="btn btn-light mt-1" [routerLink]="[getEditPath()]">
|
||||
<a class="btn btn-light mt-1" [routerLink]="[editPath]">
|
||||
<i class="fa fa-edit"></i> {{"admin.search.collection.edit" | translate}}
|
||||
</a>
|
||||
</div>
|
||||
|
@@ -17,11 +17,10 @@ import { getCollectionEditPath } from '../../../../+collection-page/collection-p
|
||||
* The component for displaying a list element for a collection search result on the admin search page
|
||||
*/
|
||||
export class CollectionAdminSearchResultListElementComponent extends SearchResultListElementComponent<CollectionSearchResult, Collection> {
|
||||
editPath: string;
|
||||
|
||||
/**
|
||||
* Returns the path to the edit page of this collection
|
||||
*/
|
||||
getEditPath(): string {
|
||||
return getCollectionEditPath(this.dso.uuid)
|
||||
ngOnInit() {
|
||||
super.ngOnInit();
|
||||
this.editPath = getCollectionEditPath(this.dso.uuid);
|
||||
}
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@
|
||||
[linkType]="linkType"
|
||||
[listID]="listID"></ds-community-search-result-list-element>
|
||||
<div>
|
||||
<a class="btn btn-light mt-1" [routerLink]="[getEditPath()]">
|
||||
<a class="btn btn-light mt-1" [routerLink]="[editPath]">
|
||||
<i class="fa fa-edit"></i> {{"admin.search.community.edit" | translate}}
|
||||
</a>
|
||||
</div>
|
||||
|
@@ -17,11 +17,10 @@ import { getCommunityEditPath } from '../../../../+community-page/community-page
|
||||
* The component for displaying a list element for a community search result on the admin search page
|
||||
*/
|
||||
export class CommunityAdminSearchResultListElementComponent extends SearchResultListElementComponent<CommunitySearchResult, Community> {
|
||||
editPath: string;
|
||||
|
||||
/**
|
||||
* Returns the path to the edit page of this community
|
||||
*/
|
||||
getEditPath(): string {
|
||||
return getCommunityEditPath(this.dso.uuid)
|
||||
ngOnInit() {
|
||||
super.ngOnInit();
|
||||
this.editPath = getCommunityEditPath(this.dso.uuid);
|
||||
}
|
||||
}
|
||||
|
@@ -15,11 +15,11 @@
|
||||
</a>
|
||||
|
||||
<a *ngIf="dso && !dso.isWithdrawn" class="btn btn-light my-1 withdraw-link" [routerLink]="[getWithdrawPath()]" [title]="'admin.search.item.withdraw' | translate">
|
||||
<i class="fa fa-box"></i><span class="d-none d-sm-inline"> {{"admin.search.item.withdraw" | translate}}</span>
|
||||
<i class="fa fa-ban"></i><span class="d-none d-sm-inline"> {{"admin.search.item.withdraw" | translate}}</span>
|
||||
</a>
|
||||
|
||||
<a *ngIf="dso && dso.isWithdrawn" class="btn btn-light my-1 reinstate-link" [routerLink]="[getReinstatePath()]" [title]="'admin.search.item.reinstate' | translate">
|
||||
<i class="fa fa-box-open"></i><span class="d-none d-sm-inline"> {{"admin.search.item.reinstate" | translate}}</span>
|
||||
<i class="fa fa-undo"></i><span class="d-none d-sm-inline"> {{"admin.search.item.reinstate" | translate}}</span>
|
||||
</a>
|
||||
|
||||
<a *ngIf="dso && dso.isDiscoverable" class="btn btn-light my-1 private-link" [routerLink]="[getPrivatePath()]" [title]="'admin.search.item.make-private' | translate">
|
||||
|
@@ -27,9 +27,9 @@ describe('PaginatedSearchOptions', () => {
|
||||
'query=search query&' +
|
||||
'scope=0fde1ecb-82cc-425a-b600-ac3576d76b47&' +
|
||||
'dsoType=ITEM&' +
|
||||
'f.test=value,query&' +
|
||||
'f.example=another value,query&' +
|
||||
'f.example=second value,query'
|
||||
'f.test=value&' +
|
||||
'f.example=another value&' +
|
||||
'f.example=second value'
|
||||
);
|
||||
});
|
||||
|
||||
|
@@ -21,9 +21,9 @@ describe('SearchOptions', () => {
|
||||
'query=search query&' +
|
||||
'scope=0fde1ecb-82cc-425a-b600-ac3576d76b47&' +
|
||||
'dsoType=ITEM&' +
|
||||
'f.test=value,query&' +
|
||||
'f.example=another value,query&' +
|
||||
'f.example=second value,query'
|
||||
'f.test=value&' +
|
||||
'f.example=another value&' +
|
||||
'f.example=second value'
|
||||
);
|
||||
});
|
||||
|
||||
|
@@ -1,5 +1,6 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import { mockTruncatableService } from '../mocks/mock-trucatable.service';
|
||||
import { TruncatableComponent } from './truncatable.component';
|
||||
import { TruncatableService } from './truncatable.service';
|
||||
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
@@ -10,29 +11,12 @@ describe('TruncatableComponent', () => {
|
||||
let fixture: ComponentFixture<TruncatableComponent>;
|
||||
const identifier = '1234567890';
|
||||
let truncatableService;
|
||||
const truncatableServiceStub: any = {
|
||||
/* tslint:disable:no-empty */
|
||||
isCollapsed: (id: string) => {
|
||||
if (id === '1') {
|
||||
return observableOf(true)
|
||||
} else {
|
||||
return observableOf(false);
|
||||
}
|
||||
},
|
||||
expand: (id: string) => {
|
||||
},
|
||||
collapse: (id: string) => {
|
||||
},
|
||||
toggle: (id: string) => {
|
||||
}
|
||||
/* tslint:enable:no-empty */
|
||||
};
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [NoopAnimationsModule],
|
||||
declarations: [TruncatableComponent],
|
||||
providers: [
|
||||
{ provide: TruncatableService, useValue: truncatableServiceStub },
|
||||
{ provide: TruncatableService, useValue: mockTruncatableService },
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(TruncatableComponent, {
|
||||
|
Reference in New Issue
Block a user