Add no-image placeholder

2022.01
Willem Dantuma 2021-03-01 17:25:40 +01:00
parent 01488ae2e0
commit 47f3238edd
3 changed files with 17 additions and 3 deletions

View File

@ -5,8 +5,12 @@
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="modal-body">
<div class="cropper">
<div *ngIf="!isImageLoaded" class="no-image" (click)="fileInput.click()">
<i class="fal fa-image"></i>
<div i18n>No image selected</div>
</div>
<image-cropper #imageCropper
[imageChangedEvent]="imageChangedEvent"
[maintainAspectRatio]="true"
@ -23,7 +27,7 @@
<span class="btn btn-primary" (click)="fileInput.click()" i18n>Select image</span>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary" i18n>Apply</button>
<button type="submit" class="btn btn-primary" i18n [disabled]="!isImageLoaded">Apply</button>
<button type="button" autofocus class="btn btn-secondary" (click)="modal.close('Save click')" i18n="@@buttonCancel">Cancel</button>
</div>
</ng-template>

View File

@ -1,4 +1,13 @@
.cropper {
position: relative;
height: calc(60vh);
}
.no-image {
text-align: center;
}
.no-image i {
font-size: calc(50vh);
color: gray;
}

View File

@ -21,8 +21,8 @@ export class EditImageModalComponent implements OnInit {
this.modalService.open(this.modal,{ size: 'lg' });
}
isImageLoaded:boolean = false;
aspectRatio:number = 4/3;
imageChangedEvent: any = '';
croppedImage: any = '';
@ -33,6 +33,7 @@ export class EditImageModalComponent implements OnInit {
this.croppedImage = event.base64;
}
imageLoaded(image: LoadedImage) {
this.isImageLoaded=true;
}
cropperReady() {
// cropper ready