small UI tweaks, fix tests

This commit is contained in:
Art Lowel
2020-03-10 18:38:04 +01:00
parent 401393c8bd
commit 2922deff50
27 changed files with 391 additions and 323 deletions

View File

@@ -1,3 +1,4 @@
import { switchMap } from 'rxjs/operators';
import { HostWindowService } from '../shared/host-window.service'; import { HostWindowService } from '../shared/host-window.service';
import { SidebarService } from '../shared/sidebar/sidebar.service'; import { SidebarService } from '../shared/sidebar/sidebar.service';
import { SearchComponent } from './search.component'; import { SearchComponent } from './search.component';

View File

@@ -1,39 +1,43 @@
<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> <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"
class="card-img-top full-width"> [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'"
<div> rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]"
<ds-grid-thumbnail [thumbnail]="getThumbnail() | async"> class="card-img-top full-width">
</ds-grid-thumbnail> <div>
</div> <ds-grid-thumbnail [thumbnail]="getThumbnail() | async">
</a> </ds-grid-thumbnail>
<span *ngIf="linkType == linkTypes.None" class="card-img-top full-width"> </div>
</a>
<span *ngIf="linkType == linkTypes.None" class="card-img-top full-width">
<div> <div>
<ds-grid-thumbnail [thumbnail]="getThumbnail() | async"> <ds-grid-thumbnail [thumbnail]="getThumbnail() | async">
</ds-grid-thumbnail> </ds-grid-thumbnail>
</div> </div>
</span> </span>
<div class="card-body"> <div class="card-body">
<ds-item-type-badge [object]="dso"></ds-item-type-badge> <ds-item-type-badge [object]="dso"></ds-item-type-badge>
<ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4"> <ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4">
<h4 class="card-title" [innerHTML]="firstMetadataValue('dc.title')"></h4> <h4 class="card-title" [innerHTML]="firstMetadataValue('dc.title')"></h4>
</ds-truncatable-part> </ds-truncatable-part>
<p *ngIf="dso.hasMetadata('creativework.datePublished')" class="item-date card-text text-muted"> <p *ngIf="dso.hasMetadata('creativework.datePublished')"
<ds-truncatable-part [id]="dso.id" [minLines]="1"> class="item-date card-text text-muted">
<span [innerHTML]="firstMetadataValue('creativework.datePublished')"></span> <ds-truncatable-part [id]="dso.id" [minLines]="1">
</ds-truncatable-part> <span [innerHTML]="firstMetadataValue('creativework.datePublished')"></span>
</p> </ds-truncatable-part>
<p *ngIf="dso.hasMetadata('journal.title')" class="item-journal-title card-text"> </p>
<ds-truncatable-part [id]="dso.id" [minLines]="3"> <p *ngIf="dso.hasMetadata('journal.title')" class="item-journal-title card-text">
<span [innerHTML]="firstMetadataValue('journal.title')"></span> <ds-truncatable-part [id]="dso.id" [minLines]="3">
</ds-truncatable-part> <span [innerHTML]="firstMetadataValue('journal.title')"></span>
</p> </ds-truncatable-part>
<div *ngIf="linkType != linkTypes.None" class="text-center"> </p>
<a [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]" <div *ngIf="linkType != linkTypes.None" class="text-center">
class="lead btn btn-primary viewButton">View</a> <a [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'"
</div> rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]"
</div> class="lead btn btn-primary viewButton">View</a>
<ng-content></ng-content> </div>
</div> </div>
</ds-truncatable> </ds-truncatable>
<ng-content></ng-content>
</div>

View File

@@ -1,39 +1,43 @@
<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> <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"
class="card-img-top full-width"> [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'"
<div> rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]"
<ds-grid-thumbnail [thumbnail]="getThumbnail() | async"> class="card-img-top full-width">
</ds-grid-thumbnail> <div>
</div> <ds-grid-thumbnail [thumbnail]="getThumbnail() | async">
</a> </ds-grid-thumbnail>
<span *ngIf="linkType == linkTypes.None" class="card-img-top full-width"> </div>
</a>
<span *ngIf="linkType == linkTypes.None" class="card-img-top full-width">
<div> <div>
<ds-grid-thumbnail [thumbnail]="getThumbnail() | async"> <ds-grid-thumbnail [thumbnail]="getThumbnail() | async">
</ds-grid-thumbnail> </ds-grid-thumbnail>
</div> </div>
</span> </span>
<div class="card-body"> <div class="card-body">
<ds-item-type-badge [object]="dso"></ds-item-type-badge> <ds-item-type-badge [object]="dso"></ds-item-type-badge>
<ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4"> <ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4">
<h4 class="card-title" [innerHTML]="dso.firstMetadataValue('dc.title')"></h4> <h4 class="card-title" [innerHTML]="dso.firstMetadataValue('dc.title')"></h4>
</ds-truncatable-part> </ds-truncatable-part>
<p *ngIf="dso.hasMetadata('creativework.datePublished')" class="item-date card-text text-muted"> <p *ngIf="dso.hasMetadata('creativework.datePublished')"
<ds-truncatable-part [id]="dso.id" [minLines]="1"> class="item-date card-text text-muted">
<span [innerHTML]="firstMetadataValue('creativework.datePublished')"></span> <ds-truncatable-part [id]="dso.id" [minLines]="1">
</ds-truncatable-part> <span [innerHTML]="firstMetadataValue('creativework.datePublished')"></span>
</p> </ds-truncatable-part>
<p *ngIf="dso.hasMetadata('dc.description')" class="item-description card-text"> </p>
<ds-truncatable-part [id]="dso.id" [minLines]="3"> <p *ngIf="dso.hasMetadata('dc.description')" class="item-description card-text">
<span [innerHTML]="firstMetadataValue('dc.description')"></span> <ds-truncatable-part [id]="dso.id" [minLines]="3">
</ds-truncatable-part> <span [innerHTML]="firstMetadataValue('dc.description')"></span>
</p> </ds-truncatable-part>
<div *ngIf="linkType != linkTypes.None" class="text-center"> </p>
<a [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]" <div *ngIf="linkType != linkTypes.None" class="text-center">
class="lead btn btn-primary viewButton">View</a> <a [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'"
</div> rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]"
</div> class="lead btn btn-primary viewButton">View</a>
<ng-content></ng-content> </div>
</div> </div>
</ds-truncatable> </ds-truncatable>
<ng-content></ng-content>
</div>

View File

@@ -1,44 +1,47 @@
<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> <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"
class="card-img-top full-width"> [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'"
<div> rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]"
<ds-grid-thumbnail [thumbnail]="getThumbnail() | async"> class="card-img-top full-width">
</ds-grid-thumbnail> <div>
</div> <ds-grid-thumbnail [thumbnail]="getThumbnail() | async">
</a> </ds-grid-thumbnail>
<span *ngIf="linkType == linkTypes.None" class="card-img-top full-width"> </div>
</a>
<span *ngIf="linkType == linkTypes.None" class="card-img-top full-width">
<div> <div>
<ds-grid-thumbnail [thumbnail]="getThumbnail() | async"> <ds-grid-thumbnail [thumbnail]="getThumbnail() | async">
</ds-grid-thumbnail> </ds-grid-thumbnail>
</div> </div>
</span> </span>
<div class="card-body"> <div class="card-body">
<ds-item-type-badge [object]="dso"></ds-item-type-badge> <ds-item-type-badge [object]="dso"></ds-item-type-badge>
<ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4"> <ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4">
<h4 class="card-title" [innerHTML]="firstMetadataValue('dc.title')"></h4> <h4 class="card-title" [innerHTML]="firstMetadataValue('dc.title')"></h4>
</ds-truncatable-part> </ds-truncatable-part>
<p *ngIf="dso.hasMetadata('creativework.editor')" <p *ngIf="dso.hasMetadata('creativework.editor')"
class="item-publisher card-text text-muted"> class="item-publisher card-text text-muted">
<ds-truncatable-part [id]="dso.id" [minLines]="1"> <ds-truncatable-part [id]="dso.id" [minLines]="1">
<span class="item-editor">{{firstMetadataValue('creativework.editor')}}</span> <span class="item-editor">{{firstMetadataValue('creativework.editor')}}</span>
<span *ngIf="dso.hasMetadata('creativework.publisher')" class="item-publisher"> <span *ngIf="dso.hasMetadata('creativework.publisher')" class="item-publisher">
<span>, </span> <span>, </span>
{{firstMetadataValue('creativework.publisher')}} {{firstMetadataValue('creativework.publisher')}}
</span> </span>
</ds-truncatable-part> </ds-truncatable-part>
</p> </p>
<p *ngIf="dso.hasMetadata('dc.description')" class="item-description card-text"> <p *ngIf="dso.hasMetadata('dc.description')" class="item-description card-text">
<ds-truncatable-part [id]="dso.id" [minLines]="3"> <ds-truncatable-part [id]="dso.id" [minLines]="3">
<span [innerHTML]="firstMetadataValue('dc.description')"></span> <span [innerHTML]="firstMetadataValue('dc.description')"></span>
</ds-truncatable-part> </ds-truncatable-part>
</p> </p>
<div *ngIf="linkType != linkTypes.None" class="text-center"> <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'"
class="lead btn btn-primary viewButton">View</a> rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]"
</div> class="lead btn btn-primary viewButton">View</a>
</div> </div>
<ng-content></ng-content>
</div> </div>
</ds-truncatable> </ds-truncatable>
<ng-content></ng-content>
</div>

View File

@@ -1,44 +1,49 @@
<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> <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"
class="card-img-top full-width"> [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'"
<div> rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]"
<ds-grid-thumbnail [thumbnail]="getThumbnail() | async"> class="card-img-top full-width">
</ds-grid-thumbnail> <div>
</div> <ds-grid-thumbnail [thumbnail]="getThumbnail() | async">
</a> </ds-grid-thumbnail>
<span *ngIf="linkType == linkTypes.None" class="card-img-top full-width"> </div>
</a>
<span *ngIf="linkType == linkTypes.None" class="card-img-top full-width">
<div> <div>
<ds-grid-thumbnail [thumbnail]="getThumbnail() | async"> <ds-grid-thumbnail [thumbnail]="getThumbnail() | async">
</ds-grid-thumbnail> </ds-grid-thumbnail>
</div> </div>
</span> </span>
<div class="card-body"> <div class="card-body">
<ds-item-type-badge [object]="dso"></ds-item-type-badge> <ds-item-type-badge [object]="dso"></ds-item-type-badge>
<ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4"> <ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4">
<h4 class="card-title" [innerHTML]="firstMetadataValue('organization.legalName')"></h4> <h4 class="card-title" [innerHTML]="firstMetadataValue('organization.legalName')"></h4>
</ds-truncatable-part> </ds-truncatable-part>
<p *ngIf="dso.hasMetadata('organization.foundingDate')" class="item-date card-text text-muted"> <p *ngIf="dso.hasMetadata('organization.foundingDate')"
<ds-truncatable-part [id]="dso.id" [minLines]="1"> class="item-date card-text text-muted">
<span [innerHTML]="firstMetadataValue('organization.foundingDate')"></span> <ds-truncatable-part [id]="dso.id" [minLines]="1">
</ds-truncatable-part> <span [innerHTML]="firstMetadataValue('organization.foundingDate')"></span>
</p> </ds-truncatable-part>
<p *ngIf="dso.hasMetadata('organization.address.addressCountry')" </p>
class="item-location card-text"> <p *ngIf="dso.hasMetadata('organization.address.addressCountry')"
<ds-truncatable-part [id]="dso.id" [minLines]="3"> class="item-location card-text">
<span class="item-country">{{firstMetadataValue('organization.address.addressCountry')}}</span> <ds-truncatable-part [id]="dso.id" [minLines]="3">
<span *ngIf="dso.hasMetadata('organization.address.addressLocality')" class="item-city"> <span
class="item-country">{{firstMetadataValue('organization.address.addressCountry')}}</span>
<span *ngIf="dso.hasMetadata('organization.address.addressLocality')" class="item-city">
<span>, </span> <span>, </span>
{{firstMetadataValue('organization.address.addressLocality')}} {{firstMetadataValue('organization.address.addressLocality')}}
</span> </span>
</ds-truncatable-part> </ds-truncatable-part>
</p> </p>
<div *ngIf="linkType != linkTypes.None" class="text-center"> <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'"
class="lead btn btn-primary viewButton">View</a> rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]"
</div> class="lead btn btn-primary viewButton">View</a>
</div> </div>
<ng-content></ng-content>
</div> </div>
</ds-truncatable> </ds-truncatable>
<ng-content></ng-content>
</div>

View File

@@ -1,39 +1,43 @@
<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> <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"
class="card-img-top full-width"> [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'"
<div> rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]"
<ds-grid-thumbnail [thumbnail]="getThumbnail() | async"> class="card-img-top full-width">
</ds-grid-thumbnail> <div>
</div> <ds-grid-thumbnail [thumbnail]="getThumbnail() | async">
</a> </ds-grid-thumbnail>
<span *ngIf="linkType == linkTypes.None" class="card-img-top full-width"> </div>
</a>
<span *ngIf="linkType == linkTypes.None" class="card-img-top full-width">
<div> <div>
<ds-grid-thumbnail [thumbnail]="getThumbnail() | async"> <ds-grid-thumbnail [thumbnail]="getThumbnail() | async">
</ds-grid-thumbnail> </ds-grid-thumbnail>
</div> </div>
</span> </span>
<div class="card-body"> <div class="card-body">
<ds-item-type-badge [object]="dso"></ds-item-type-badge> <ds-item-type-badge [object]="dso"></ds-item-type-badge>
<ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4"> <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"
</ds-truncatable-part> [innerHTML]="firstMetadataValue('person.familyName') + ', ' + firstMetadataValue('person.givenName')"></h4>
<p *ngIf="dso.hasMetadata('person.email')" class="item-email card-text text-muted"> </ds-truncatable-part>
<ds-truncatable-part [id]="dso.id" [minLines]="1"> <p *ngIf="dso.hasMetadata('person.email')" class="item-email card-text text-muted">
<span [innerHTML]="firstMetadataValue('person.email')"></span> <ds-truncatable-part [id]="dso.id" [minLines]="1">
</ds-truncatable-part> <span [innerHTML]="firstMetadataValue('person.email')"></span>
</p> </ds-truncatable-part>
<p *ngIf="dso.hasMetadata('person.jobTitle')" class="item-jobtitle card-text"> </p>
<ds-truncatable-part [id]="dso.id" [minLines]="3"> <p *ngIf="dso.hasMetadata('person.jobTitle')" class="item-jobtitle card-text">
<span [innerHTML]="firstMetadataValue('person.jobTitle')"></span> <ds-truncatable-part [id]="dso.id" [minLines]="3">
</ds-truncatable-part> <span [innerHTML]="firstMetadataValue('person.jobTitle')"></span>
</p> </ds-truncatable-part>
<div *ngIf="linkType != linkTypes.None" class="text-center"> </p>
<a [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]" <div *ngIf="linkType != linkTypes.None" class="text-center">
class="lead btn btn-primary viewButton">View</a> <a [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'"
</div> rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]"
</div> class="lead btn btn-primary viewButton">View</a>
<ng-content></ng-content> </div>
</div> </div>
</ds-truncatable> </ds-truncatable>
<ng-content></ng-content>
</div>

View File

@@ -1,34 +1,37 @@
<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> <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"
class="card-img-top full-width"> [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'"
<div> rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]"
<ds-grid-thumbnail [thumbnail]="getThumbnail() | async"> class="card-img-top full-width">
</ds-grid-thumbnail> <div>
</div> <ds-grid-thumbnail [thumbnail]="getThumbnail() | async">
</a> </ds-grid-thumbnail>
<span *ngIf="linkType == linkTypes.None" class="card-img-top full-width"> </div>
</a>
<span *ngIf="linkType == linkTypes.None" class="card-img-top full-width">
<div> <div>
<ds-grid-thumbnail [thumbnail]="getThumbnail() | async"> <ds-grid-thumbnail [thumbnail]="getThumbnail() | async">
</ds-grid-thumbnail> </ds-grid-thumbnail>
</div> </div>
</span> </span>
<div class="card-body"> <div class="card-body">
<ds-item-type-badge [object]="dso"></ds-item-type-badge> <ds-item-type-badge [object]="dso"></ds-item-type-badge>
<ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4"> <ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4">
<h4 class="card-title" [innerHTML]="firstMetadataValue('dc.title')"></h4> <h4 class="card-title" [innerHTML]="firstMetadataValue('dc.title')"></h4>
</ds-truncatable-part> </ds-truncatable-part>
<p *ngIf="dso.hasMetadata('dc.description')" class="item-description card-text text-muted"> <p *ngIf="dso.hasMetadata('dc.description')" class="item-description card-text text-muted">
<ds-truncatable-part [id]="dso.id" [minLines]="3"> <ds-truncatable-part [id]="dso.id" [minLines]="3">
<span [innerHTML]="firstMetadataValue('dc.description')"></span> <span [innerHTML]="firstMetadataValue('dc.description')"></span>
</ds-truncatable-part> </ds-truncatable-part>
</p> </p>
<div *ngIf="linkType != linkTypes.None" class="text-center"> <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'"
class="lead btn btn-primary viewButton">View</a> rel="noopener noreferrer" [routerLink]="['/items/' + dso.id]"
</div> class="lead btn btn-primary viewButton">View</a>
</div> </div>
<ng-content></ng-content>
</div> </div>
</ds-truncatable> </ds-truncatable>
<ng-content></ng-content>
</div>

View 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 */
};

View File

@@ -2,10 +2,12 @@
[index]="index" [index]="index"
[linkType]="linkType" [linkType]="linkType"
[listID]="listID"> [listID]="listID">
<div class="card-footer text-center"> <ul class="list-group list-group-flush">
<a class="btn btn-light btn-sm btn-auto my-1" [routerLink]="[getEditPath()]"> <li class="list-group-item text-center">
<i class="fa fa-edit"></i> <a class="btn btn-light btn-sm btn-auto my-1 edit-link" [routerLink]="[editPath]">
</a> <i class="fa fa-edit"></i>
</div> </a>
</li>
</ul>
</ds-collection-search-result-grid-element> </ds-collection-search-result-grid-element>

View File

@@ -1,6 +1,10 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { NO_ERRORS_SCHEMA } from '@angular/core'; 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 { CollectionAdminSearchResultGridElementComponent } from './collection-admin-search-result-grid-element.component';
import { TranslateModule } from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core';
import { TruncatableService } from '../../../truncatable/truncatable.service'; import { TruncatableService } from '../../../truncatable/truncatable.service';
@@ -12,7 +16,7 @@ import { By } from '@angular/platform-browser';
import { RouterTestingModule } from '@angular/router/testing'; import { RouterTestingModule } from '@angular/router/testing';
import { getCollectionEditPath } from '../../../../+collection-page/collection-page-routing.module'; import { getCollectionEditPath } from '../../../../+collection-page/collection-page-routing.module';
describe('CollectionAdminSearchResultListElementComponent', () => { describe('CollectionAdminSearchResultGridElementComponent', () => {
let component: CollectionAdminSearchResultGridElementComponent; let component: CollectionAdminSearchResultGridElementComponent;
let fixture: ComponentFixture<CollectionAdminSearchResultGridElementComponent>; let fixture: ComponentFixture<CollectionAdminSearchResultGridElementComponent>;
let id; let id;
@@ -28,12 +32,15 @@ describe('CollectionAdminSearchResultListElementComponent', () => {
init(); init();
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [ imports: [
NoopAnimationsModule,
TranslateModule.forRoot(), TranslateModule.forRoot(),
RouterTestingModule.withRoutes([]) RouterTestingModule.withRoutes([]),
SharedModule
], ],
declarations: [CollectionAdminSearchResultGridElementComponent], providers: [
providers: [{ provide: TruncatableService, useValue: {} }], { provide: TruncatableService, useValue: mockTruncatableService },
schemas: [NO_ERRORS_SCHEMA] { provide: BitstreamDataService, useValue: {} },
]
}) })
.compileComponents(); .compileComponents();
})); }));
@@ -53,7 +60,7 @@ describe('CollectionAdminSearchResultListElementComponent', () => {
}); });
it('should render an edit button with the correct link', () => { 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; const link = a.nativeElement.href;
expect(link).toContain(getCollectionEditPath(id)); expect(link).toContain(getCollectionEditPath(id));
}) })

View File

@@ -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 * The component for displaying a list element for a collection search result on the admin search page
*/ */
export class CollectionAdminSearchResultGridElementComponent extends SearchResultGridElementComponent<CollectionSearchResult, Collection> { export class CollectionAdminSearchResultGridElementComponent extends SearchResultGridElementComponent<CollectionSearchResult, Collection> {
editPath: string;
/** ngOnInit() {
* Returns the path to the edit page of this collection super.ngOnInit();
*/ this.editPath = getCollectionEditPath(this.dso.uuid);
getEditPath(): string {
return getCollectionEditPath(this.dso.uuid)
} }
} }

View File

@@ -2,10 +2,12 @@
[index]="index" [index]="index"
[linkType]="linkType" [linkType]="linkType"
[listID]="listID"> [listID]="listID">
<div class="card-footer text-center"> <ul class="list-group list-group-flush">
<a class="btn btn-light btn-sm btn-auto my-1" [routerLink]="[getEditPath()]"> <li class="list-group-item text-center">
<i class="fa fa-edit"></i> <a class="btn btn-light btn-sm btn-auto my-1 edit-link" [routerLink]="[editPath]">
</a> <i class="fa fa-edit"></i>
</div> </a>
</li>
</ul>
</ds-community-search-result-grid-element> </ds-community-search-result-grid-element>

View File

@@ -1,7 +1,11 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { NO_ERRORS_SCHEMA } from '@angular/core'; import { NO_ERRORS_SCHEMA } from '@angular/core';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { TranslateModule } from '@ngx-translate/core'; 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 { TruncatableService } from '../../../truncatable/truncatable.service';
import { CollectionElementLinkType } from '../../../object-collection/collection-element-link.type'; import { CollectionElementLinkType } from '../../../object-collection/collection-element-link.type';
import { ViewMode } from '../../../../core/shared/view-mode.model'; 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 { CommunitySearchResult } from '../../../object-collection/shared/community-search-result.model';
import { getCommunityEditPath } from '../../../../+community-page/community-page-routing.module'; import { getCommunityEditPath } from '../../../../+community-page/community-page-routing.module';
describe('CommunityAdminSearchResultListElementComponent', () => { describe('CommunityAdminSearchResultGridElementComponent', () => {
let component: CommunityAdminSearchResultGridElementComponent; let component: CommunityAdminSearchResultGridElementComponent;
let fixture: ComponentFixture<CommunityAdminSearchResultGridElementComponent>; let fixture: ComponentFixture<CommunityAdminSearchResultGridElementComponent>;
let id; let id;
@@ -28,11 +32,15 @@ describe('CommunityAdminSearchResultListElementComponent', () => {
init(); init();
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [ imports: [
NoopAnimationsModule,
TranslateModule.forRoot(), 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] schemas: [NO_ERRORS_SCHEMA]
}) })
.compileComponents(); .compileComponents();
@@ -53,7 +61,7 @@ describe('CommunityAdminSearchResultListElementComponent', () => {
}); });
it('should render an edit button with the correct link', () => { 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; const link = a.nativeElement.href;
expect(link).toContain(getCommunityEditPath(id)); expect(link).toContain(getCommunityEditPath(id));
}) })

View File

@@ -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 * The component for displaying a list element for a community search result on the admin search page
*/ */
export class CommunityAdminSearchResultGridElementComponent extends SearchResultGridElementComponent<CommunitySearchResult, Community> { export class CommunityAdminSearchResultGridElementComponent extends SearchResultGridElementComponent<CommunitySearchResult, Community> {
editPath: string;
/** ngOnInit() {
* Returns the path to the edit page of this community super.ngOnInit();
*/ this.editPath = getCommunityEditPath(this.dso.uuid);
getEditPath(): string {
return getCommunityEditPath(this.dso.uuid)
} }
} }

View File

@@ -8,32 +8,34 @@
<span class="badge badge-warning">{{ "admin.search.item.withdrawn" | translate }}</span> <span class="badge badge-warning">{{ "admin.search.item.withdrawn" | translate }}</span>
</div> </div>
</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"> <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> <i class="fa fa-edit"></i>
</a> </a>
<a *ngIf="dso && !dso.isWithdrawn" class="btn btn-light btn-sm my-1 withdraw-link" [routerLink]="[getWithdrawPath()]" [title]="'admin.search.item.withdraw' | translate"> <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>
<a *ngIf="dso && dso.isWithdrawn" class="btn btn-light btn-sm my-1 reinstate-link" [routerLink]="[getReinstatePath()]" [title]="'admin.search.item.reinstate' | translate"> <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>
<a *ngIf="dso && dso.isDiscoverable" class="btn btn-light btn-sm my-1 private-link" [routerLink]="[getPrivatePath()]" [title]="'admin.search.item.make-private' | translate"> <a *ngIf="dso && dso.isDiscoverable" class="btn btn-light btn-sm my-1 private-link" [routerLink]="[getPrivatePath()]" [title]="'admin.search.item.make-private' | translate">
<i class="fa fa-eye-slash"></i> <i class="fa fa-eye-slash"></i>
</a> </a>
<a *ngIf="dso && !dso.isDiscoverable" class="btn btn-light btn-sm my-1 public-link" [routerLink]="[getPublicPath()]" [title]="'admin.search.item.make-public' | translate"> <a *ngIf="dso && !dso.isDiscoverable" class="btn btn-light btn-sm my-1 public-link" [routerLink]="[getPublicPath()]" [title]="'admin.search.item.make-public' | translate">
<i class="fa fa-eye"></i> <i class="fa fa-eye"></i>
</a> </a>
<a class="btn btn-light btn-sm my-1 delete-link" [routerLink]="[getDeletePath()]" [title]="'admin.search.item.delete' | translate"> <a class="btn btn-light btn-sm my-1 delete-link" [routerLink]="[getDeletePath()]" [title]="'admin.search.item.delete' | translate">
<i class="fa fa-trash"></i> <i class="fa fa-trash"></i>
</a> </a>
<a class="btn btn-light btn-sm my-1 move-link" [routerLink]="[getMovePath()]" [title]="'admin.search.item.move' | translate"> <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> <i class="fa fa-arrow-circle-right"></i>
</a> </a>
</div> </li>
</ul>

View File

@@ -1,7 +1,16 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { NO_ERRORS_SCHEMA } from '@angular/core'; import { NO_ERRORS_SCHEMA } from '@angular/core';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { TranslateModule } from '@ngx-translate/core'; 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 { TruncatableService } from '../../../truncatable/truncatable.service';
import { CollectionElementLinkType } from '../../../object-collection/collection-element-link.type'; import { CollectionElementLinkType } from '../../../object-collection/collection-element-link.type';
import { ViewMode } from '../../../../core/shared/view-mode.model'; import { ViewMode } from '../../../../core/shared/view-mode.model';
@@ -20,6 +29,12 @@ describe('ItemAdminSearchResultListElementComponent', () => {
let id; let id;
let searchResult; let searchResult;
const mockBitstreamDataService = {
getThumbnailFor(item: Item): Observable<RemoteData<Bitstream>> {
return createSuccessfulRemoteDataObject$(new Bitstream());
}
};
function init() { function init() {
id = '780b2588-bda5-4112-a1cd-0b15000a5339'; id = '780b2588-bda5-4112-a1cd-0b15000a5339';
searchResult = new ItemSearchResult(); searchResult = new ItemSearchResult();
@@ -30,11 +45,15 @@ describe('ItemAdminSearchResultListElementComponent', () => {
init(); init();
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [ imports: [
NoopAnimationsModule,
TranslateModule.forRoot(), 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] schemas: [NO_ERRORS_SCHEMA]
}) })
.compileComponents(); .compileComponents();

View File

@@ -6,6 +6,7 @@ import { Store } from '@ngrx/store';
import { of as observableOf } from 'rxjs'; import { of as observableOf } from 'rxjs';
import { RemoteDataBuildService } from '../../../../core/cache/builders/remote-data-build.service'; import { RemoteDataBuildService } from '../../../../core/cache/builders/remote-data-build.service';
import { ObjectCacheService } from '../../../../core/cache/object-cache.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 { CommunityDataService } from '../../../../core/data/community-data.service';
import { DefaultChangeAnalyzer } from '../../../../core/data/default-change-analyzer.service'; import { DefaultChangeAnalyzer } from '../../../../core/data/default-change-analyzer.service';
import { DSOChangeAnalyzer } from '../../../../core/data/dso-change-analyzer.service'; import { DSOChangeAnalyzer } from '../../../../core/data/dso-change-analyzer.service';
@@ -62,6 +63,7 @@ describe('CollectionSearchResultGridElementComponent', () => {
{ provide: UUIDService, useValue: {} }, { provide: UUIDService, useValue: {} },
{ provide: Store, useValue: {} }, { provide: Store, useValue: {} },
{ provide: RemoteDataBuildService, useValue: {} }, { provide: RemoteDataBuildService, useValue: {} },
{ provide: BitstreamDataService, useValue: {} },
{ provide: CommunityDataService, useValue: {} }, { provide: CommunityDataService, useValue: {} },
{ provide: HALEndpointService, useValue: {} }, { provide: HALEndpointService, useValue: {} },
{ provide: NotificationsService, useValue: {} }, { provide: NotificationsService, useValue: {} },

View File

@@ -6,6 +6,7 @@ import { Store } from '@ngrx/store';
import { of as observableOf } from 'rxjs'; import { of as observableOf } from 'rxjs';
import { RemoteDataBuildService } from '../../../../core/cache/builders/remote-data-build.service'; import { RemoteDataBuildService } from '../../../../core/cache/builders/remote-data-build.service';
import { ObjectCacheService } from '../../../../core/cache/object-cache.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 { CommunityDataService } from '../../../../core/data/community-data.service';
import { DefaultChangeAnalyzer } from '../../../../core/data/default-change-analyzer.service'; import { DefaultChangeAnalyzer } from '../../../../core/data/default-change-analyzer.service';
import { DSOChangeAnalyzer } from '../../../../core/data/dso-change-analyzer.service'; import { DSOChangeAnalyzer } from '../../../../core/data/dso-change-analyzer.service';
@@ -62,6 +63,7 @@ describe('CommunitySearchResultGridElementComponent', () => {
{ provide: UUIDService, useValue: {} }, { provide: UUIDService, useValue: {} },
{ provide: Store, useValue: {} }, { provide: Store, useValue: {} },
{ provide: RemoteDataBuildService, useValue: {} }, { provide: RemoteDataBuildService, useValue: {} },
{ provide: BitstreamDataService, useValue: {} },
{ provide: CommunityDataService, useValue: {} }, { provide: CommunityDataService, useValue: {} },
{ provide: HALEndpointService, useValue: {} }, { provide: HALEndpointService, useValue: {} },
{ provide: NotificationsService, useValue: {} }, { provide: NotificationsService, useValue: {} },

View File

@@ -1,43 +1,44 @@
<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> <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"> class="card-img-top full-width">
<div> <div>
<ds-grid-thumbnail [thumbnail]="getThumbnail() | async"> <ds-grid-thumbnail [thumbnail]="getThumbnail() | async">
</ds-grid-thumbnail> </ds-grid-thumbnail>
</div> </div>
</a> </a>
<span *ngIf="linkType == linkTypes.None" class="card-img-top full-width"> <span *ngIf="linkType == linkTypes.None" class="card-img-top full-width">
<div> <div>
<ds-grid-thumbnail [thumbnail]="getThumbnail() | async"> <ds-grid-thumbnail [thumbnail]="getThumbnail() | async">
</ds-grid-thumbnail> </ds-grid-thumbnail>
</div> </div>
</span> </span>
<div class="card-body"> <div class="card-body">
<ds-item-type-badge [object]="dso"></ds-item-type-badge> <ds-item-type-badge [object]="dso"></ds-item-type-badge>
<ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4"> <ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4">
<h4 class="card-title" [innerHTML]="firstMetadataValue('dc.title')"></h4> <h4 class="card-title" [innerHTML]="firstMetadataValue('dc.title')"></h4>
</ds-truncatable-part> </ds-truncatable-part>
<p *ngIf="dso.hasMetadata(['dc.contributor.author', 'dc.creator', 'dc.contributor.*'])" <p *ngIf="dso.hasMetadata(['dc.contributor.author', 'dc.creator', 'dc.contributor.*'])"
class="item-authors card-text text-muted"> class="item-authors card-text text-muted">
<ds-truncatable-part [id]="dso.id" [minLines]="1"> <ds-truncatable-part [id]="dso.id" [minLines]="1">
<span *ngIf="dso.hasMetadata('dc.date.issued')" class="item-date">{{firstMetadataValue('dc.date.issued')}}</span> <span *ngIf="dso.hasMetadata('dc.date.issued')" class="item-date">{{firstMetadataValue('dc.date.issued')}}</span>
<span *ngFor="let author of allMetadataValues(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']);">, <span *ngFor="let author of allMetadataValues(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']);">,
<span [innerHTML]="author"></span> <span [innerHTML]="author"></span>
</span> </span>
</ds-truncatable-part> </ds-truncatable-part>
</p> </p>
<p *ngIf="dso.hasMetadata('dc.description.abstract')" class="item-abstract card-text"> <p *ngIf="dso.hasMetadata('dc.description.abstract')" class="item-abstract card-text">
<ds-truncatable-part [id]="dso.id" [minLines]="3"> <ds-truncatable-part [id]="dso.id" [minLines]="3">
<span [innerHTML]="firstMetadataValue('dc.description.abstract')"></span> <span [innerHTML]="firstMetadataValue('dc.description.abstract')"></span>
</ds-truncatable-part> </ds-truncatable-part>
</p> </p>
<div *ngIf="linkType != linkTypes.None" class="text-center"> <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> class="lead btn btn-primary viewButton">View</a>
</div> </div>
</div> </div>
<ng-content></ng-content> </ds-truncatable>
</div> <ng-content></ng-content>
</ds-truncatable> </div>

View File

@@ -3,7 +3,7 @@
[linkType]="linkType" [linkType]="linkType"
[listID]="listID"></ds-collection-search-result-list-element> [listID]="listID"></ds-collection-search-result-list-element>
<div> <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}} <i class="fa fa-edit"></i> {{"admin.search.collection.edit" | translate}}
</a> </a>
</div> </div>

View File

@@ -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 * The component for displaying a list element for a collection search result on the admin search page
*/ */
export class CollectionAdminSearchResultListElementComponent extends SearchResultListElementComponent<CollectionSearchResult, Collection> { export class CollectionAdminSearchResultListElementComponent extends SearchResultListElementComponent<CollectionSearchResult, Collection> {
editPath: string;
/** ngOnInit() {
* Returns the path to the edit page of this collection super.ngOnInit();
*/ this.editPath = getCollectionEditPath(this.dso.uuid);
getEditPath(): string {
return getCollectionEditPath(this.dso.uuid)
} }
} }

View File

@@ -3,7 +3,7 @@
[linkType]="linkType" [linkType]="linkType"
[listID]="listID"></ds-community-search-result-list-element> [listID]="listID"></ds-community-search-result-list-element>
<div> <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}} <i class="fa fa-edit"></i> {{"admin.search.community.edit" | translate}}
</a> </a>
</div> </div>

View File

@@ -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 * The component for displaying a list element for a community search result on the admin search page
*/ */
export class CommunityAdminSearchResultListElementComponent extends SearchResultListElementComponent<CommunitySearchResult, Community> { export class CommunityAdminSearchResultListElementComponent extends SearchResultListElementComponent<CommunitySearchResult, Community> {
editPath: string;
/** ngOnInit() {
* Returns the path to the edit page of this community super.ngOnInit();
*/ this.editPath = getCommunityEditPath(this.dso.uuid);
getEditPath(): string {
return getCommunityEditPath(this.dso.uuid)
} }
} }

View File

@@ -15,11 +15,11 @@
</a> </a>
<a *ngIf="dso && !dso.isWithdrawn" class="btn btn-light my-1 withdraw-link" [routerLink]="[getWithdrawPath()]" [title]="'admin.search.item.withdraw' | translate"> <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>
<a *ngIf="dso && dso.isWithdrawn" class="btn btn-light my-1 reinstate-link" [routerLink]="[getReinstatePath()]" [title]="'admin.search.item.reinstate' | translate"> <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>
<a *ngIf="dso && dso.isDiscoverable" class="btn btn-light my-1 private-link" [routerLink]="[getPrivatePath()]" [title]="'admin.search.item.make-private' | translate"> <a *ngIf="dso && dso.isDiscoverable" class="btn btn-light my-1 private-link" [routerLink]="[getPrivatePath()]" [title]="'admin.search.item.make-private' | translate">

View File

@@ -27,9 +27,9 @@ describe('PaginatedSearchOptions', () => {
'query=search query&' + 'query=search query&' +
'scope=0fde1ecb-82cc-425a-b600-ac3576d76b47&' + 'scope=0fde1ecb-82cc-425a-b600-ac3576d76b47&' +
'dsoType=ITEM&' + 'dsoType=ITEM&' +
'f.test=value,query&' + 'f.test=value&' +
'f.example=another value,query&' + 'f.example=another value&' +
'f.example=second value,query' 'f.example=second value'
); );
}); });

View File

@@ -21,9 +21,9 @@ describe('SearchOptions', () => {
'query=search query&' + 'query=search query&' +
'scope=0fde1ecb-82cc-425a-b600-ac3576d76b47&' + 'scope=0fde1ecb-82cc-425a-b600-ac3576d76b47&' +
'dsoType=ITEM&' + 'dsoType=ITEM&' +
'f.test=value,query&' + 'f.test=value&' +
'f.example=another value,query&' + 'f.example=another value&' +
'f.example=second value,query' 'f.example=second value'
); );
}); });

View File

@@ -1,5 +1,6 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { of as observableOf } from 'rxjs'; import { of as observableOf } from 'rxjs';
import { mockTruncatableService } from '../mocks/mock-trucatable.service';
import { TruncatableComponent } from './truncatable.component'; import { TruncatableComponent } from './truncatable.component';
import { TruncatableService } from './truncatable.service'; import { TruncatableService } from './truncatable.service';
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
@@ -10,29 +11,12 @@ describe('TruncatableComponent', () => {
let fixture: ComponentFixture<TruncatableComponent>; let fixture: ComponentFixture<TruncatableComponent>;
const identifier = '1234567890'; const identifier = '1234567890';
let truncatableService; 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(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [NoopAnimationsModule], imports: [NoopAnimationsModule],
declarations: [TruncatableComponent], declarations: [TruncatableComponent],
providers: [ providers: [
{ provide: TruncatableService, useValue: truncatableServiceStub }, { provide: TruncatableService, useValue: mockTruncatableService },
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]
}).overrideComponent(TruncatableComponent, { }).overrideComponent(TruncatableComponent, {