Skip to content

Commit

Permalink
Changed the select reading list dialog to close after adding comics [#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mcpierce committed Jun 6, 2020
1 parent 9146a88 commit 79bca8b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
@@ -1,5 +1,7 @@
<p-dialog [visible]='showDialog'
[modal]='true'>
<p-dialog #addToListDialog
[visible]='showDialog'
[modal]='true'
[closable]='false'>
<form [formGroup]='readingListForm'>
<div class='ui-g'>
<div class='ui-g-12 cx-input-label'>
Expand All @@ -16,14 +18,15 @@
class='cx-action-button ui-button-success'
icon='fa fa-fw fa-save'
[label]='"button.save"|translate'
[disabled]='!readingListForm.valid'
[disabled]='!readingListForm.valid || addingComics'
(click)='readingListSelected()'></button>
<button pButton
type='button'
class='cx-action-button ui-button-danger'
icon='fa fa-fw fa-cancel'
[label]='"button.cancel"|translate'
(click)='hideSelection()'></button>
[disabled]='addingComics'
(click)='hideDialog()'></button>
</div>
</div>
</form>
Expand Down
Expand Up @@ -42,6 +42,9 @@ export class AddComicsToReadingListComponent implements OnInit, OnDestroy {
readingListOptions: SelectItem[] = [];
selectedComicsSubscription: Subscription;
selectedComics: Comic[] = [];
addingComicsSubscription: Subscription;
addingComics = false;
comicsAddedSubscription: Subscription;

constructor(
private formBuilder: FormBuilder,
Expand Down Expand Up @@ -70,6 +73,16 @@ export class AddComicsToReadingListComponent implements OnInit, OnDestroy {
this.selectedComicsSubscription = this.selectionAdaptor.comicSelection$.subscribe(
selected => (this.selectedComics = selected)
);
this.addingComicsSubscription = this.readingListAdaptor.addingComics$.subscribe(
adding => (this.addingComics = adding)
);
this.comicsAddedSubscription = this.readingListAdaptor.comicsAdded$.subscribe(
added => {
if (added) {
this.readingListAdaptor.hideSelectDialog();
}
}
);
}

ngOnInit() {}
Expand All @@ -78,6 +91,8 @@ export class AddComicsToReadingListComponent implements OnInit, OnDestroy {
this.showDialogSubscription.unsubscribe();
this.readingListsSubscription.unsubscribe();
this.selectedComicsSubscription.unsubscribe();
this.addingComicsSubscription.unsubscribe();
this.comicsAddedSubscription.unsubscribe();
}

readingListSelected() {
Expand All @@ -87,7 +102,7 @@ export class AddComicsToReadingListComponent implements OnInit, OnDestroy {
);
}

hideSelection() {
hideDialog() {
this.readingListAdaptor.hideSelectDialog();
}
}

0 comments on commit 79bca8b

Please sign in to comment.