Skip to content

Commit

Permalink
works just needs code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jessewashburn committed Jan 31, 2025
1 parent 8d0e99f commit 9aaaa51
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
6 changes: 5 additions & 1 deletion src/app/courses/courses.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -456,13 +456,17 @@ export class CoursesComponent implements OnInit, OnChanges, AfterViewInit, OnDes
}

openCourseViewDialog(courseId) {
this.dialog.open(CoursesViewDetailDialogComponent, {
const dialogRef = this.dialog.open(CoursesViewDetailDialogComponent, {
data: { courseId },
minWidth: '600px',
maxWidth: '90vw',
maxHeight: '90vh',
autoFocus: false
});

dialogRef.afterClosed().subscribe(() => {
this.dialog.closeAll();
});
}

addTag(tag: string) {
Expand Down
9 changes: 6 additions & 3 deletions src/app/courses/view-courses/courses-view-detail.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component, Input, Inject, OnInit, OnChanges } from '@angular/core';
import { StateService } from '../../shared/state.service';
import { Router, ActivatedRoute } from '@angular/router';
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { take } from 'rxjs/operators';
import * as constants from '../constants';
import { CoursesService } from '../courses.service';
Expand Down Expand Up @@ -52,7 +52,8 @@ export class CoursesViewDetailDialogComponent implements OnInit {
private router: Router,
@Inject(MAT_DIALOG_DATA) public data: any,
private coursesService: CoursesService,
private dialogsLoadingService: DialogsLoadingService
private dialogsLoadingService: DialogsLoadingService,
private dialogRef: MatDialogRef<CoursesViewDetailDialogComponent>
) {}

ngOnInit() {
Expand All @@ -65,6 +66,8 @@ export class CoursesViewDetailDialogComponent implements OnInit {
}

routeToCourses(courseId) {
this.router.navigate([ '../../courses/view/', courseId ], { relativeTo: this.route });
this.router.navigate([ '../../courses/view/', courseId ], { relativeTo: this.route }).then(() => {
this.dialogRef.close();
});
}
}
6 changes: 5 additions & 1 deletion src/app/teams/teams-view.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -533,13 +533,17 @@ export class TeamsViewComponent implements OnInit, AfterViewChecked, OnDestroy {
}

openCourseView(courseId) {
this.dialog.open(CoursesViewDetailDialogComponent, {
const dialogRef = this.dialog.open(CoursesViewDetailDialogComponent, {
data: { courseId: courseId },
minWidth: '600px',
maxWidth: '90vw',
maxHeight: '90vh',
autoFocus: false
});

dialogRef.afterClosed().subscribe(() => {
this.dialog.closeAll();
});
}

openResource(resourceId) {
Expand Down

0 comments on commit 9aaaa51

Please sign in to comment.