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>
</div> </div>
<button (click)="moveCollection()" class="btn btn-primary" [disabled]=!canMove> <div class="button-row bottom">
<span *ngIf="!processing"> {{'item.edit.move.move' | translate}}</span> <div class="float-right">
<span *ngIf="processing"><i class='fas fa-circle-notch fa-spin'></i> <button [routerLink]="[(itemPageRoute$ | async), 'edit']" class="btn btn-outline-secondary">
{{'item.edit.move.processing' | translate}} <i class="fas fa-arrow-left"></i> {{'item.edit.move.cancel' | translate}}
</span> </button>
</button> <button class="btn btn-primary mr-0" [disabled]="!canMove" (click)="moveCollection()">
<button [routerLink]="[(itemPageRoute$ | async), 'edit']" <span *ngIf="!processing">
class="btn btn-outline-secondary"> <i class="fas fa-save"></i> {{'item.edit.move.save-button' | translate}}
{{'item.edit.move.cancel' | translate}} </span>
</button> <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> </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 { get canMove(): boolean {
return this.canSubmit && this.selectedCollection?.id !== this.originalCollection.id; 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.", "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.",