80195: Mimic back/save/discard buttons of other edit pages

This commit is contained in:
Yura Bondarenko
2021-06-23 15:31:13 +02:00
parent 86cd7ba03f
commit c825f911f5
3 changed files with 28 additions and 11 deletions

View File

@@ -30,16 +30,24 @@
</div>
</div>
<button (click)="moveCollection()" class="btn btn-primary" [disabled]=!canMove>
<span *ngIf="!processing"> {{'item.edit.move.move' | translate}}</span>
<span *ngIf="processing"><i class='fas fa-circle-notch fa-spin'></i>
{{'item.edit.move.processing' | translate}}
</span>
</button>
<button [routerLink]="[(itemPageRoute$ | async), 'edit']"
class="btn btn-outline-secondary">
{{'item.edit.move.cancel' | translate}}
</button>
<div class="button-row bottom">
<div class="float-right">
<button [routerLink]="[(itemPageRoute$ | async), 'edit']" class="btn btn-outline-secondary">
<i class="fas fa-arrow-left"></i> {{'item.edit.move.cancel' | translate}}
</button>
<button class="btn btn-primary mr-0" [disabled]="!canMove" (click)="moveCollection()">
<span *ngIf="!processing">
<i class="fas fa-save"></i> {{'item.edit.move.save-button' | translate}}
</span>
<span *ngIf="processing">
<i class="fas fa-circle-notch fa-spin"></i> {{'item.edit.move.processing' | translate}}
</span>
</button>
<button class="btn btn-danger" [disabled]="!canSubmit" (click)="discard()">
<i class="fas fa-times"></i> {{"item.edit.move.discard-button" | translate}}
</button>
</div>
</div>
</div>
</div>
</div>

View File

@@ -121,6 +121,11 @@ export class ItemMoveComponent implements OnInit {
);
}
discard(): void {
this.selectedCollection = null;
this.canSubmit = false;
}
get canMove(): boolean {
return this.canSubmit && this.selectedCollection?.id !== this.originalCollection.id;
}

View File

@@ -1623,7 +1623,11 @@
"item.edit.move.cancel": "Cancel",
"item.edit.move.cancel": "Back",
"item.edit.move.save-button": "Save",
"item.edit.move.discard-button": "Discard",
"item.edit.move.description": "Select the collection you wish to move this item to. To narrow down the list of displayed collections, you can enter a search query in the box.",