From ce024bdb706d49e68f92e2174e8be810522bcb65 Mon Sep 17 00:00:00 2001
From: Hiroki Terashima
Date: Mon, 31 Mar 2025 15:54:36 -0700
Subject: [PATCH 01/12] Add EditUnitResourcesComponent to allow authors to add
and delete UnitResources in the project info page
Co-authored-by: Aaron Detre
---
src/app/teacher/authoring-tool.module.ts | 2 +
.../edit-unit-resources.component.html | 70 +++++++++++++++++++
.../edit-unit-resources.component.scss | 37 ++++++++++
.../edit-unit-resources.component.spec.ts | 67 ++++++++++++++++++
.../edit-unit-resources.component.ts | 69 ++++++++++++++++++
.../project-info-authoring.component.html | 1 +
.../project-info-authoring.component.spec.ts | 14 ++--
.../project-info-authoring.component.ts | 11 +--
src/messages.xlf | 42 +++++++++++
9 files changed, 304 insertions(+), 9 deletions(-)
create mode 100644 src/assets/wise5/authoringTool/edit-unit-resources/edit-unit-resources.component.html
create mode 100644 src/assets/wise5/authoringTool/edit-unit-resources/edit-unit-resources.component.scss
create mode 100644 src/assets/wise5/authoringTool/edit-unit-resources/edit-unit-resources.component.spec.ts
create mode 100644 src/assets/wise5/authoringTool/edit-unit-resources/edit-unit-resources.component.ts
diff --git a/src/app/teacher/authoring-tool.module.ts b/src/app/teacher/authoring-tool.module.ts
index 8b4f180fe20..4866c1a9bc4 100644
--- a/src/app/teacher/authoring-tool.module.ts
+++ b/src/app/teacher/authoring-tool.module.ts
@@ -61,6 +61,7 @@ import { AddComponentComponent } from '../../assets/wise5/authoringTool/node/add
import { SideMenuComponent } from '../../assets/wise5/common/side-menu/side-menu.component';
import { MainMenuComponent } from '../../assets/wise5/common/main-menu/main-menu.component';
import { ChooseImportComponentComponent } from '../../assets/wise5/authoringTool/importComponent/choose-import-component/choose-import-component.component';
+import { EditUnitResourcesComponent } from '../../assets/wise5/authoringTool/edit-unit-resources/edit-unit-resources.component';
@NgModule({
declarations: [
@@ -106,6 +107,7 @@ import { ChooseImportComponentComponent } from '../../assets/wise5/authoringTool
CreateBranchComponent,
EditBranchComponent,
EditNodeTitleComponent,
+ EditUnitResourcesComponent,
MatBadgeModule,
MatChipsModule,
MatExpansionModule,
diff --git a/src/assets/wise5/authoringTool/edit-unit-resources/edit-unit-resources.component.html b/src/assets/wise5/authoringTool/edit-unit-resources/edit-unit-resources.component.html
new file mode 100644
index 00000000000..c6a7ba7ce69
--- /dev/null
+++ b/src/assets/wise5/authoringTool/edit-unit-resources/edit-unit-resources.component.html
@@ -0,0 +1,70 @@
+
+
+
+
+
+ Resources
+
+
+
+
+ @for (
+ resource of resources;
+ track $index;
+ let resourceIndex = $index, first = $first, last = $last
+ ) {
+ -
+
+
+
+ {{ resourceIndex + 1 }}
+
+
+
+ Resource Name
+
+
+
+ Resource URL
+
+
+
+
+
+
+
+
+
+ }
+
+
+
+
+
diff --git a/src/assets/wise5/authoringTool/edit-unit-resources/edit-unit-resources.component.scss b/src/assets/wise5/authoringTool/edit-unit-resources/edit-unit-resources.component.scss
new file mode 100644
index 00000000000..faea007bb8c
--- /dev/null
+++ b/src/assets/wise5/authoringTool/edit-unit-resources/edit-unit-resources.component.scss
@@ -0,0 +1,37 @@
+@import 'style/abstracts/variables';
+
+.resource-descriptions {
+ padding: 16px;
+ border-radius: $card-border-radius;
+}
+
+h5 {
+ margin-top: 0;
+}
+
+ul {
+ margin: 16px 0 0 0;
+ padding: 0 0 16px;
+}
+
+li {
+ list-style-type: none;
+}
+
+.resource {
+ position: relative;
+}
+
+.resource-content {
+ width: 100%;
+ padding: 8px;
+ margin-bottom: 8px;
+}
+
+.resource-input {
+ width: 100%;
+}
+
+.mat-subtitle-1 {
+ margin: 0;
+}
diff --git a/src/assets/wise5/authoringTool/edit-unit-resources/edit-unit-resources.component.spec.ts b/src/assets/wise5/authoringTool/edit-unit-resources/edit-unit-resources.component.spec.ts
new file mode 100644
index 00000000000..3072b8b76f2
--- /dev/null
+++ b/src/assets/wise5/authoringTool/edit-unit-resources/edit-unit-resources.component.spec.ts
@@ -0,0 +1,67 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+import { EditUnitResourcesComponent } from './edit-unit-resources.component';
+import { MockProvider } from 'ng-mocks';
+import { TeacherProjectService } from '../../services/teacherProjectService';
+import { By } from '@angular/platform-browser';
+
+let component: EditUnitResourcesComponent;
+let fixture: ComponentFixture;
+describe('EditUnitResourcesComponent', () => {
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ imports: [EditUnitResourcesComponent],
+ providers: [MockProvider(TeacherProjectService)]
+ }).compileComponents();
+
+ fixture = TestBed.createComponent(EditUnitResourcesComponent);
+ component = fixture.componentInstance;
+ component.resources = [
+ { name: 'Resource 1', url: 'http://example.com/resource1' },
+ { name: 'Resource 2', url: 'http://example.com/resource2' }
+ ];
+ fixture.detectChanges();
+ });
+
+ it('should show the correct number of resources', () => {
+ const resourceElements = fixture.debugElement.queryAll(By.css('input'));
+ expect(resourceElements.length).toBe(2);
+ expect(resourceElements[0].nativeElement.value).toContain('Resource 1');
+ expect(resourceElements[1].nativeElement.value).toContain('Resource 2');
+ });
+
+ clickTopAddButton_addNewResourceAtTheBeginning();
+ clickBottomTopButton_addNewResourceAtTheEnd();
+});
+
+function clickTopAddButton_addNewResourceAtTheBeginning() {
+ describe('Clicking on the top Add Resource button', () => {
+ let initialLength = 0;
+ beforeEach(() => {
+ initialLength = component.resources.length;
+ fixture.debugElement.queryAll(By.css('button'))[0].nativeElement.click();
+ fixture.detectChanges();
+ });
+ it('should add a new resource to the beginning of the list', () => {
+ expect(component.resources.length).toBe(initialLength + 1);
+ expect(component.resources[0].name).toEqual('');
+ expect(component.resources[0].url).toEqual('');
+ });
+ });
+}
+
+function clickBottomTopButton_addNewResourceAtTheEnd() {
+ describe('Clicking on the bottom Add Resource button', () => {
+ let initialLength = 0;
+ beforeEach(() => {
+ initialLength = component.resources.length;
+ const allButtons = fixture.debugElement.queryAll(By.css('button'));
+ allButtons[allButtons.length - 1].nativeElement.click();
+ fixture.detectChanges();
+ });
+ it('should add a new resource to the end of the list', () => {
+ expect(component.resources.length).toBe(initialLength + 1);
+ expect(component.resources.at(-1).name).toEqual('');
+ expect(component.resources.at(-1).url).toEqual('');
+ });
+ });
+}
diff --git a/src/assets/wise5/authoringTool/edit-unit-resources/edit-unit-resources.component.ts b/src/assets/wise5/authoringTool/edit-unit-resources/edit-unit-resources.component.ts
new file mode 100644
index 00000000000..591514bd67d
--- /dev/null
+++ b/src/assets/wise5/authoringTool/edit-unit-resources/edit-unit-resources.component.ts
@@ -0,0 +1,69 @@
+import { CdkTextareaAutosize } from '@angular/cdk/text-field';
+import { CommonModule } from '@angular/common';
+import { Component, Input } from '@angular/core';
+import { FlexLayoutModule } from '@angular/flex-layout';
+import { FormsModule } from '@angular/forms';
+import { MatButtonModule } from '@angular/material/button';
+import { MatCardModule } from '@angular/material/card';
+import { MatFormFieldModule } from '@angular/material/form-field';
+import { MatIconModule } from '@angular/material/icon';
+import { MatInputModule } from '@angular/material/input';
+import { MatTooltipModule } from '@angular/material/tooltip';
+import { TeacherProjectService } from '../../services/teacherProjectService';
+
+class UnitResource {
+ name: string;
+ url: string;
+ constructor(name: string, url: string) {
+ this.name = name;
+ this.url = url;
+ }
+}
+
+@Component({
+ imports: [
+ CommonModule,
+ CdkTextareaAutosize,
+ FlexLayoutModule,
+ FormsModule,
+ MatCardModule,
+ MatInputModule,
+ MatFormFieldModule,
+ MatButtonModule,
+ MatIconModule,
+ MatTooltipModule
+ ],
+ selector: 'edit-unit-resources',
+ styleUrl: './edit-unit-resources.component.scss',
+ templateUrl: './edit-unit-resources.component.html'
+})
+export class EditUnitResourcesComponent {
+ @Input() resources: UnitResource[] = [];
+
+ constructor(private projectService: TeacherProjectService) {}
+
+ protected addNewResource(addToTop: boolean): void {
+ const location = addToTop ? 0 : this.resources.length;
+ this.resources.splice(location, 0, new UnitResource('', ''));
+ this.projectService.saveProject();
+ if (!addToTop) {
+ this.scrollToBottomOfList();
+ }
+ }
+
+ private scrollToBottomOfList(): void {
+ setTimeout(() => {
+ const button = document.getElementById('add-new-resource-bottom-button');
+ if (button) {
+ button.scrollIntoView();
+ }
+ }, 0);
+ }
+
+ protected deleteResource(resourceIndex: number): void {
+ if (confirm($localize`Are you sure you want to delete this resource?`)) {
+ this.resources.splice(resourceIndex, 1);
+ this.projectService.saveProject();
+ }
+ }
+}
diff --git a/src/assets/wise5/authoringTool/project-info-authoring/project-info-authoring.component.html b/src/assets/wise5/authoringTool/project-info-authoring/project-info-authoring.component.html
index f49ce39b7ff..274b0707193 100644
--- a/src/assets/wise5/authoringTool/project-info-authoring/project-info-authoring.component.html
+++ b/src/assets/wise5/authoringTool/project-info-authoring/project-info-authoring.component.html
@@ -85,3 +85,4 @@
+
diff --git a/src/assets/wise5/authoringTool/project-info-authoring/project-info-authoring.component.spec.ts b/src/assets/wise5/authoringTool/project-info-authoring/project-info-authoring.component.spec.ts
index 9ff473921e5..b720f857542 100644
--- a/src/assets/wise5/authoringTool/project-info-authoring/project-info-authoring.component.spec.ts
+++ b/src/assets/wise5/authoringTool/project-info-authoring/project-info-authoring.component.spec.ts
@@ -1,11 +1,11 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ProjectInfoAuthoringComponent } from './project-info-authoring.component';
import { provideHttpClientTesting } from '@angular/common/http/testing';
-import { MatDialogModule } from '@angular/material/dialog';
import { TeacherProjectService } from '../../services/teacherProjectService';
import { StudentTeacherCommonServicesModule } from '../../../../app/student-teacher-common-services.module';
import { ConfigService } from '../../services/configService';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
+import { EditUnitResourcesComponent } from '../edit-unit-resources/edit-unit-resources.component';
describe('ProjectInfoAuthoringComponent', () => {
let component: ProjectInfoAuthoringComponent;
@@ -13,10 +13,14 @@ describe('ProjectInfoAuthoringComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
- declarations: [ProjectInfoAuthoringComponent],
- imports: [MatDialogModule, StudentTeacherCommonServicesModule],
- providers: [TeacherProjectService, provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()]
-}).compileComponents();
+ declarations: [ProjectInfoAuthoringComponent],
+ imports: [EditUnitResourcesComponent, StudentTeacherCommonServicesModule],
+ providers: [
+ TeacherProjectService,
+ provideHttpClient(withInterceptorsFromDi()),
+ provideHttpClientTesting()
+ ]
+ }).compileComponents();
spyOn(TestBed.inject(TeacherProjectService), 'getProjectMetadata').and.returnValue({});
spyOn(TestBed.inject(ConfigService), 'getConfigParam').and.returnValue('{ "fields": [] }');
fixture = TestBed.createComponent(ProjectInfoAuthoringComponent);
diff --git a/src/assets/wise5/authoringTool/project-info-authoring/project-info-authoring.component.ts b/src/assets/wise5/authoringTool/project-info-authoring/project-info-authoring.component.ts
index 7025c50608a..7ffe0ca0f5d 100644
--- a/src/assets/wise5/authoringTool/project-info-authoring/project-info-authoring.component.ts
+++ b/src/assets/wise5/authoringTool/project-info-authoring/project-info-authoring.component.ts
@@ -6,10 +6,10 @@ import { Subject, debounceTime } from 'rxjs';
import { AssetChooser } from '../project-asset-authoring/asset-chooser';
@Component({
- selector: 'project-info-authoring',
- templateUrl: './project-info-authoring.component.html',
- styleUrls: ['./project-info-authoring.component.scss'],
- standalone: false
+ selector: 'project-info-authoring',
+ templateUrl: './project-info-authoring.component.html',
+ styleUrls: ['./project-info-authoring.component.scss'],
+ standalone: false
})
export class ProjectInfoAuthoringComponent {
isEditingProjectIcon: boolean = false;
@@ -30,6 +30,9 @@ export class ProjectInfoAuthoringComponent {
ngOnInit(): void {
this.metadata = this.projectService.getProjectMetadata();
+ if (this.metadata.resources == null) {
+ this.metadata.resources = [];
+ }
this.metadataAuthoring = JSON.parse(
this.configService.getConfigParam('projectMetadataSettings')
);
diff --git a/src/messages.xlf b/src/messages.xlf
index 7bee4632296..520f6dcbf60 100644
--- a/src/messages.xlf
+++ b/src/messages.xlf
@@ -11125,6 +11125,48 @@ The branches will be removed but the steps will remain in the unit.
161
+
+ Add a new resource
+
+ src/assets/wise5/authoringTool/edit-unit-resources/edit-unit-resources.component.html
+ 5,8
+
+
+
+ Resources
+
+ src/assets/wise5/authoringTool/edit-unit-resources/edit-unit-resources.component.html
+ 15,16
+
+
+
+ Resource Name
+
+ src/assets/wise5/authoringTool/edit-unit-resources/edit-unit-resources.component.html
+ 33,36
+
+
+
+ Resource URL
+
+ src/assets/wise5/authoringTool/edit-unit-resources/edit-unit-resources.component.html
+ 41,44
+
+
+
+ Delete resource
+
+ src/assets/wise5/authoringTool/edit-unit-resources/edit-unit-resources.component.html
+ 55,57
+
+
+
+ Are you sure you want to delete this resource?
+
+ src/assets/wise5/authoringTool/edit-unit-resources/edit-unit-resources.component.ts
+ 64
+
+
Choose the component(s) that you want to import, then select Submit.
From 9cecade3eacdb1a4f7731179e77788f553b05ffb Mon Sep 17 00:00:00 2001
From: Hiroki Terashima
Date: Mon, 31 Mar 2025 16:36:04 -0700
Subject: [PATCH 02/12] Show resource links in the Unit Details view that opens
in a new window
---
.../library-project-details.component.html | 11 ++++++++
.../library-project-details.component.spec.ts | 8 +++++-
src/messages.xlf | 25 ++++++++++++-------
3 files changed, 34 insertions(+), 10 deletions(-)
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 65d00c9e538..0aee7628eda 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
@@ -90,6 +90,17 @@
}
}
+ @if (project.metadata.resources?.length > 0) {
+
+ Resources:
+ @for (resource of project.metadata.resources; track resource.name; let last = $last) {
+ {{
+ resource.name
+ }}
+ {{ last ? '' : ' | ' }}
+ }
+
+ }
@if (project.metadata.discourseCategoryURL) {
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 f1a16c0e3e8..20ee74ebc0b 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
@@ -34,7 +34,8 @@ describe('LibraryProjectDetailsComponent', () => {
authors: [
{ id: 10, firstName: 'Spaceman', lastName: 'Spiff', username: 'SpacemanSpiff' },
{ id: 12, firstName: 'Captain', lastName: 'Napalm', username: 'CaptainNapalm' }
- ]
+ ],
+ resources: [{ name: 'Resource 1', uri: 'http://example.com/resource1' }]
};
const ngssObject: any = {
disciplines: [
@@ -90,6 +91,11 @@ describe('LibraryProjectDetailsComponent', () => {
expect(compiled.textContent).toContain('by Spaceman Spiff, Captain Napalm');
});
+ it('should show project resources', () => {
+ const compiled = fixture.debugElement.nativeElement;
+ expect(compiled.textContent).toContain('Resource 1');
+ });
+
it('should show copied project info', () => {
component['project'].metadata.authors = [];
component['parentProject'] = new ParentProject({
diff --git a/src/messages.xlf b/src/messages.xlf
index 520f6dcbf60..9a0a9444de0 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
- 150,151
+ 161,162
src/app/modules/library/official-library/official-library-details.html
@@ -5828,53 +5828,60 @@ Click "Cancel" to keep the invalid JSON open so you can fix it.70,71
+
+ Resources:
+
+ src/app/modules/library/library-project-details/library-project-details.component.html
+ 95,96
+
+
This unit is a copy of (used under CC BY-SA).
src/app/modules/library/library-project-details/library-project-details.component.html
- 104,106
+ 115,117
This unit is a copy of by (used under CC BY-SA).
src/app/modules/library/library-project-details/library-project-details.component.html
- 110,113
+ 121,124
This unit is licensed under CC BY-SA.
src/app/modules/library/library-project-details/library-project-details.component.html
- 121,122
+ 132,133
This unit is licensed under CC BY-SA by .
src/app/modules/library/library-project-details/library-project-details.component.html
- 126,129
+ 137,140
View License
src/app/modules/library/library-project-details/library-project-details.component.html
- 135,139
+ 146,150
More
src/app/modules/library/library-project-details/library-project-details.component.html
- 143,149
+ 154,160
Use with Class
src/app/modules/library/library-project-details/library-project-details.component.html
- 154,158
+ 165,169
src/app/teacher/create-run-dialog/create-run-dialog.component.html
@@ -5885,7 +5892,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
- 159,162
+ 170,173
src/app/teacher/run-menu/run-menu.component.html
From ba3a5e858f17184ef92949f2718ed367db9f627c Mon Sep 17 00:00:00 2001
From: Hiroki Terashima
Date: Tue, 1 Apr 2025 12:15:05 -0700
Subject: [PATCH 03/12] Implemented saving changes to Unit Resources in the AT
info page
---
.../edit-unit-resources.component.ts | 15 +++++++++++++++
src/messages.xlf | 2 +-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/src/assets/wise5/authoringTool/edit-unit-resources/edit-unit-resources.component.ts b/src/assets/wise5/authoringTool/edit-unit-resources/edit-unit-resources.component.ts
index 591514bd67d..6858ac0cc5c 100644
--- a/src/assets/wise5/authoringTool/edit-unit-resources/edit-unit-resources.component.ts
+++ b/src/assets/wise5/authoringTool/edit-unit-resources/edit-unit-resources.component.ts
@@ -10,6 +10,7 @@ import { MatIconModule } from '@angular/material/icon';
import { MatInputModule } from '@angular/material/input';
import { MatTooltipModule } from '@angular/material/tooltip';
import { TeacherProjectService } from '../../services/teacherProjectService';
+import { debounceTime, distinctUntilChanged, Subject, Subscription } from 'rxjs';
class UnitResource {
name: string;
@@ -38,10 +39,24 @@ class UnitResource {
templateUrl: './edit-unit-resources.component.html'
})
export class EditUnitResourcesComponent {
+ protected inputChanged: Subject = new Subject();
@Input() resources: UnitResource[] = [];
+ private subscriptions: Subscription = new Subscription();
constructor(private projectService: TeacherProjectService) {}
+ ngOnInit(): void {
+ this.subscriptions.add(
+ this.inputChanged
+ .pipe(debounceTime(1000), distinctUntilChanged())
+ .subscribe(() => this.projectService.saveProject())
+ );
+ }
+
+ ngOnDestroy(): void {
+ this.subscriptions.unsubscribe();
+ }
+
protected addNewResource(addToTop: boolean): void {
const location = addToTop ? 0 : this.resources.length;
this.resources.splice(location, 0, new UnitResource('', ''));
diff --git a/src/messages.xlf b/src/messages.xlf
index 9a0a9444de0..68e63f785b0 100644
--- a/src/messages.xlf
+++ b/src/messages.xlf
@@ -11171,7 +11171,7 @@ The branches will be removed but the steps will remain in the unit.
Are you sure you want to delete this resource?
src/assets/wise5/authoringTool/edit-unit-resources/edit-unit-resources.component.ts
- 64
+ 79
From 2e21a4de1a69db82e378920ac1be98f23e45a55c Mon Sep 17 00:00:00 2001
From: Hiroki Terashima
Date: Tue, 1 Apr 2025 13:07:11 -0700
Subject: [PATCH 04/12] Hide Use with Classroom and Preview buttons if this is
a Resource Unit
---
.../library-project-details.component.html | 15 +++++--
.../library-project-details.component.spec.ts | 40 +++++++++++++++++--
src/messages.xlf | 6 +--
3 files changed, 50 insertions(+), 11 deletions(-)
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 0aee7628eda..1b81f45ac10 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
@@ -159,14 +159,21 @@
- @if (isTeacher && !isRunProject && project.wiseVersion !== 4) {
+ @if (
+ isTeacher &&
+ !isRunProject &&
+ project.wiseVersion !== 4 &&
+ project.metadata.unitType === 'Classroom'
+ ) {
}
-
+ @if (project.metadata.unitType === 'Classroom') {
+
+ }
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 20ee74ebc0b..7742cc3b70a 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
@@ -6,14 +6,16 @@ import { Project } from '../../../domain/project';
import { NGSSStandards } from '../ngssStandards';
import { ConfigService } from '../../../services/config.service';
import { ParentProject } from '../../../domain/parentProject';
-import { MockProviders } from 'ng-mocks';
+import { MockComponent, MockProviders } from 'ng-mocks';
+import { By } from '@angular/platform-browser';
+import { LibraryProjectMenuComponent } from '../library-project-menu/library-project-menu.component';
+let component: LibraryProjectDetailsComponent;
+let fixture: ComponentFixture;
describe('LibraryProjectDetailsComponent', () => {
- let component: LibraryProjectDetailsComponent;
- let fixture: ComponentFixture;
-
beforeEach(() => {
TestBed.configureTestingModule({
+ declarations: [MockComponent(LibraryProjectMenuComponent)],
imports: [LibraryProjectDetailsComponent],
providers: [
MockProviders(ConfigService, MatDialog, MatDialogRef, UserService),
@@ -30,6 +32,7 @@ describe('LibraryProjectDetailsComponent', () => {
grades: ['7'],
title: 'Photosynthesis & Cellular Respiration',
summary: 'A really great unit.',
+ unitType: 'Classroom',
totalTime: '6-7 hours',
authors: [
{ id: 10, firstName: 'Spaceman', lastName: 'Spiff', username: 'SpacemanSpiff' },
@@ -109,4 +112,33 @@ describe('LibraryProjectDetailsComponent', () => {
const compiled = fixture.debugElement.nativeElement;
expect(compiled.textContent).toContain('is a copy of Photosynthesis');
});
+
+ it('should show use with class and preview buttons', () => {
+ component['isTeacher'] = true;
+ fixture.detectChanges();
+ expect(getButtonWithText('Use with Class')).toBeTruthy();
+ expect(getButtonWithText('Preview')).toBeTruthy();
+ });
+
+ isResourceUnitType_HideButtons();
});
+
+function isResourceUnitType_HideButtons() {
+ describe('is not Resource unit type', () => {
+ beforeEach(() => {
+ component['project'].metadata.unitType = 'Resource';
+ fixture.detectChanges();
+ });
+
+ it('should hide buttons when unit type is Resource', () => {
+ expect(getButtonWithText('Use with Class')).toBeFalsy();
+ expect(getButtonWithText('Preview')).toBeFalsy();
+ });
+ });
+}
+
+function getButtonWithText(text: string) {
+ return fixture.debugElement
+ .queryAll(By.css('button'))
+ .find((el) => el.nativeElement.textContent.includes(text));
+}
diff --git a/src/messages.xlf b/src/messages.xlf
index 68e63f785b0..30aa73b8ad9 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
- 161,162
+ 161,165
src/app/modules/library/official-library/official-library-details.html
@@ -5881,7 +5881,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
- 165,169
+ 170,174
src/app/teacher/create-run-dialog/create-run-dialog.component.html
@@ -5892,7 +5892,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
- 170,173
+ 176,180
src/app/teacher/run-menu/run-menu.component.html
From 3a8b37681a9cf39acbca2a865359f290abe5091d Mon Sep 17 00:00:00 2001
From: Aaron Detre
Date: Tue, 8 Apr 2025 13:59:48 -0700
Subject: [PATCH 05/12] feat(Dialog Guidance): Summary display for teachers
(#2115)
Co-authored-by: Jonathan Lim-Breitbart
---
.../shared/node-info/node-info.component.html | 14 ++
.../shared/node-info/node-info.component.scss | 5 +
.../shared/node-info/node-info.component.ts | 44 +++---
.../components/common/cRater/CRaterRubric.ts | 4 +
.../components/summary/summaryService.ts | 4 +-
.../summary-display.component.html | 2 +-
.../summary-display.component.scss | 4 -
...nce-teacher-summary-display.component.html | 65 +++++++++
...-teacher-summary-display.component.spec.ts | 135 ++++++++++++++++++
...dance-teacher-summary-display.component.ts | 121 ++++++++++++++++
src/messages.xlf | 49 +++++++
11 files changed, 419 insertions(+), 28 deletions(-)
create mode 100644 src/assets/wise5/directives/teacher-summary-display/dialog-guidance-teacher-summary-display.component.html
create mode 100644 src/assets/wise5/directives/teacher-summary-display/dialog-guidance-teacher-summary-display.component.spec.ts
create mode 100644 src/assets/wise5/directives/teacher-summary-display/dialog-guidance-teacher-summary-display.component.ts
diff --git a/src/assets/wise5/classroomMonitor/classroomMonitorComponents/shared/node-info/node-info.component.html b/src/assets/wise5/classroomMonitor/classroomMonitorComponents/shared/node-info/node-info.component.html
index 906d9eac220..5f200e63117 100644
--- a/src/assets/wise5/classroomMonitor/classroomMonitorComponents/shared/node-info/node-info.component.html
+++ b/src/assets/wise5/classroomMonitor/classroomMonitorComponents/shared/node-info/node-info.component.html
@@ -34,6 +34,7 @@
+
+ Student Ideas Detected
+
+ src/assets/wise5/directives/teacher-summary-display/dialog-guidance-teacher-summary-display.component.html
+ 10,12
+
+
+
+ Most Common:
+
+ src/assets/wise5/directives/teacher-summary-display/dialog-guidance-teacher-summary-display.component.html
+ 17,19
+
+
+
+ Least Common:
+
+ src/assets/wise5/directives/teacher-summary-display/dialog-guidance-teacher-summary-display.component.html
+ 30,32
+
+
+
+ All Ideas:
+
+ src/assets/wise5/directives/teacher-summary-display/dialog-guidance-teacher-summary-display.component.html
+ 44,46
+
+
+
+ Hide all ideas
+
+ src/assets/wise5/directives/teacher-summary-display/dialog-guidance-teacher-summary-display.component.html
+ 55,57
+
+
+
+ Show all ideas
+
+ src/assets/wise5/directives/teacher-summary-display/dialog-guidance-teacher-summary-display.component.html
+ 57,61
+
+
+
+ Your students' ideas will show up here as they are detected in the dialog.
+
+ src/assets/wise5/directives/teacher-summary-display/dialog-guidance-teacher-summary-display.component.html
+ 61,66
+
+
The student will see a graph of their individual data here.
From 4a928d80c620c4734180e1105d29ea25320cc5e9 Mon Sep 17 00:00:00 2001
From: Hiroki Terashima
Date: Tue, 8 Apr 2025 15:50:38 -0700
Subject: [PATCH 06/12] fix(Session): Make renewSession requests on mouse move
#2134
---
src/assets/wise5/vle/vle.component.ts | 43 +++++++++++++++------------
1 file changed, 24 insertions(+), 19 deletions(-)
diff --git a/src/assets/wise5/vle/vle.component.ts b/src/assets/wise5/vle/vle.component.ts
index 300fe87b682..5203691f433 100644
--- a/src/assets/wise5/vle/vle.component.ts
+++ b/src/assets/wise5/vle/vle.component.ts
@@ -32,25 +32,25 @@ import { NavigationComponent } from '../themes/default/navigation/navigation.com
import { ChooseBranchPathDialogComponent } from '../../../app/preview/modules/choose-branch-path-dialog/choose-branch-path-dialog.component';
@Component({
- imports: [
- CommonModule,
- ChooseBranchPathDialogComponent,
- GroupTabsComponent,
- MatSidenavModule,
- NavigationComponent,
- NodeComponent,
- NodeNavigationComponent,
- NotebookLauncherComponent,
- NotebookNotesComponent,
- NotebookReportComponent,
- RunEndedAndLockedMessageComponent,
- SafeUrl,
- StepToolsComponent,
- TopBarComponent
- ],
- selector: 'vle',
- styleUrl: './vle.component.scss',
- templateUrl: './vle.component.html'
+ imports: [
+ CommonModule,
+ ChooseBranchPathDialogComponent,
+ GroupTabsComponent,
+ MatSidenavModule,
+ NavigationComponent,
+ NodeComponent,
+ NodeNavigationComponent,
+ NotebookLauncherComponent,
+ NotebookNotesComponent,
+ NotebookReportComponent,
+ RunEndedAndLockedMessageComponent,
+ SafeUrl,
+ StepToolsComponent,
+ TopBarComponent
+ ],
+ selector: 'vle',
+ styleUrl: './vle.component.scss',
+ templateUrl: './vle.component.html'
})
export class VLEComponent implements AfterViewInit {
protected currentNode: Node;
@@ -303,6 +303,11 @@ export class VLEComponent implements AfterViewInit {
document.querySelector('.top').scrollIntoView();
}
+ @HostListener('document:mousemove')
+ protected renewSession(): void {
+ this.sessionService.mouseMoved();
+ }
+
/**
* Returns WISE API
*/
From 8376c35c47142fdd2bd047ffe876b4b8cbd5c135 Mon Sep 17 00:00:00 2001
From: Aaron Detre
Date: Tue, 8 Apr 2025 19:01:49 -0700
Subject: [PATCH 07/12] feat(OpenResponse): Allow authors to specify
student-friendly text for ideas (#2130)
---
.../components/common/cRater/CRaterIdea.ts | 8 ++-
...it-crater-idea-descriptions.component.html | 6 +-
...edit-crater-idea-descriptions.component.ts | 11 ++--
...edit-dialog-guidance-advanced.component.ts | 6 +-
...edit-open-response-advanced.component.html | 11 ++++
.../edit-open-response-advanced.component.ts | 35 +++++++----
src/messages.xlf | 59 +++++++++++--------
7 files changed, 88 insertions(+), 48 deletions(-)
diff --git a/src/assets/wise5/components/common/cRater/CRaterIdea.ts b/src/assets/wise5/components/common/cRater/CRaterIdea.ts
index a170da13909..4470bb9409c 100644
--- a/src/assets/wise5/components/common/cRater/CRaterIdea.ts
+++ b/src/assets/wise5/components/common/cRater/CRaterIdea.ts
@@ -1,11 +1,13 @@
export class CRaterIdea {
name: string;
- detected: boolean;
+ detected?: boolean;
characterOffsets: any[];
text?: string;
- constructor(name: string, detected: boolean) {
+ constructor(name: string, detected?: boolean) {
this.name = name;
- this.detected = detected;
+ if (detected) {
+ this.detected = detected;
+ }
}
}
diff --git a/src/assets/wise5/components/common/cRater/edit-crater-idea-descriptions/edit-crater-idea-descriptions.component.html b/src/assets/wise5/components/common/cRater/edit-crater-idea-descriptions/edit-crater-idea-descriptions.component.html
index d2144dc60b7..593579fee57 100644
--- a/src/assets/wise5/components/common/cRater/edit-crater-idea-descriptions/edit-crater-idea-descriptions.component.html
+++ b/src/assets/wise5/components/common/cRater/edit-crater-idea-descriptions/edit-crater-idea-descriptions.component.html
@@ -1,10 +1,10 @@
- Idea Names
+ Idea Descriptions
+
}
@if (isNotebookEnabled) {
diff --git a/src/assets/wise5/components/openResponse/edit-open-response-advanced/edit-open-response-advanced.component.ts b/src/assets/wise5/components/openResponse/edit-open-response-advanced/edit-open-response-advanced.component.ts
index d374a55365a..d4566fd93b3 100644
--- a/src/assets/wise5/components/openResponse/edit-open-response-advanced/edit-open-response-advanced.component.ts
+++ b/src/assets/wise5/components/openResponse/edit-open-response-advanced/edit-open-response-advanced.component.ts
@@ -14,19 +14,20 @@ import { TeacherProjectService } from '../../../services/teacherProjectService';
templateUrl: 'edit-open-response-advanced.component.html'
})
export class EditOpenResponseAdvancedComponent extends EditAdvancedComponentComponent {
- allowedConnectedComponentTypes = ['OpenResponse'];
+ protected allowedConnectedComponentTypes = ['OpenResponse'];
componentContent: OpenResponseContent;
- cRaterItemIdIsValid: boolean = null;
- initialFeedbackRules = [
+ protected cRaterItemIdIsValid: boolean = null;
+ private initialFeedbackRules = [
{
id: 'isDefault',
expression: 'isDefault',
feedback: [$localize`Default feedback`]
}
];
- isVerifyingCRaterItemId: boolean = false;
- nodeIds: string[] = [];
- useCustomCompletionCriteria: boolean = false;
+ protected isVerifyingCRaterItemId: boolean;
+ protected nodeIds: string[] = [];
+ useCustomCompletionCriteria: boolean;
+ protected showIdeaDescriptions = true;
constructor(
protected cRaterService: CRaterService,
@@ -45,11 +46,18 @@ export class EditOpenResponseAdvancedComponent extends EditAdvancedComponentComp
this.nodeIds = this.teacherProjectService.getFlattenedProjectAsNodeIds();
}
+ private createCRaterAndRubricIfNull() {
+ if (this.componentContent.cRater == null) {
+ this.componentContent.cRater = this.createCRaterObject();
+ }
+ if (!this.componentContent.cRater.rubric) {
+ this.componentContent.cRater.rubric = { ideas: [] };
+ }
+ }
+
enableCRaterClicked(): void {
if (this.componentContent.enableCRater) {
- if (this.componentContent.cRater == null) {
- this.componentContent.cRater = this.createCRaterObject();
- }
+ this.createCRaterAndRubricIfNull();
this.setShowSubmitButtonValue(true);
} else {
this.setShowSubmitButtonValue(false);
@@ -70,7 +78,10 @@ export class EditOpenResponseAdvancedComponent extends EditAdvancedComponentComp
rules: this.initialFeedbackRules
},
enableMultipleAttemptScoringRules: false,
- multipleAttemptScoringRules: []
+ multipleAttemptScoringRules: [],
+ rubric: {
+ ideas: []
+ }
};
}
@@ -261,6 +272,10 @@ export class EditOpenResponseAdvancedComponent extends EditAdvancedComponentComp
}
}
+ protected toggleShowIdeaDescriptions(): void {
+ this.showIdeaDescriptions = !this.showIdeaDescriptions;
+ }
+
getComponents(nodeId: string): ComponentContent[] {
return this.teacherProjectService.getComponents(nodeId);
}
diff --git a/src/messages.xlf b/src/messages.xlf
index 28e3d561108..97441de1d97 100644
--- a/src/messages.xlf
+++ b/src/messages.xlf
@@ -16457,19 +16457,23 @@ Are you ready to receive feedback on this answer?
285
-
- Idea Names
+
+ Idea Descriptions
src/assets/wise5/components/common/cRater/edit-crater-idea-descriptions/edit-crater-idea-descriptions.component.html
3,7
-
- Add a new idea name
+
+ Add a new idea description
src/assets/wise5/components/common/cRater/edit-crater-idea-descriptions/edit-crater-idea-descriptions.component.html
7,10
+
+ src/assets/wise5/components/common/cRater/edit-crater-idea-descriptions/edit-crater-idea-descriptions.component.html
+ 68,71
+
Idea ID
@@ -16478,8 +16482,8 @@ Are you ready to receive feedback on this answer?
30,33
-
- User-Friendly Name
+
+ User-Friendly Description
src/assets/wise5/components/common/cRater/edit-crater-idea-descriptions/edit-crater-idea-descriptions.component.html
38,41
@@ -16492,18 +16496,11 @@ Are you ready to receive feedback on this answer?
52,54
-
- Add a new idea description
-
- src/assets/wise5/components/common/cRater/edit-crater-idea-descriptions/edit-crater-idea-descriptions.component.html
- 68,71
-
-
-
- Are you sure you want to delete this idea name?
+
+ Are you sure you want to delete this idea description?
src/assets/wise5/components/common/cRater/edit-crater-idea-descriptions/edit-crater-idea-descriptions.component.ts
- 87
+ 88
@@ -19954,6 +19951,20 @@ Warning: This will delete all existing choices in this component.
572,575
+
+ Hide
+
+ src/assets/wise5/components/openResponse/edit-open-response-advanced/edit-open-response-advanced.component.html
+ 590,591
+
+
+
+ Show Idea Descriptions
+
+ src/assets/wise5/components/openResponse/edit-open-response-advanced/edit-open-response-advanced.component.html
+ 591,596
+
+
Default feedback
@@ -19969,7 +19980,7 @@ Score:
Feedback Text:
src/assets/wise5/components/openResponse/edit-open-response-advanced/edit-open-response-advanced.component.ts
- 96
+ 107
@@ -19982,28 +19993,28 @@ Current Score:
Feedback Text:
src/assets/wise5/components/openResponse/edit-open-response-advanced/edit-open-response-advanced.component.ts
- 144
+ 155
you got a score of
src/assets/wise5/components/openResponse/edit-open-response-advanced/edit-open-response-advanced.component.ts
- 174
+ 185
Please talk to your teacher
src/assets/wise5/components/openResponse/edit-open-response-advanced/edit-open-response-advanced.component.ts
- 176
+ 187
got a score of
src/assets/wise5/components/openResponse/edit-open-response-advanced/edit-open-response-advanced.component.ts
- 178
+ 189
@@ -20014,21 +20025,21 @@ Previous Score:
Current Score:
src/assets/wise5/components/openResponse/edit-open-response-advanced/edit-open-response-advanced.component.ts
- 192
+ 203
Are you sure you want to delete the custom completion criteria?
src/assets/wise5/components/openResponse/edit-open-response-advanced/edit-open-response-advanced.component.ts
- 226
+ 237
Are you sure you want to delete this completion criteria?
src/assets/wise5/components/openResponse/edit-open-response-advanced/edit-open-response-advanced.component.ts
- 258
+ 269
From 6a9ce28dc57e77b8af3799ceba8a141020daf6df Mon Sep 17 00:00:00 2001
From: Hiroki Terashima
Date: Wed, 9 Apr 2025 02:04:01 -0700
Subject: [PATCH 08/12] fix(Session): Check sessionActive before saving
NodeExitEvent.
This was causing AccessDeniedException to be thrown every time the student clicked on the LogOut button.
---
src/assets/wise5/services/sessionService.ts | 11 ++++++++++-
src/assets/wise5/vle/vle.component.ts | 4 +++-
src/messages.xlf | 4 ++--
3 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/src/assets/wise5/services/sessionService.ts b/src/assets/wise5/services/sessionService.ts
index bc2986f4003..403e17c1b0a 100644
--- a/src/assets/wise5/services/sessionService.ts
+++ b/src/assets/wise5/services/sessionService.ts
@@ -19,8 +19,12 @@ export class SessionService {
public showSessionWarning$: Observable = this.showSessionWarningSource.asObservable();
private logOutSource: Subject = new Subject();
public logOut$ = this.logOutSource.asObservable();
+ private sessionActive: boolean = true;
- constructor(protected http: HttpClient, protected configService: ConfigService) {}
+ constructor(
+ protected http: HttpClient,
+ protected configService: ConfigService
+ ) {}
calculateIntervals(sessionTimeout: number): any {
const forceLogoutAfterWarningInterval: number = Math.min(
@@ -52,10 +56,15 @@ export class SessionService {
logOut() {
this.broadcastExit();
this.http.get(this.configService.getSessionLogOutURL()).subscribe(() => {
+ this.sessionActive = false;
window.location.href = '/';
});
}
+ isSessionActive(): boolean {
+ return this.sessionActive;
+ }
+
initializeSession() {
const intervals: any = this.calculateIntervals(
this.configService.getConfigParam('sessionTimeout')
diff --git a/src/assets/wise5/vle/vle.component.ts b/src/assets/wise5/vle/vle.component.ts
index 5203691f433..7ffe041be31 100644
--- a/src/assets/wise5/vle/vle.component.ts
+++ b/src/assets/wise5/vle/vle.component.ts
@@ -88,7 +88,9 @@ export class VLEComponent implements AfterViewInit {
@HostListener('window:beforeunload')
beforeUnload(): void {
- this.saveNodeExitedEvent();
+ if (this.sessionService.isSessionActive()) {
+ this.saveNodeExitedEvent();
+ }
}
ngAfterViewInit(): void {
diff --git a/src/messages.xlf b/src/messages.xlf
index 97441de1d97..ce55aba5523 100644
--- a/src/messages.xlf
+++ b/src/messages.xlf
@@ -10201,7 +10201,7 @@ Click "Cancel" to keep the invalid JSON open so you can fix it.
src/assets/wise5/vle/vle.component.ts
- 195
+ 197
@@ -10216,7 +10216,7 @@ Click "Cancel" to keep the invalid JSON open so you can fix it.
src/assets/wise5/vle/vle.component.ts
- 196
+ 198
From 36f3d606ad6b93fe5f71287a851f1358ddd08f3f Mon Sep 17 00:00:00 2001
From: Hiroki Terashima
Date: Thu, 10 Apr 2025 15:12:03 -0700
Subject: [PATCH 09/12] fix(Session): Expired students posting event on exit
When the student has been idle for a long time, the session expires. When the VLE is closed, it tries to save a NodeExited event, which throws an AccessDenied exception on the server. This fix prevents this specific case from happening.
---
src/assets/wise5/services/sessionService.ts | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/assets/wise5/services/sessionService.ts b/src/assets/wise5/services/sessionService.ts
index 403e17c1b0a..c009b4dcfeb 100644
--- a/src/assets/wise5/services/sessionService.ts
+++ b/src/assets/wise5/services/sessionService.ts
@@ -109,9 +109,10 @@ export class SessionService {
}
}
- checkForLogout() {
+ checkForLogout(): void {
if (this.isInactiveLongEnoughToForceLogout()) {
this.checkIfSessionIsActive().subscribe((isSessionActive) => {
+ this.sessionActive = isSessionActive;
if (!isSessionActive) {
this.forceLogOut();
}
From 89cec6dd028a444e1f6e60871eedb7ca71f0c264 Mon Sep 17 00:00:00 2001
From: Hiroki Terashima
Date: Mon, 14 Apr 2025 09:05:26 -0700
Subject: [PATCH 10/12] Rename unitType from "Classroom" to "Platform"
---
.../library-project-details.component.html | 4 ++--
.../library-project-details.component.spec.ts | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
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 1b81f45ac10..99befdd7142 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
@@ -163,7 +163,7 @@
isTeacher &&
!isRunProject &&
project.wiseVersion !== 4 &&
- project.metadata.unitType === 'Classroom'
+ project.metadata.unitType === 'Platform'
) {
}
- @if (project.metadata.unitType === 'Classroom') {
+ @if (project.metadata.unitType === 'Platform') {
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 7742cc3b70a..d26737c1f73 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
@@ -32,7 +32,7 @@ describe('LibraryProjectDetailsComponent', () => {
grades: ['7'],
title: 'Photosynthesis & Cellular Respiration',
summary: 'A really great unit.',
- unitType: 'Classroom',
+ unitType: 'Platform',
totalTime: '6-7 hours',
authors: [
{ id: 10, firstName: 'Spaceman', lastName: 'Spiff', username: 'SpacemanSpiff' },
From dca33405dc8a4ff83a77099e609723f40fd5d401 Mon Sep 17 00:00:00 2001
From: Hiroki Terashima
Date: Mon, 14 Apr 2025 11:07:50 -0700
Subject: [PATCH 11/12] Add EditUnitTypeComponent to allow authors to choose
between 'Platform' and 'Other'
---
src/app/teacher/authoring-tool.module.ts | 2 +
.../edit-unit-type.component.html | 10 ++++
.../edit-unit-type.component.spec.ts | 48 +++++++++++++++++++
.../edit-unit-type.component.ts | 19 ++++++++
.../project-info-authoring.component.html | 1 +
.../project-info-authoring.component.spec.ts | 7 ++-
src/messages.xlf | 21 ++++++++
7 files changed, 107 insertions(+), 1 deletion(-)
create mode 100644 src/assets/wise5/authoringTool/edit-unit-type/edit-unit-type.component.html
create mode 100644 src/assets/wise5/authoringTool/edit-unit-type/edit-unit-type.component.spec.ts
create mode 100644 src/assets/wise5/authoringTool/edit-unit-type/edit-unit-type.component.ts
diff --git a/src/app/teacher/authoring-tool.module.ts b/src/app/teacher/authoring-tool.module.ts
index 4866c1a9bc4..32f1f2ba86f 100644
--- a/src/app/teacher/authoring-tool.module.ts
+++ b/src/app/teacher/authoring-tool.module.ts
@@ -62,6 +62,7 @@ import { SideMenuComponent } from '../../assets/wise5/common/side-menu/side-menu
import { MainMenuComponent } from '../../assets/wise5/common/main-menu/main-menu.component';
import { ChooseImportComponentComponent } from '../../assets/wise5/authoringTool/importComponent/choose-import-component/choose-import-component.component';
import { EditUnitResourcesComponent } from '../../assets/wise5/authoringTool/edit-unit-resources/edit-unit-resources.component';
+import { EditUnitTypeComponent } from '../../assets/wise5/authoringTool/edit-unit-type/edit-unit-type.component';
@NgModule({
declarations: [
@@ -108,6 +109,7 @@ import { EditUnitResourcesComponent } from '../../assets/wise5/authoringTool/edi
EditBranchComponent,
EditNodeTitleComponent,
EditUnitResourcesComponent,
+ EditUnitTypeComponent,
MatBadgeModule,
MatChipsModule,
MatExpansionModule,
diff --git a/src/assets/wise5/authoringTool/edit-unit-type/edit-unit-type.component.html b/src/assets/wise5/authoringTool/edit-unit-type/edit-unit-type.component.html
new file mode 100644
index 00000000000..45f67ad4947
--- /dev/null
+++ b/src/assets/wise5/authoringTool/edit-unit-type/edit-unit-type.component.html
@@ -0,0 +1,10 @@
+Unit Type
+
+ WISE Platform (Uses features on this platform to collect student data)
+ Other Platform (Contains activities and resources for teachers and does not collect student
+ data)
+
diff --git a/src/assets/wise5/authoringTool/edit-unit-type/edit-unit-type.component.spec.ts b/src/assets/wise5/authoringTool/edit-unit-type/edit-unit-type.component.spec.ts
new file mode 100644
index 00000000000..131e89aaa89
--- /dev/null
+++ b/src/assets/wise5/authoringTool/edit-unit-type/edit-unit-type.component.spec.ts
@@ -0,0 +1,48 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+import { EditUnitTypeComponent } from './edit-unit-type.component';
+import { HarnessLoader } from '@angular/cdk/testing';
+import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
+import { MatRadioButtonHarness, MatRadioGroupHarness } from '@angular/material/radio/testing';
+import { MockProvider } from 'ng-mocks';
+import { TeacherProjectService } from '../../services/teacherProjectService';
+
+describe('EditUnitTypeComponent', () => {
+ let component: EditUnitTypeComponent;
+ let fixture: ComponentFixture;
+ let loader: HarnessLoader;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ imports: [EditUnitTypeComponent],
+ providers: [MockProvider(TeacherProjectService)]
+ }).compileComponents();
+
+ fixture = TestBed.createComponent(EditUnitTypeComponent);
+ component = fixture.componentInstance;
+ component.metadata = { unitType: 'Platform' };
+ fixture.detectChanges();
+ loader = TestbedHarnessEnvironment.loader(fixture);
+ });
+
+ it('should show options and select unit type', async () => {
+ const groups = await loader.getAllHarnesses(MatRadioGroupHarness);
+ expect(groups.length).toBe(1);
+ expect(await groups[0].getName()).toBe('unitTypes');
+ const [firstRadio, secondRadio] = await loader.getAllHarnesses(MatRadioButtonHarness);
+ expect(await firstRadio.getLabelText()).toContain('Platform');
+ expect(await secondRadio.getLabelText()).toContain('Other Platform');
+ expect(await firstRadio.isChecked()).toBeTrue();
+ });
+
+ it('should check radio button and trigger a save', async () => {
+ const buttons = await loader.getAllHarnesses(MatRadioButtonHarness);
+ const spy = spyOn(TestBed.inject(TeacherProjectService), 'saveProject').and.callFake(
+ () => new Promise((resolve) => resolve(true))
+ );
+ await buttons[1].check();
+ expect(await buttons[1].isChecked()).toBeTrue();
+ expect(await buttons[0].isChecked()).toBeFalse();
+ await fixture.whenStable();
+ expect(spy).toHaveBeenCalled();
+ });
+});
diff --git a/src/assets/wise5/authoringTool/edit-unit-type/edit-unit-type.component.ts b/src/assets/wise5/authoringTool/edit-unit-type/edit-unit-type.component.ts
new file mode 100644
index 00000000000..e37586b592b
--- /dev/null
+++ b/src/assets/wise5/authoringTool/edit-unit-type/edit-unit-type.component.ts
@@ -0,0 +1,19 @@
+import { Component, Input } from '@angular/core';
+import { FormsModule } from '@angular/forms';
+import { MatRadioModule } from '@angular/material/radio';
+import { TeacherProjectService } from '../../services/teacherProjectService';
+
+@Component({
+ imports: [FormsModule, MatRadioModule],
+ selector: 'edit-unit-type',
+ templateUrl: './edit-unit-type.component.html'
+})
+export class EditUnitTypeComponent {
+ @Input() metadata: any;
+
+ constructor(private projectService: TeacherProjectService) {}
+
+ protected saveProject(): void {
+ this.projectService.saveProject();
+ }
+}
diff --git a/src/assets/wise5/authoringTool/project-info-authoring/project-info-authoring.component.html b/src/assets/wise5/authoringTool/project-info-authoring/project-info-authoring.component.html
index 274b0707193..8142226e355 100644
--- a/src/assets/wise5/authoringTool/project-info-authoring/project-info-authoring.component.html
+++ b/src/assets/wise5/authoringTool/project-info-authoring/project-info-authoring.component.html
@@ -85,4 +85,5 @@
+
diff --git a/src/assets/wise5/authoringTool/project-info-authoring/project-info-authoring.component.spec.ts b/src/assets/wise5/authoringTool/project-info-authoring/project-info-authoring.component.spec.ts
index b720f857542..82d8d58cb80 100644
--- a/src/assets/wise5/authoringTool/project-info-authoring/project-info-authoring.component.spec.ts
+++ b/src/assets/wise5/authoringTool/project-info-authoring/project-info-authoring.component.spec.ts
@@ -6,6 +6,7 @@ import { StudentTeacherCommonServicesModule } from '../../../../app/student-teac
import { ConfigService } from '../../services/configService';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { EditUnitResourcesComponent } from '../edit-unit-resources/edit-unit-resources.component';
+import { EditUnitTypeComponent } from '../edit-unit-type/edit-unit-type.component';
describe('ProjectInfoAuthoringComponent', () => {
let component: ProjectInfoAuthoringComponent;
@@ -14,7 +15,11 @@ describe('ProjectInfoAuthoringComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ProjectInfoAuthoringComponent],
- imports: [EditUnitResourcesComponent, StudentTeacherCommonServicesModule],
+ imports: [
+ EditUnitResourcesComponent,
+ EditUnitTypeComponent,
+ StudentTeacherCommonServicesModule
+ ],
providers: [
TeacherProjectService,
provideHttpClient(withInterceptorsFromDi()),
diff --git a/src/messages.xlf b/src/messages.xlf
index e902df306ff..f61bb6cb5b7 100644
--- a/src/messages.xlf
+++ b/src/messages.xlf
@@ -11174,6 +11174,27 @@ The branches will be removed but the steps will remain in the unit.
79
+
+ Unit Type
+
+ src/assets/wise5/authoringTool/edit-unit-type/edit-unit-type.component.html
+ 1,2
+
+
+
+ WISE Platform (Uses features on this platform to collect student data)
+
+ src/assets/wise5/authoringTool/edit-unit-type/edit-unit-type.component.html
+ 4,7
+
+
+
+ Other Platform (Contains activities and resources for teachers and does not collect student data)
+
+ src/assets/wise5/authoringTool/edit-unit-type/edit-unit-type.component.html
+ 7,11
+
+
Choose the component(s) that you want to import, then select Submit.
From bb10fe992e8ec0bd9148c9db0e370b2ec4bd9b6d Mon Sep 17 00:00:00 2001
From: Hiroki Terashima
Date: Mon, 14 Apr 2025 11:24:57 -0700
Subject: [PATCH 12/12] Set unitType default to Platform for existing and new
units
---
.../authoringTool/new-project-template.ts | 4 +-
.../project-info-authoring.component.ts | 3 ++
src/messages.xlf | 44 +++++++++----------
3 files changed, 28 insertions(+), 23 deletions(-)
diff --git a/src/assets/wise5/authoringTool/new-project-template.ts b/src/assets/wise5/authoringTool/new-project-template.ts
index 46ddd10071b..ca539786fc4 100644
--- a/src/assets/wise5/authoringTool/new-project-template.ts
+++ b/src/assets/wise5/authoringTool/new-project-template.ts
@@ -46,7 +46,9 @@ export const newProjectTemplate = {
template: 'starmap|leftNav|rightNav'
},
metadata: {
- title: ''
+ title: '',
+ resources: [],
+ unitType: 'Platform'
},
notebook: {
enabled: false,
diff --git a/src/assets/wise5/authoringTool/project-info-authoring/project-info-authoring.component.ts b/src/assets/wise5/authoringTool/project-info-authoring/project-info-authoring.component.ts
index 7ffe0ca0f5d..1f2e49091da 100644
--- a/src/assets/wise5/authoringTool/project-info-authoring/project-info-authoring.component.ts
+++ b/src/assets/wise5/authoringTool/project-info-authoring/project-info-authoring.component.ts
@@ -33,6 +33,9 @@ export class ProjectInfoAuthoringComponent {
if (this.metadata.resources == null) {
this.metadata.resources = [];
}
+ if (this.metadata.unitType == null) {
+ this.metadata.unitType = 'Platform';
+ }
this.metadataAuthoring = JSON.parse(
this.configService.getConfigParam('projectMetadataSettings')
);
diff --git a/src/messages.xlf b/src/messages.xlf
index f61bb6cb5b7..a5894a92419 100644
--- a/src/messages.xlf
+++ b/src/messages.xlf
@@ -11423,7 +11423,7 @@ The branches will be removed but the steps will remain in the unit.
src/assets/wise5/authoringTool/new-project-template.ts
- 77
+ 79
src/assets/wise5/classroomMonitor/classroomMonitorComponents/nodeGrading/node-grading-view/node-grading-view.component.html
@@ -11706,7 +11706,7 @@ The branches will be removed but the steps will remain in the unit.
Notebook
src/assets/wise5/authoringTool/new-project-template.ts
- 53
+ 55
src/assets/wise5/services/notebookService.ts
@@ -11717,11 +11717,11 @@ The branches will be removed but the steps will remain in the unit.
note
src/assets/wise5/authoringTool/new-project-template.ts
- 65
+ 67
src/assets/wise5/authoringTool/new-project-template.ts
- 107
+ 109
src/assets/wise5/services/notebookService.ts
@@ -11732,11 +11732,11 @@ The branches will be removed but the steps will remain in the unit.
notes
src/assets/wise5/authoringTool/new-project-template.ts
- 66
+ 68
src/assets/wise5/authoringTool/new-project-template.ts
- 108
+ 110
src/assets/wise5/services/notebookService.ts
@@ -11747,11 +11747,11 @@ The branches will be removed but the steps will remain in the unit.
Notes
src/assets/wise5/authoringTool/new-project-template.ts
- 67
+ 69
src/assets/wise5/authoringTool/new-project-template.ts
- 109
+ 111
src/assets/wise5/classroomMonitor/classroomMonitorComponents/notebook/notebook-workgroup-grading/notebook-workgroup-grading.component.html
@@ -11770,7 +11770,7 @@ The branches will be removed but the steps will remain in the unit.
report
src/assets/wise5/authoringTool/new-project-template.ts
- 75
+ 77
src/assets/wise5/services/notebookService.ts
@@ -11781,7 +11781,7 @@ The branches will be removed but the steps will remain in the unit.
reports
src/assets/wise5/authoringTool/new-project-template.ts
- 76
+ 78
src/assets/wise5/services/notebookService.ts
@@ -11792,78 +11792,78 @@ The branches will be removed but the steps will remain in the unit.
Final Report
src/assets/wise5/authoringTool/new-project-template.ts
- 84
+ 86
Final summary report of what you learned in this unit
src/assets/wise5/authoringTool/new-project-template.ts
- 85
+ 87
Use this space to write your final report using evidence from your notebook.
src/assets/wise5/authoringTool/new-project-template.ts
- 86
+ 88
<h3>This is a heading</h3><p>This is a paragraph.</p>
src/assets/wise5/authoringTool/new-project-template.ts
- 87
+ 89
Teacher Notebook
src/assets/wise5/authoringTool/new-project-template.ts
- 95
+ 97
teacher notes
src/assets/wise5/authoringTool/new-project-template.ts
- 117
+ 119
src/assets/wise5/authoringTool/new-project-template.ts
- 118
+ 120
Teacher Notes
src/assets/wise5/authoringTool/new-project-template.ts
- 119
+ 121
src/assets/wise5/authoringTool/new-project-template.ts
- 126
+ 128
Notes for the teacher as they're running the WISE unit
src/assets/wise5/authoringTool/new-project-template.ts
- 127
+ 129
Use this space to take notes for this unit
src/assets/wise5/authoringTool/new-project-template.ts
- 128
+ 130
<p>Use this space to take notes for this unit</p>
src/assets/wise5/authoringTool/new-project-template.ts
- 129
+ 131