-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Import Step): Add dedicated choose unit page before choosing step
- Loading branch information
1 parent
449e662
commit 8a5b6c3
Showing
9 changed files
with
282 additions
and
250 deletions.
There are no files selected for viewing
113 changes: 44 additions & 69 deletions
113
src/app/authoring-tool/import-step/choose-import-step/choose-import-step.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/app/authoring-tool/import-step/choose-import-unit/choose-import-unit.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<ng-template #projects let-projects="projects"> | ||
<div *ngFor="let project of projects" class="projectItem" (click)="chooseProject(project)"> | ||
{{ project.id + ' - ' + project.name }} | ||
<span *ngIf="project.runId != null"> (<span i18n>Run ID</span>: {{ project.runId }})</span> | ||
</div> | ||
</ng-template> | ||
<h5 i18n>Choose a unit from which to import step(s).</h5> | ||
<mat-tab-group> | ||
<mat-tab label="My Units" i18n-label> | ||
<ng-container *ngTemplateOutlet="projects; context: { projects: myProjects }"></ng-container | ||
></mat-tab> | ||
<mat-tab label="Library Units" i18n-label> | ||
<ng-container | ||
*ngTemplateOutlet="projects; context: { projects: libraryProjects }" | ||
></ng-container | ||
></mat-tab> | ||
</mat-tab-group> | ||
<hr /> | ||
<div class="nav-controls" fxLayout="row" fxLayoutGap="20px" fxLayoutAlign="end center"> | ||
<button mat-button color="primary" routerLink="../.." aria-label="cancel" i18n>Cancel</button> | ||
</div> |
7 changes: 7 additions & 0 deletions
7
src/app/authoring-tool/import-step/choose-import-unit/choose-import-unit.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.projectItem { | ||
cursor: pointer; | ||
} | ||
|
||
.projectItem:hover { | ||
background-color:#add8e6; | ||
} |
37 changes: 37 additions & 0 deletions
37
src/app/authoring-tool/import-step/choose-import-unit/choose-import-unit.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Component } from '@angular/core'; | ||
import { ConfigService } from '../../../../assets/wise5/services/configService'; | ||
import { ProjectLibraryService } from '../../../../assets/wise5/services/projectLibraryService'; | ||
import { ActivatedRoute, Router } from '@angular/router'; | ||
|
||
@Component({ | ||
selector: 'choose-import-unit', | ||
styleUrls: ['./choose-import-unit.component.scss'], | ||
templateUrl: './choose-import-unit.component.html' | ||
}) | ||
export class ChooseImportUnitComponent { | ||
protected libraryProjects: any[]; | ||
protected myProjects: any[]; | ||
|
||
constructor( | ||
private configService: ConfigService, | ||
private projectLibraryService: ProjectLibraryService, | ||
private route: ActivatedRoute, | ||
private router: Router | ||
) {} | ||
|
||
ngOnInit(): void { | ||
this.myProjects = this.configService.getAuthorableProjects(); | ||
this.projectLibraryService.getLibraryProjects().then((libraryProjects) => { | ||
this.libraryProjects = this.projectLibraryService.sortAndFilterUniqueProjects( | ||
libraryProjects | ||
); | ||
}); | ||
} | ||
|
||
protected chooseProject(project: any): void { | ||
this.router.navigate(['../choose-step'], { | ||
relativeTo: this.route, | ||
state: { importProjectId: project.id } | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.