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 5c36bc10a3e..445bb0c5157 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
@@ -68,6 +68,16 @@
>
}
+ @if (project.metadata.resources?.length > 0) {
+
+ Resources:
+ {{ first ? ' ' : '' }}
+ @for (resource of project.metadata.resources; track resource.name; let last = $last) {
+ {{ resource.name }}{{ last ? '' : ' • ' }}
+ }
+
+ }
@if (project.metadata.summary) {
}
@@ -128,16 +138,6 @@
}
}
- @if (project.metadata.resources?.length > 0) {
-
- Resources:
- {{ first ? ' ' : '' }}
- @for (resource of project.metadata.resources; track resource.name; let last = $last) {
- {{ resource.name }}{{ last ? '' : ' • ' }}
- }
-
- }
@if (project.tags) {
}
@@ -208,7 +208,7 @@
>
}
- @if (project.metadata.unitType === 'Platform') {
+ @if (canPreview) {
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 05935aea359..60fb5d20a58 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
@@ -13,22 +13,17 @@ let component: LibraryProjectDetailsComponent;
let fixture: ComponentFixture;
describe('LibraryProjectDetailsComponent', () => {
beforeEach(() => {
- TestBed.configureTestingModule({
- declarations: [MockComponent(LibraryProjectMenuComponent)],
- imports: [LibraryProjectDetailsComponent],
- providers: [
- MockProviders(ConfigService, MatDialog, MatDialogRef, UserService),
- { provide: MAT_DIALOG_DATA, useValue: {} }
- ]
- });
- fixture = TestBed.createComponent(LibraryProjectDetailsComponent);
- component = fixture.componentInstance;
const project: Project = new Project();
project.id = 1;
project.name = 'Photosynthesis & Cellular Respiration';
project.projectThumb = 'photo.png';
project.metadata = {
grades: ['7'],
+ standards: {
+ ngss: [{ id: 'MS-LS1-6', name: 'MS-LS1-6', url: 'http://ngss.com' }],
+ commonCore: [],
+ learningForJustice: []
+ },
title: 'Photosynthesis & Cellular Respiration',
summary: 'A really great unit.',
unitType: 'Platform',
@@ -39,14 +34,18 @@ describe('LibraryProjectDetailsComponent', () => {
],
resources: [{ name: 'Resource 1', uri: 'http://example.com/resource1' }]
};
- component['standards'] = {
- ngss: [{ id: 'MS-LS1-6', name: 'MS-LS1-6', url: 'http://ngss.com' }],
- commonCore: [],
- learningForJustice: []
- };
- component['project'] = new Project(project);
+ TestBed.configureTestingModule({
+ declarations: [MockComponent(LibraryProjectMenuComponent)],
+ imports: [LibraryProjectDetailsComponent],
+ providers: [
+ MockProviders(ConfigService, MatDialog, MatDialogRef, UserService),
+ { provide: MAT_DIALOG_DATA, useValue: { project: project } }
+ ]
+ });
+
+ fixture = TestBed.createComponent(LibraryProjectDetailsComponent);
+ component = fixture.componentInstance;
component['parentProject'] = new ParentProject();
- component['setLicenseInfo']();
fixture.detectChanges();
});
@@ -106,8 +105,14 @@ function isResourceUnitType_HideButtons() {
fixture.detectChanges();
});
- it('should hide buttons when unit type is Resource', () => {
+ it('should hide Use with Class button when unit type is Resource', () => {
+ expect(getButtonWithText('Use with Class')).toBeFalsy();
+ });
+
+ it('should hide Preview button when unit type is Resource and it has no resources', () => {
expect(getButtonWithText('Use with Class')).toBeFalsy();
+ component['canPreview'] = false;
+ fixture.detectChanges();
expect(getButtonWithText('Preview')).toBeFalsy();
});
});
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 98d99f2f954..03207f3b7a0 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
@@ -37,6 +37,7 @@ import { FlexLayoutModule } from '@angular/flex-layout';
})
export class LibraryProjectDetailsComponent implements OnInit {
protected authorsString: string = '';
+ protected canPreview: boolean;
protected isCopy: boolean;
protected isTeacher: boolean;
protected isRunProject: false;
@@ -73,6 +74,9 @@ export class LibraryProjectDetailsComponent implements OnInit {
}
this.standards = this.project.metadata.standards;
this.setLicenseInfo();
+ this.canPreview = !(
+ this.project.metadata.unitType === 'Other' && this.project.metadata.resources.length === 0
+ );
}
}
@@ -104,11 +108,21 @@ export class LibraryProjectDetailsComponent implements OnInit {
}
protected previewProject(): void {
- window.open(
- this.project.wiseVersion === 4
- ? `${this.configService.getWISE4Hostname()}` +
- `/previewproject.html?projectId=${this.project.id}`
- : `/preview/unit/${this.project.id}`
- );
+ if (this.project.wiseVersion === 4) {
+ window.open(
+ `${this.configService.getWISE4Hostname()}` +
+ `/previewproject.html?projectId=${this.project.id}`
+ );
+ } else {
+ this.previewProjectV5();
+ }
+ }
+
+ private previewProjectV5(): void {
+ if (this.project.metadata.unitType === 'Platform') {
+ window.open(`/preview/unit/${this.project.id}`);
+ } else {
+ window.open(this.project.metadata.resources[0].url);
+ }
}
}
diff --git a/src/app/modules/library/library-project-disciplines/library-project-disciplines.component.ts b/src/app/modules/library/library-project-disciplines/library-project-disciplines.component.ts
index 0772aff4d17..6f3f2d64401 100644
--- a/src/app/modules/library/library-project-disciplines/library-project-disciplines.component.ts
+++ b/src/app/modules/library/library-project-disciplines/library-project-disciplines.component.ts
@@ -20,7 +20,9 @@ export class LibraryProjectDisciplinesComponent implements OnInit {
ESS: '#2E7D32',
ETS: '#1565C0',
LS: '#D81B60',
- PS: '#8E24AA'
+ Math: '#444444',
+ PS: '#8E24AA',
+ SJ: '#F57C00'
};
this.disciplines.forEach((discipline) => {
discipline.color = colors[discipline.id] ?? '#000000';
diff --git a/src/app/modules/library/library/library.component.ts b/src/app/modules/library/library/library.component.ts
index 84df4eb34c0..db91d47f839 100644
--- a/src/app/modules/library/library/library.component.ts
+++ b/src/app/modules/library/library/library.component.ts
@@ -73,7 +73,7 @@ export abstract class LibraryComponent implements OnInit {
return project;
})
.filter((project) => project.visible)
- .sort((a, b) => a.metadata.title.localeCompare(b.metadata.title));
+ .sort((a, b) => b.id - a.id);
this.emitNumberOfProjectsVisible(this.countVisibleProjects(this.filteredProjects));
this.pageIndex = 0;
this.setPagination();
diff --git a/src/app/modules/library/personal-library/personal-library.component.spec.ts b/src/app/modules/library/personal-library/personal-library.component.spec.ts
index c87f5f9f17c..6d03d6c1327 100644
--- a/src/app/modules/library/personal-library/personal-library.component.spec.ts
+++ b/src/app/modules/library/personal-library/personal-library.component.spec.ts
@@ -142,7 +142,7 @@ function showArchivedProjects() {
describe('archived units view', () => {
it('only shows archived units', async () => {
await harness.showArchivedView();
- expect(await harness.getProjectIdsInView()).toEqual([projectId1, projectId2]);
+ expect(await harness.getProjectIdsInView()).toEqual([projectId2, projectId1]);
});
});
}
diff --git a/src/app/modules/shared/select-menu/select-menu.component.html b/src/app/modules/shared/select-menu/select-menu.component.html
index 1469f5955f8..2c59cf0722d 100644
--- a/src/app/modules/shared/select-menu/select-menu.component.html
+++ b/src/app/modules/shared/select-menu/select-menu.component.html
@@ -6,16 +6,20 @@
[(value)]="value"
[multiple]="multiple"
>
-
- {{ selectField.value ? selectField.value[0] : '' }}
- @if (selectField.value?.length > 1) {
- (+{{ selectField.value.length - 1 }} more)
- }
-
+ @if (multiple) {
+
+ {{ selectField.value ? selectField.value[0] : '' }}
+ @if (selectField.value?.length > 1) {
+
+ (+{{ selectField.value.length - 1 }} more)
+
+ }
+
+ }
@for (option of options; track option.id) {
-
- {{ option[viewValueProp] }}
-
+
+ {{ option[viewValueProp] }}
+
}
diff --git a/src/app/modules/shared/select-menu/select-menu.component.ts b/src/app/modules/shared/select-menu/select-menu.component.ts
index 94fc59fbace..fccb4a02d21 100644
--- a/src/app/modules/shared/select-menu/select-menu.component.ts
+++ b/src/app/modules/shared/select-menu/select-menu.component.ts
@@ -12,11 +12,11 @@ import { FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
import { MatSelectModule } from '@angular/material/select';
@Component({
- encapsulation: ViewEncapsulation.None,
- imports: [CommonModule, FormsModule, MatSelectModule, ReactiveFormsModule],
- selector: 'app-select-menu',
- styleUrl: './select-menu.component.scss',
- templateUrl: './select-menu.component.html'
+ encapsulation: ViewEncapsulation.None,
+ imports: [CommonModule, FormsModule, MatSelectModule, ReactiveFormsModule],
+ selector: 'app-select-menu',
+ styleUrl: './select-menu.component.scss',
+ templateUrl: './select-menu.component.html'
})
export class SelectMenuComponent implements OnInit {
@Output('update') change: EventEmitter = new EventEmitter();
diff --git a/src/messages.xlf b/src/messages.xlf
index ee8a09a25ce..01b01a335f6 100644
--- a/src/messages.xlf
+++ b/src/messages.xlf
@@ -5834,7 +5834,7 @@ Click "Cancel" to keep the invalid JSON open so you can fix it.
src/app/modules/library/library-project-details/library-project-details.component.ts
- 51
+ 52
@@ -5845,7 +5845,7 @@ Click "Cancel" to keep the invalid JSON open so you can fix it.
src/app/modules/library/library-project-details/library-project-details.component.ts
- 49
+ 50
@@ -5856,7 +5856,7 @@ Click "Cancel" to keep the invalid JSON open so you can fix it.
src/app/modules/library/library-project-details/library-project-details.component.ts
- 50
+ 51
@@ -5909,32 +5909,32 @@ Click "Cancel" to keep the invalid JSON open so you can fix it.38,40
+
+ Resources:
+
+ src/app/modules/library/library-project-details/library-project-details.component.html
+ 73,75
+
+
Discipline:
src/app/modules/library/library-project-details/library-project-details.component.html
- 76,78
+ 86,88
Features:
src/app/modules/library/library-project-details/library-project-details.component.html
- 88,89
+ 98,99
Standards Addressed:
src/app/modules/library/library-project-details/library-project-details.component.html
- 101,103
-
-
-
- Resources:
-
- src/app/modules/library/library-project-details/library-project-details.component.html
- 133,135
+ 111,113
@@ -5983,7 +5983,7 @@ Click "Cancel" to keep the invalid JSON open so you can fix it.Use with Class
src/app/modules/library/library-project-details/library-project-details.component.html
- 207,211
+ 207,212
src/app/teacher/create-run-dialog/create-run-dialog.component.html
@@ -6029,7 +6029,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
- 43
+ 44
@@ -6625,7 +6625,7 @@ Click "Cancel" to keep the invalid JSON open so you can fix it.more
src/app/modules/shared/select-menu/select-menu.component.html
- 12,15
+ 14,18
src/app/modules/shared/standards-select-menu/standards-select-menu.component.html