Browse Source

Confirm dialog for assets.

pull/501/head
Sebastian 6 years ago
parent
commit
3f8a4b7c50
  1. 4
      frontend/app/framework/angular/forms/confirm-click.directive.ts
  2. 5
      frontend/app/shared/components/assets/asset.component.ts
  3. 4
      frontend/app/shared/components/comments/comment.component.ts

4
frontend/app/framework/angular/forms/confirm-click.directive.ts

@ -79,10 +79,10 @@ export class ConfirmClickDirective implements OnDestroy {
const subscription =
this.dialogs.confirm(this.confirmTitle, this.confirmText)
.subscribe(result => {
.subscribe(confiormed => {
this.isOpen = false;
if (result) {
if (confiormed) {
this.clickConfirmed.delayEmit();
}

5
frontend/app/shared/components/assets/asset.component.ts

@ -105,6 +105,9 @@ export class AssetComponent implements OnInit {
public updateFile(files: FileList) {
if (files.length === 1 && this.asset.canUpload) {
this.dialogs.confirm('Replace asset?', `Do you really want to replace asset **${this.asset.fileName}** with a newer version`)
.subscribe(confirmed => {
if (confirmed) {
this.setProgress(1);
this.assetUploader.uploadAsset(this.asset, files[0])
@ -123,6 +126,8 @@ export class AssetComponent implements OnInit {
this.setProgress(0);
});
}
});
}
}
public edit() {

4
frontend/app/shared/components/comments/comment.component.ts

@ -105,8 +105,10 @@ export class CommentComponent implements OnChanges {
if (!text || text.length === 0) {
this.dialogs.confirm('Delete comment', 'Do you really want to delete the comment?')
.subscribe(() => {
.subscribe(confirmed => {
if (confirmed) {
this.delete();
}
});
} else {
this.commentsState.update(this.comment, text);

Loading…
Cancel
Save