diff --git a/src/app/modules/library/library-project-details/library-project-details.component.html b/src/app/modules/library/library-project-details/library-project-details.component.html
index b8a7a30ca1d..65d00c9e538 100644
--- a/src/app/modules/library/library-project-details/library-project-details.component.html
+++ b/src/app/modules/library/library-project-details/library-project-details.component.html
@@ -6,18 +6,22 @@
{{ project.metadata.title }}
-
- Grade level:
-
- {{ g }}{{ isLast ? '' : ', ' }}
- |
- Duration: {{ project.metadata.totalTime }}
-
+ @if (project.metadata.grades.length || project.metadata.totalTime) {
+
+ @if (project.metadata.grades.length) {
+ Grade level:
+ }
+ @for (grade of project.metadata.grades; track grade; let last = $last) {
+ {{ grade }}{{ last ? '' : ', ' }}
+ }
+ @if (project.metadata.grades.length && project.metadata.totalTime) {
+ |
+ }
+ @if (project.metadata.totalTime) {
+ Duration: {{ project.metadata.totalTime }}
+ }
+
+ }
Unit ID: {{ project.id }}
@@ -27,112 +31,130 @@
-
+ @if (isTeacher && project.wiseVersion !== 4) {
+
+ }
-
- warning
- Legacy Unit
-
-
-
- Discipline:
-
- {{ discipline.name }}{{ isLast ? '' : ' / ' }}
-
-
-
- Features: {{ project.metadata.features }}
-
-
- NGSS Performance Expectations:
-
- {{ dcia.id }} {{ dcia.name }}
-
- ({{ pe.id }}{{ isLastChild ? '' : ', ' }}) {{ isLast ? '' : ' / ' }}
-
-
+ @if (project.wiseVersion === 4) {
+
+ warning
+ Legacy Unit
+
+ }
+ @if (project.metadata.summary) {
+
+ }
+ @if (ngss.disciplines.length) {
+
+ Discipline:
+ @for (discipline of ngss.disciplines; track discipline.name; let last = $last) {
+ {{ discipline.name }}{{ last ? '' : ' / ' }}
+ }
+
+ }
+ @if (project.metadata.features) {
+
Features: {{ project.metadata.features }}
+ }
+ @if (ngss.dciArrangements.length) {
+
+ NGSS Performance Expectations:
+ @for (dcia of ngss.dciArrangements; track dcia.id; let last = $last) {
+ {{ dcia.id }} {{ dcia.name }}
+ @if (dcia.children.length) {
+ (
+ @for (pe of dcia.children; track pe.id; let lastChild = $last) {
+ {{ pe.id }}{{ lastChild ? '' : ', ' }}
+ }
+ )
+ }
+ {{ last ? '' : ' / ' }}
+ }
+
+ }
-
+ @if (project.metadata.discourseCategoryURL) {
+
+ }

-
- This unit is licensed under
- CC BY-SA.
- This unit is licensed under
- CC BY-SA by
- {{ authorsString }}.
-
-
- This unit is a copy of
- {{ parentProject.title }} (used
- under CC BY-SA).
- This unit is a copy of
- {{ parentProject.title }} by
- {{ parentAuthorsString }} (used under
- CC BY-SA).
-
+ @if (isCopy) {
+
+ @if (parentAuthorsString.length == 0) {
+ This unit is a copy of
+ {{ parentProject.title }} (used
+ under CC BY-SA).
+ } @else {
+ This unit is a copy of
+ {{ parentProject.title }} by
+ {{ parentAuthorsString }} (used under
+ CC BY-SA).
+ }
+
+ } @else {
+
+ @if (authorsString.length == 0) {
+ This unit is licensed under
+ CC BY-SA.
+ } @else {
+ This unit is licensed under
+ CC BY-SA by
+ {{ authorsString }}.
+ }
+
+ }
/
-
More
-
View License
+ @if (project.license) {
+
View License
+ } @else {
+
More
+ }
-
-
+
+ @if (isTeacher && !isRunProject && project.wiseVersion !== 4) {
+
+ }
diff --git a/src/app/modules/library/library-project-details/library-project-details.component.spec.ts b/src/app/modules/library/library-project-details/library-project-details.component.spec.ts
index 43d9c49dd83..f1a16c0e3e8 100644
--- a/src/app/modules/library/library-project-details/library-project-details.component.spec.ts
+++ b/src/app/modules/library/library-project-details/library-project-details.component.spec.ts
@@ -1,38 +1,12 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
-import { Observable } from 'rxjs';
import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from '@angular/material/dialog';
import { LibraryProjectDetailsComponent } from './library-project-details.component';
import { UserService } from '../../../services/user.service';
import { Project } from '../../../domain/project';
import { NGSSStandards } from '../ngssStandards';
-import { NO_ERRORS_SCHEMA } from '@angular/core';
import { ConfigService } from '../../../services/config.service';
import { ParentProject } from '../../../domain/parentProject';
-
-export class MockMatDialog {}
-
-export class MockUserService {
- isTeacher(): Observable {
- const isTeacher: boolean = true;
- return Observable.create((observer) => {
- observer.next(isTeacher);
- observer.complete();
- });
- }
-}
-
-export class MockConfigService {
- getContextPath(): string {
- return '';
- }
-}
-
-const parentProject = new ParentProject({
- id: 1000,
- title: 'Photosynthesis',
- uri: 'http://localhost:8080/project/1000',
- authors: [{ id: 6, firstName: 'Susie', lastName: 'Derkins', username: 'SusieDerkins' }]
-});
+import { MockProviders } from 'ng-mocks';
describe('LibraryProjectDetailsComponent', () => {
let component: LibraryProjectDetailsComponent;
@@ -40,15 +14,11 @@ describe('LibraryProjectDetailsComponent', () => {
beforeEach(() => {
TestBed.configureTestingModule({
- declarations: [LibraryProjectDetailsComponent],
+ imports: [LibraryProjectDetailsComponent],
providers: [
- { provide: UserService, useClass: MockUserService },
- { provide: ConfigService, useClass: MockConfigService },
- { provide: MatDialogRef, useValue: {} },
- { provide: MAT_DIALOG_DATA, useValue: [] },
- { provide: MatDialog, useClass: MockMatDialog }
- ],
- schemas: [NO_ERRORS_SCHEMA]
+ MockProviders(ConfigService, MatDialog, MatDialogRef, UserService),
+ { provide: MAT_DIALOG_DATA, useValue: {} }
+ ]
});
fixture = TestBed.createComponent(LibraryProjectDetailsComponent);
component = fixture.componentInstance;
@@ -93,10 +63,10 @@ describe('LibraryProjectDetailsComponent', () => {
const ngss: NGSSStandards = new NGSSStandards();
ngss.disciplines = ngssObject.disciplines;
ngss.dciArrangements = ngssObject.dciArrangements;
- component.ngss = ngss;
- component.project = new Project(project);
- component.parentProject = new ParentProject();
- component.setLicenseInfo();
+ component['ngss'] = ngss;
+ component['project'] = new Project(project);
+ component['parentProject'] = new ParentProject();
+ component['setLicenseInfo']();
fixture.detectChanges();
});
@@ -121,9 +91,14 @@ describe('LibraryProjectDetailsComponent', () => {
});
it('should show copied project info', () => {
- component.project.metadata.authors = [];
- component.parentProject = parentProject;
- component.setLicenseInfo();
+ component['project'].metadata.authors = [];
+ component['parentProject'] = new ParentProject({
+ id: 1000,
+ title: 'Photosynthesis',
+ uri: 'http://localhost:8080/project/1000',
+ authors: [{ id: 6, firstName: 'Susie', lastName: 'Derkins', username: 'SusieDerkins' }]
+ });
+ component['setLicenseInfo']();
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.textContent).toContain('is a copy of Photosynthesis');
diff --git a/src/app/modules/library/library-project-details/library-project-details.component.ts b/src/app/modules/library/library-project-details/library-project-details.component.ts
index 3fdfa843aa2..5161e51a191 100644
--- a/src/app/modules/library/library-project-details/library-project-details.component.ts
+++ b/src/app/modules/library/library-project-details/library-project-details.component.ts
@@ -1,54 +1,69 @@
import { Component, Inject, OnInit } from '@angular/core';
-import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
+import {
+ MatDialog,
+ MatDialogRef,
+ MAT_DIALOG_DATA,
+ MatDialogModule
+} from '@angular/material/dialog';
import { UserService } from '../../../services/user.service';
import { CreateRunDialogComponent } from '../../../teacher/create-run-dialog/create-run-dialog.component';
import { NGSSStandards } from '../ngssStandards';
import { Project } from '../../../domain/project';
import { ParentProject } from '../../../domain/parentProject';
import { ConfigService } from '../../../services/config.service';
+import { LibraryProjectMenuComponent } from '../library-project-menu/library-project-menu.component';
+import { CommonModule } from '@angular/common';
+import { MatIconModule } from '@angular/material/icon';
+import { MatTooltipModule } from '@angular/material/tooltip';
+import { UnitTagsComponent } from '../../../teacher/unit-tags/unit-tags.component';
+import { DiscourseCategoryActivityComponent } from '../discourse-category-activity/discourse-category-activity.component';
+import { MatButtonModule } from '@angular/material/button';
+import { FlexLayoutModule } from '@angular/flex-layout';
@Component({
- selector: 'app-library-project-details',
- templateUrl: './library-project-details.component.html',
- styleUrls: ['./library-project-details.component.scss'],
- standalone: false
+ imports: [
+ CommonModule,
+ DiscourseCategoryActivityComponent,
+ FlexLayoutModule,
+ LibraryProjectMenuComponent,
+ MatButtonModule,
+ MatDialogModule,
+ MatIconModule,
+ MatTooltipModule,
+ UnitTagsComponent
+ ],
+ selector: 'app-library-project-details',
+ styleUrl: './library-project-details.component.scss',
+ templateUrl: './library-project-details.component.html'
})
export class LibraryProjectDetailsComponent implements OnInit {
- isTeacher: boolean = false;
- isRunProject: false;
- ngss: NGSSStandards = new NGSSStandards();
- ngssWebUrl: string = 'https://www.nextgenscience.org/search-standards?keys=';
- project: Project;
- parentProject: ParentProject;
- licenseUrl = 'http://creativecommons.org/licenses/by-sa/4.0/';
- licenseInfo = $localize`License pertains to original content created by the author(s). Authors are responsible for the usage and attribution of any third-party content linked to or included in this work.`;
- license: string = '';
- authorsString: string = '';
- parentAuthorsString: string = '';
- more: boolean = false;
- isCopy: boolean = false;
- discourseURL: string = '';
- topics: any[] = [];
- postCount: number = 0;
- hasMoreTopics: boolean = false;
+ protected authorsString: string = '';
+ protected isCopy: boolean;
+ protected isTeacher: boolean;
+ protected isRunProject: false;
+ protected licenseInfo = $localize`License pertains to original content created by the author(s). Authors are responsible for the usage and attribution of any third-party content linked to or included in this work.`;
+ protected licenseUrl = 'http://creativecommons.org/licenses/by-sa/4.0/';
+ protected ngss: NGSSStandards = new NGSSStandards();
+ protected ngssWebUrl: string = 'https://www.nextgenscience.org/search-standards?keys=';
+ protected parentAuthorsString: string = '';
+ protected parentProject: ParentProject;
+ protected project: Project;
constructor(
+ private configService: ConfigService,
+ @Inject(MAT_DIALOG_DATA) public data: any,
public dialog: MatDialog,
public dialogRef: MatDialogRef,
- @Inject(MAT_DIALOG_DATA) public data: any,
- private configService: ConfigService,
private userService: UserService
) {}
- ngOnInit() {
+ ngOnInit(): void {
this.isTeacher = this.userService.isTeacher();
this.isRunProject = this.data.isRunProject;
if (this.data.project) {
this.project = new Project(this.data.project);
- const numParents = this.data.project.metadata.parentProjects
- ? this.data.project.metadata.parentProjects.length
- : null;
- if (numParents) {
+ const numParents = this.data.project.metadata.parentProjects?.length ?? 0;
+ if (numParents > 0) {
this.parentProject = new ParentProject(
this.data.project.metadata.parentProjects[numParents - 1]
);
@@ -58,11 +73,7 @@ export class LibraryProjectDetailsComponent implements OnInit {
}
}
- onClose(): void {
- this.dialogRef.close();
- }
-
- setNGSS(): void {
+ private setNGSS(): void {
const standards = this.project.metadata.standardsAddressed;
if (standards) {
const ngss = standards.ngss;
@@ -86,7 +97,7 @@ export class LibraryProjectDetailsComponent implements OnInit {
}
}
- setLicenseInfo(): void {
+ private setLicenseInfo(): void {
this.authorsString = this.getAuthorsString(this.project.metadata.authors);
if (this.parentProject) {
this.parentAuthorsString = this.getAuthorsString(this.parentProject.authors);
@@ -96,18 +107,15 @@ export class LibraryProjectDetailsComponent implements OnInit {
}
}
- getAuthorsString(authors: any[]): string {
- if (!authors) {
- return '';
- }
- return authors
- .map((author) => {
- return `${author.firstName} ${author.lastName}`;
- })
- .join(', ');
+ private getAuthorsString(authors: any[]): string {
+ return authors?.map((author) => `${author.firstName} ${author.lastName}`).join(', ') ?? '';
+ }
+
+ protected close(): void {
+ this.dialogRef.close();
}
- runProject() {
+ protected runProject(): void {
this.dialog.open(CreateRunDialogComponent, {
data: this.data,
panelClass: 'dialog-md',
@@ -116,14 +124,12 @@ export class LibraryProjectDetailsComponent implements OnInit {
this.dialogRef.close();
}
- previewProject() {
- if (this.project.wiseVersion === 4) {
- window.open(
- `${this.configService.getWISE4Hostname()}` +
- `/previewproject.html?projectId=${this.project.id}`
- );
- } else {
- window.open(`/preview/unit/${this.project.id}`);
- }
+ protected previewProject(): void {
+ window.open(
+ this.project.wiseVersion === 4
+ ? `${this.configService.getWISE4Hostname()}` +
+ `/previewproject.html?projectId=${this.project.id}`
+ : `/preview/unit/${this.project.id}`
+ );
}
}
diff --git a/src/app/modules/library/library.module.ts b/src/app/modules/library/library.module.ts
index d35f1fc3a5c..7732615a66f 100644
--- a/src/app/modules/library/library.module.ts
+++ b/src/app/modules/library/library.module.ts
@@ -6,7 +6,6 @@ import { LibraryGroupThumbsComponent } from './library-group-thumbs/library-grou
import { LibraryProjectComponent } from './library-project/library-project.component';
import { LibraryProjectDetailsComponent } from './library-project-details/library-project-details.component';
import { LibraryProjectDisciplinesComponent } from './library-project-disciplines/library-project-disciplines.component';
-import { LibraryProjectMenuComponent } from './library-project-menu/library-project-menu.component';
import { LibraryService } from '../../services/library.service';
import { RouterModule } from '@angular/router';
import { SharedModule } from '../shared/shared.module';
@@ -47,7 +46,6 @@ import {
import { ShareProjectDialogComponent } from './share-project-dialog/share-project-dialog.component';
import { CopyProjectDialogComponent } from './copy-project-dialog/copy-project-dialog.component';
import { LibraryPaginatorIntl } from './libraryPaginatorIntl';
-import { DiscourseCategoryActivityComponent } from './discourse-category-activity/discourse-category-activity.component';
import { ArchiveProjectsButtonComponent } from '../../teacher/archive-projects-button/archive-projects-button.component';
import { SearchBarComponent } from '../shared/search-bar/search-bar.component';
import { SelectAllItemsCheckboxComponent } from './select-all-items-checkbox/select-all-items-checkbox.component';
@@ -85,11 +83,10 @@ const materialModules = [
ApplyTagsButtonComponent,
ArchiveProjectsButtonComponent,
CommonModule,
- DiscourseCategoryActivityComponent,
FlexLayoutModule,
FormsModule,
+ LibraryProjectDetailsComponent,
LibraryProjectDisciplinesComponent,
- LibraryProjectMenuComponent,
ReactiveFormsModule,
RouterModule,
materialModules,
@@ -104,7 +101,6 @@ const materialModules = [
declarations: [
LibraryGroupThumbsComponent,
LibraryProjectComponent,
- LibraryProjectDetailsComponent,
LibraryFiltersComponent,
HomePageProjectLibraryComponent,
TeacherProjectLibraryComponent,
diff --git a/src/messages.xlf b/src/messages.xlf
index 42520ffffb9..7bee4632296 100644
--- a/src/messages.xlf
+++ b/src/messages.xlf
@@ -287,7 +287,7 @@
src/app/modules/library/library-project-details/library-project-details.component.html
- 125,127
+ 150,151
src/app/modules/library/official-library/official-library-details.html
@@ -5768,28 +5768,28 @@ Click "Cancel" to keep the invalid JSON open so you can fix it.Grade level:
src/app/modules/library/library-project-details/library-project-details.component.html
- 10,11
+ 12,14
Duration:
src/app/modules/library/library-project-details/library-project-details.component.html
- 18,19
+ 21,22
Unit ID:
src/app/modules/library/library-project-details/library-project-details.component.html
- 22,23
+ 26,27
This unit is from an old version of WISE that is no longer supported. Please find an alternate unit to use in the future or contact us for upgrade options.
src/app/modules/library/library-project-details/library-project-details.component.html
- 44,47
+ 47,50
src/app/teacher/teacher-run-list-item/teacher-run-list-item.component.html
@@ -5800,7 +5800,7 @@ Click "Cancel" to keep the invalid JSON open so you can fix it.Legacy Unit
src/app/modules/library/library-project-details/library-project-details.component.html
- 47,50
+ 50,54
src/app/modules/library/library-project/library-project.component.html
@@ -5811,70 +5811,70 @@ Click "Cancel" to keep the invalid JSON open so you can fix it.Discipline:
src/app/modules/library/library-project-details/library-project-details.component.html
- 52,53
+ 59,60
Features:
src/app/modules/library/library-project-details/library-project-details.component.html
- 58,60
+ 66,68
NGSS Performance Expectations:
src/app/modules/library/library-project-details/library-project-details.component.html
- 61,62
+ 70,71
-
- This unit is licensed under CC BY-SA.
+
+ This unit is a copy of (used under CC BY-SA).
src/app/modules/library/library-project-details/library-project-details.component.html
- 88,89
+ 104,106
-
- This unit is licensed under CC BY-SA by .
+
+ This unit is a copy of by (used under CC BY-SA).
src/app/modules/library/library-project-details/library-project-details.component.html
- 92,95
+ 110,113
-
- This unit is a copy of (used under CC BY-SA).
+
+ This unit is licensed under CC BY-SA.
src/app/modules/library/library-project-details/library-project-details.component.html
- 99,101
+ 121,122
-
- This unit is a copy of by (used under CC BY-SA).
+
+ This unit is licensed under CC BY-SA by .
src/app/modules/library/library-project-details/library-project-details.component.html
- 104,107
+ 126,129
-
- More
+
+ View License
src/app/modules/library/library-project-details/library-project-details.component.html
- 118,120
+ 135,139
-
- View License
+
+ More
src/app/modules/library/library-project-details/library-project-details.component.html
- 120,124
+ 143,149
Use with Class
src/app/modules/library/library-project-details/library-project-details.component.html
- 133,136
+ 154,158
src/app/teacher/create-run-dialog/create-run-dialog.component.html
@@ -5885,7 +5885,7 @@ Click "Cancel" to keep the invalid JSON open so you can fix it.Preview
src/app/modules/library/library-project-details/library-project-details.component.html
- 137,140
+ 159,162
src/app/teacher/run-menu/run-menu.component.html
@@ -5920,7 +5920,7 @@ Click "Cancel" to keep the invalid JSON open so you can fix it.License pertains to original content created by the author(s). Authors are responsible for the usage and attribution of any third-party content linked to or included in this work.
src/app/modules/library/library-project-details/library-project-details.component.ts
- 24
+ 44