UI: Add image link to image details dialog. Autoselect image on upload.
This commit is contained in:
parent
c3f1ffeb41
commit
102f5a33a2
@ -30,34 +30,44 @@
|
|||||||
<div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div>
|
<div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div>
|
||||||
<div mat-dialog-content>
|
<div mat-dialog-content>
|
||||||
<fieldset [disabled]="isLoading$ | async">
|
<fieldset [disabled]="isLoading$ | async">
|
||||||
<div fxLayout="row" fxLayoutGap="8px">
|
<mat-form-field>
|
||||||
<mat-form-field fxFlex>
|
<mat-label translate>image.name</mat-label>
|
||||||
<mat-label translate>image.name</mat-label>
|
<input matInput formControlName="title" required>
|
||||||
<input matInput formControlName="title" required>
|
<mat-error *ngIf="imageFormGroup.get('title').hasError('required')">
|
||||||
<mat-error *ngIf="imageFormGroup.get('title').hasError('required')">
|
{{ 'image.name-required' | translate }}
|
||||||
{{ 'image.name-required' | translate }}
|
</mat-error>
|
||||||
</mat-error>
|
<button *ngIf="!readonly && imageFormGroup.dirty"
|
||||||
<button *ngIf="!readonly && imageFormGroup.dirty"
|
matIconSuffix
|
||||||
matIconSuffix
|
type="button"
|
||||||
type="button"
|
mat-icon-button [disabled]="isLoading$ | async"
|
||||||
mat-icon-button [disabled]="isLoading$ | async"
|
matTooltip="{{ 'action.undo' | translate }}"
|
||||||
matTooltip="{{ 'action.undo' | translate }}"
|
matTooltipPosition="above"
|
||||||
matTooltipPosition="above"
|
(click)="revertInfo()">
|
||||||
(click)="revertInfo()">
|
<mat-icon>close</mat-icon>
|
||||||
<mat-icon>close</mat-icon>
|
</button>
|
||||||
</button>
|
<button *ngIf="!readonly && !imageFormGroup.invalid && imageFormGroup.dirty"
|
||||||
<button *ngIf="!readonly && !imageFormGroup.invalid && imageFormGroup.dirty"
|
matIconSuffix
|
||||||
matIconSuffix
|
type="button"
|
||||||
type="button"
|
color="primary"
|
||||||
color="primary"
|
mat-icon-button [disabled]="isLoading$ | async"
|
||||||
mat-icon-button [disabled]="isLoading$ | async"
|
matTooltip="{{ 'action.save' | translate }}"
|
||||||
matTooltip="{{ 'action.save' | translate }}"
|
matTooltipPosition="above"
|
||||||
matTooltipPosition="above"
|
(click)="saveInfo()">
|
||||||
(click)="saveInfo()">
|
<mat-icon>check</mat-icon>
|
||||||
<mat-icon>check</mat-icon>
|
</button>
|
||||||
</button>
|
</mat-form-field>
|
||||||
</mat-form-field>
|
<mat-form-field>
|
||||||
</div>
|
<mat-label translate>image.link</mat-label>
|
||||||
|
<input matInput formControlName="link">
|
||||||
|
<tb-copy-button
|
||||||
|
matSuffix
|
||||||
|
miniButton="false"
|
||||||
|
[copyText]="imageFormGroup.get('link').value"
|
||||||
|
tooltipText="{{ 'image.copy-image-link' | translate }}"
|
||||||
|
tooltipPosition="above"
|
||||||
|
icon="content_copy">
|
||||||
|
</tb-copy-button>
|
||||||
|
</mat-form-field>
|
||||||
<div class="tb-image-container tb-primary-fill">
|
<div class="tb-image-container tb-primary-fill">
|
||||||
<div class="tb-image-content">
|
<div class="tb-image-content">
|
||||||
<div class="tb-image-actions">
|
<div class="tb-image-actions">
|
||||||
|
|||||||
@ -29,6 +29,7 @@ import {
|
|||||||
UploadImageDialogData
|
UploadImageDialogData
|
||||||
} from '@shared/components/image/upload-image-dialog.component';
|
} from '@shared/components/image/upload-image-dialog.component';
|
||||||
import { UrlHolder } from '@shared/pipe/image.pipe';
|
import { UrlHolder } from '@shared/pipe/image.pipe';
|
||||||
|
import { ImportExportService } from '@shared/import-export/import-export.service';
|
||||||
|
|
||||||
export interface ImageDialogData {
|
export interface ImageDialogData {
|
||||||
readonly: boolean;
|
readonly: boolean;
|
||||||
@ -57,6 +58,7 @@ export class ImageDialogComponent extends
|
|||||||
protected router: Router,
|
protected router: Router,
|
||||||
private imageService: ImageService,
|
private imageService: ImageService,
|
||||||
private dialog: MatDialog,
|
private dialog: MatDialog,
|
||||||
|
private importExportService: ImportExportService,
|
||||||
@Inject(MAT_DIALOG_DATA) private data: ImageDialogData,
|
@Inject(MAT_DIALOG_DATA) private data: ImageDialogData,
|
||||||
public dialogRef: MatDialogRef<ImageDialogComponent, ImageResourceInfo>,
|
public dialogRef: MatDialogRef<ImageDialogComponent, ImageResourceInfo>,
|
||||||
public fb: UntypedFormBuilder) {
|
public fb: UntypedFormBuilder) {
|
||||||
@ -70,10 +72,13 @@ export class ImageDialogComponent extends
|
|||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.imageFormGroup = this.fb.group({
|
this.imageFormGroup = this.fb.group({
|
||||||
title: [this.image.title, [Validators.required]]
|
title: [this.image.title, [Validators.required]],
|
||||||
|
link: [this.image.link, []],
|
||||||
});
|
});
|
||||||
if (this.data.readonly) {
|
if (this.data.readonly) {
|
||||||
this.imageFormGroup.disable();
|
this.imageFormGroup.disable();
|
||||||
|
} else {
|
||||||
|
this.imageFormGroup.get('link').disable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,7 +114,7 @@ export class ImageDialogComponent extends
|
|||||||
if ($event) {
|
if ($event) {
|
||||||
$event.stopPropagation();
|
$event.stopPropagation();
|
||||||
}
|
}
|
||||||
// TODO:
|
this.importExportService.exportImage(imageResourceType(this.image), this.image.resourceKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateImage($event): void {
|
updateImage($event): void {
|
||||||
|
|||||||
@ -624,7 +624,11 @@ export class ImageGalleryComponent extends PageComponent implements OnInit, OnDe
|
|||||||
data: {}
|
data: {}
|
||||||
}).afterClosed().subscribe((result) => {
|
}).afterClosed().subscribe((result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
this.updateData();
|
if (this.selectionMode) {
|
||||||
|
this.imageSelected.next(result);
|
||||||
|
} else {
|
||||||
|
this.updateData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2988,7 +2988,9 @@
|
|||||||
"no-image-selected": "No image selected",
|
"no-image-selected": "No image selected",
|
||||||
"browse-from-gallery": "Browse from gallery",
|
"browse-from-gallery": "Browse from gallery",
|
||||||
"set-link": "Set link",
|
"set-link": "Set link",
|
||||||
"image-link": "Image link"
|
"image-link": "Image link",
|
||||||
|
"link": "Link",
|
||||||
|
"copy-image-link": "Copy image link"
|
||||||
},
|
},
|
||||||
"image-input": {
|
"image-input": {
|
||||||
"drop-images-or": "Drag and drop an images or",
|
"drop-images-or": "Drag and drop an images or",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user