mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
80195: Replace input suggestions with collection selector
This commit is contained in:
@@ -5,19 +5,16 @@
|
||||
<p>{{'item.edit.move.description' | translate}}</p>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<ds-dso-input-suggestions #f id="search-form"
|
||||
[suggestions]="(collectionSearchResults | async)"
|
||||
[placeholder]="'item.edit.move.search.placeholder'| translate"
|
||||
[action]="getCurrentUrl()"
|
||||
[name]="'item-move'"
|
||||
[(ngModel)]="selectedCollectionName"
|
||||
(clickSuggestion)="onClick($event)"
|
||||
(typeSuggestion)="resetCollection($event)"
|
||||
(findSuggestions)="findSuggestions($event)"
|
||||
(click)="f.open()"
|
||||
ngDefaultControl>
|
||||
</ds-dso-input-suggestions>
|
||||
|
||||
<div class="card mb-3">
|
||||
<div class="card-header">{{'dso-selector.placeholder' | translate: { type: 'collection' } }}</div>
|
||||
<div class="card-body">
|
||||
<ds-authorized-collection-selector [types]="COLLECTIONS"
|
||||
[currentDSOId]="selectedCollection?.id"
|
||||
(onSelect)="selectDso($event)">
|
||||
</ds-authorized-collection-selector>
|
||||
</div>
|
||||
<div></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
@@ -53,6 +53,8 @@ export class ItemMoveComponent implements OnInit {
|
||||
*/
|
||||
itemPageRoute$: Observable<string>;
|
||||
|
||||
COLLECTIONS = [DSpaceObjectType.COLLECTION];
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private notificationsService: NotificationsService,
|
||||
@@ -75,14 +77,6 @@ export class ItemMoveComponent implements OnInit {
|
||||
this.loadSuggestions('');
|
||||
}
|
||||
|
||||
/**
|
||||
* Find suggestions based on entered query
|
||||
* @param query - Search query
|
||||
*/
|
||||
findSuggestions(query): void {
|
||||
this.loadSuggestions(query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load all available collections to move the item to.
|
||||
* TODO: When the API support it, only fetch collections where user has ADD rights to.
|
||||
@@ -107,7 +101,7 @@ export class ItemMoveComponent implements OnInit {
|
||||
* Set the collection name and id based on the selected value
|
||||
* @param data - obtained from the ds-input-suggestions component
|
||||
*/
|
||||
onClick(data: any): void {
|
||||
selectDso(data: any): void {
|
||||
this.selectedCollection = data;
|
||||
this.selectedCollectionName = data.name;
|
||||
this.canSubmit = true;
|
||||
@@ -137,12 +131,4 @@ export class ItemMoveComponent implements OnInit {
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the can submit when the user changes the content of the input field
|
||||
* @param data
|
||||
*/
|
||||
resetCollection(data: any) {
|
||||
this.canSubmit = false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user