mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-08 02:24:11 +00:00
use namevariants based on config
This commit is contained in:
@@ -1990,6 +1990,8 @@
|
||||
|
||||
"submission.sections.describe.relationship-lookup.search-tab.tab-title.isFundingOfPublication": "Search for Funding",
|
||||
|
||||
"submission.sections.describe.relationship-lookup.search-tab.tab-title.isChildOrgUnitOf": "Search for Organizational Units",
|
||||
|
||||
"submission.sections.describe.relationship-lookup.selection-tab.tab-title": "Current Selection ({{ count }})",
|
||||
|
||||
"submission.sections.describe.relationship-lookup.title.isJournalIssueOfPublication": "Journal Issues",
|
||||
@@ -2022,6 +2024,8 @@
|
||||
|
||||
"submission.sections.describe.relationship-lookup.selection-tab.title.isFundingOfPublication": "Selected Funding",
|
||||
|
||||
"submission.sections.describe.relationship-lookup.selection-tab.title.isChildOrgUnitOf": "Selected Organizational Unit",
|
||||
|
||||
"submission.sections.describe.relationship-lookup.selection-tab.title.sherpaJournal": "Search Results",
|
||||
|
||||
"submission.sections.describe.relationship-lookup.selection-tab.title.sherpaPublisher": "Search Results",
|
||||
|
@@ -9,6 +9,7 @@ export enum Context {
|
||||
Workflow = 'workflow',
|
||||
Workspace = 'workspace',
|
||||
AdminMenu = 'adminMenu',
|
||||
SubmissionModal = 'submissionModal',
|
||||
EntitySearchModalWithNameVariants = 'EntitySearchModalWithNameVariants',
|
||||
EntitySearchModal = 'EntitySearchModal',
|
||||
AdminSearch = 'adminSearch',
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@ import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { Metadata } from '../../../../../core/shared/metadata.utils';
|
||||
import { MetadataValue } from '../../../../../core/shared/metadata.models';
|
||||
|
||||
@listableObjectComponent(ExternalSourceEntry, ViewMode.ListElement, Context.SubmissionModal)
|
||||
@listableObjectComponent(ExternalSourceEntry, ViewMode.ListElement, Context.EntitySearchModalWithNameVariants)
|
||||
@Component({
|
||||
selector: 'ds-external-source-entry-list-submission-element',
|
||||
styleUrls: ['./external-source-entry-list-submission-element.component.scss'],
|
||||
|
@@ -3,8 +3,13 @@
|
||||
<!-- <ds-thumbnail [thumbnail]="getThumbnail() | async" [defaultImage]="'assets/images/orgunit-placeholder.svg'"></ds-thumbnail>-->
|
||||
<!-- </div>-->
|
||||
<div class="flex-grow-1">
|
||||
<ds-org-unit-input-suggestions [suggestions]="allSuggestions" [(ngModel)]="selectedName" (clickSuggestion)="select($event)"
|
||||
<ds-org-unit-input-suggestions *ngIf="useNameVariants" [suggestions]="allSuggestions" [(ngModel)]="selectedName" (clickSuggestion)="select($event)"
|
||||
(submitSuggestion)="selectCustom($event)"></ds-org-unit-input-suggestions>
|
||||
|
||||
<div *ngIf="!useNameVariants"
|
||||
class="lead"
|
||||
[innerHTML]="firstMetadataValue('organization.legalName')"></div>
|
||||
|
||||
<span class="text-muted">
|
||||
<span *ngIf="dso.allMetadata('organization.address.addressLocality').length > 0"
|
||||
class="item-list-address-locality">
|
||||
|
@@ -20,7 +20,8 @@ import { ItemDataService } from '../../../../../core/data/item-data.service';
|
||||
import { SelectableListService } from '../../../../../shared/object-list/selectable-list/selectable-list.service';
|
||||
import { NameVariantModalComponent } from '../../name-variant-modal/name-variant-modal.component';
|
||||
|
||||
@listableObjectComponent('OrgUnitSearchResult', ViewMode.ListElement, Context.SubmissionModal)
|
||||
@listableObjectComponent('OrgUnitSearchResult', ViewMode.ListElement, Context.EntitySearchModal)
|
||||
@listableObjectComponent('OrgUnitSearchResult', ViewMode.ListElement, Context.EntitySearchModalWithNameVariants)
|
||||
@Component({
|
||||
selector: 'ds-person-search-result-list-submission-element',
|
||||
styleUrls: ['./org-unit-search-result-list-submission-element.component.scss'],
|
||||
@@ -34,6 +35,7 @@ export class OrgUnitSearchResultListSubmissionElementComponent extends SearchRes
|
||||
allSuggestions: string[];
|
||||
selectedName: string;
|
||||
alternativeField = 'dc.title.alternative';
|
||||
useNameVariants = false;
|
||||
|
||||
constructor(protected truncatableService: TruncatableService,
|
||||
private relationshipService: RelationshipService,
|
||||
@@ -48,16 +50,21 @@ export class OrgUnitSearchResultListSubmissionElementComponent extends SearchRes
|
||||
|
||||
ngOnInit() {
|
||||
super.ngOnInit();
|
||||
const defaultValue = this.firstMetadataValue('organization.legalName');
|
||||
const alternatives = this.allMetadataValues(this.alternativeField);
|
||||
this.allSuggestions = [defaultValue, ...alternatives];
|
||||
|
||||
this.relationshipService.getNameVariant(this.listID, this.dso.uuid)
|
||||
.pipe(take(1))
|
||||
.subscribe((nameVariant: string) => {
|
||||
this.selectedName = nameVariant || defaultValue;
|
||||
}
|
||||
);
|
||||
this.useNameVariants = this.context === Context.EntitySearchModalWithNameVariants;
|
||||
|
||||
if (this.useNameVariants) {
|
||||
const defaultValue = this.firstMetadataValue('organization.legalName');
|
||||
const alternatives = this.allMetadataValues(this.alternativeField);
|
||||
this.allSuggestions = [defaultValue, ...alternatives];
|
||||
|
||||
this.relationshipService.getNameVariant(this.listID, this.dso.uuid)
|
||||
.pipe(take(1))
|
||||
.subscribe((nameVariant: string) => {
|
||||
this.selectedName = nameVariant || defaultValue;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
select(value) {
|
||||
|
@@ -20,7 +20,7 @@ import { MetadataValue } from '../../../../../core/shared/metadata.models';
|
||||
import { ItemDataService } from '../../../../../core/data/item-data.service';
|
||||
import { SelectableListService } from '../../../../../shared/object-list/selectable-list/selectable-list.service';
|
||||
|
||||
@listableObjectComponent('PersonSearchResult', ViewMode.ListElement, Context.SubmissionModal)
|
||||
@listableObjectComponent('PersonSearchResult', ViewMode.ListElement, Context.EntitySearchModalWithNameVariants)
|
||||
@Component({
|
||||
selector: 'ds-person-search-result-list-submission-element',
|
||||
styleUrls: ['./person-search-result-list-submission-element.component.scss'],
|
||||
|
@@ -126,8 +126,10 @@ export class DsDynamicLookupRelationModalComponent implements OnInit, OnDestroy
|
||||
this.selection$.pipe(take(1)).subscribe((selection) =>
|
||||
selection.map((s: SearchResult<Item>) => this.addNameVariantSubscription(s))
|
||||
);
|
||||
if (this.relationshipOptions.nameVariants) {
|
||||
this.context = Context.SubmissionModal;
|
||||
if (this.relationshipOptions.nameVariants === 'true') {
|
||||
this.context = Context.EntitySearchModalWithNameVariants;
|
||||
} else {
|
||||
this.context = Context.EntitySearchModal;
|
||||
}
|
||||
|
||||
this.externalSourcesRD$ = this.externalSourceService.findAll();
|
||||
|
@@ -105,7 +105,7 @@ export class ExternalSourceEntryImportModalComponent implements OnInit {
|
||||
/**
|
||||
* The context we're currently in (submission)
|
||||
*/
|
||||
context = Context.SubmissionModal;
|
||||
context = Context.EntitySearchModalWithNameVariants;
|
||||
|
||||
/**
|
||||
* List ID for selecting local entities
|
||||
|
@@ -7,7 +7,7 @@ export class RelationshipOptions {
|
||||
relationshipType: string;
|
||||
filter: string;
|
||||
searchConfiguration: string;
|
||||
nameVariants: boolean;
|
||||
nameVariants: string;
|
||||
|
||||
get metadataField() {
|
||||
return RELATION_METADATA_PREFIX + this.relationshipType
|
||||
|
@@ -74,6 +74,8 @@ export class ListableObjectComponentLoaderComponent implements OnInit {
|
||||
(componentRef.instance as any).linkType = this.linkType;
|
||||
(componentRef.instance as any).listID = this.listID;
|
||||
(componentRef.instance as any).showLabel = this.showLabel;
|
||||
(componentRef.instance as any).context = this.context;
|
||||
(componentRef.instance as any).viewMode = this.viewMode;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -34,6 +34,16 @@ export class AbstractListableElementComponent<T extends ListableObject> {
|
||||
*/
|
||||
@Input() showLabel: boolean = true;
|
||||
|
||||
/**
|
||||
* The context we matched on to get this component
|
||||
*/
|
||||
@Input() context: Context;
|
||||
|
||||
/**
|
||||
* The viewmode we matched on to get this component
|
||||
*/
|
||||
@Input() viewMode: ViewMode;
|
||||
|
||||
/**
|
||||
* The available link types
|
||||
*/
|
||||
|
@@ -4,7 +4,7 @@
|
||||
[id]="'object' + index"
|
||||
[ngModel]="selected$ | async"
|
||||
(ngModelChange)="selectCheckbox($event)">
|
||||
<input *ngIf="!selectionConfig.repeatable" class="form-check-input" type="radio"
|
||||
<input *ngIf="!selectionConfig.repeatable" class="form-check-input mt-2" type="radio"
|
||||
[name]="'radio' + index"
|
||||
[id]="'object' + index"
|
||||
[checked]="selected$ | async"
|
||||
|
Reference in New Issue
Block a user