Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { TeacherProjectService } from '../../services/teacherProjectService';
import { MatDialog } from '@angular/material/dialog';
import { DialogWithSpinnerComponent } from '../../directives/dialog-with-spinner/dialog-with-spinner.component';
import { Router } from '@angular/router';
import { copy } from '../../common/object/object';
import { newProjectTemplate } from '../new-project-template';

@Component({
selector: 'add-project',
Expand Down Expand Up @@ -38,7 +40,7 @@ export class AddProjectComponent {
},
disableClose: true
});
const project = this.projectService.getNewProjectTemplate();
const project = copy(newProjectTemplate);
project.metadata.title = this.addProjectFormGroup.controls['title'].value;
const projectJSONString = JSON.stringify(project, null, 4);
this.projectService
Expand Down
136 changes: 136 additions & 0 deletions src/assets/wise5/authoringTool/new-project-template.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
export const newProjectTemplate = {
nodes: [
{
id: 'group0',
type: 'group',
title: 'Master',
startId: 'group1',
ids: ['group1']
},
{
id: 'group1',
type: 'group',
title: $localize`First Lesson`,
startId: 'node1',
ids: ['node1'],
icons: {
default: {
color: '#2196F3',
type: 'font',
fontSet: 'material-icons',
fontName: 'info'
}
},
transitionLogic: {
transitions: []
}
},
{
id: 'node1',
type: 'node',
title: $localize`First Step`,
components: [],
constraints: [],
showSaveButton: false,
showSubmitButton: false,
transitionLogic: {
transitions: []
}
}
],
constraints: [],
startGroupId: 'group0',
startNodeId: 'node1',
navigationMode: 'guided',
layout: {
template: 'starmap|leftNav|rightNav'
},
metadata: {
title: ''
},
notebook: {
enabled: false,
label: $localize`Notebook`,
enableAddNew: true,
itemTypes: {
note: {
type: 'note',
enabled: true,
enableLink: true,
enableAddNote: true,
enableClipping: true,
enableStudentUploads: true,
requireTextOnEveryNote: false,
label: {
singular: $localize`note`,
plural: $localize`notes`,
link: $localize`Notes`,
icon: 'note',
color: '#1565C0'
}
},
report: {
enabled: false,
label: {
singular: $localize`report`,
plural: $localize`reports`,
link: $localize`Report`,
icon: 'assignment',
color: '#AD1457'
},
notes: [
{
reportId: 'finalReport',
title: $localize`Final Report`,
description: $localize`Final summary report of what you learned in this unit`,
prompt: $localize`Use this space to write your final report using evidence from your notebook.`,
content: $localize`<h3>This is a heading</h3><p>This is a paragraph.</p>`
}
]
}
}
},
teacherNotebook: {
enabled: true,
label: $localize`Teacher Notebook`,
enableAddNew: true,
itemTypes: {
note: {
type: 'note',
enabled: false,
enableLink: true,
enableAddNote: true,
enableClipping: true,
enableStudentUploads: true,
requireTextOnEveryNote: false,
label: {
singular: $localize`note`,
plural: $localize`notes`,
link: $localize`Notes`,
icon: 'note',
color: '#1565C0'
}
},
report: {
enabled: true,
label: {
singular: $localize`teacher notes`,
plural: $localize`teacher notes`,
link: $localize`Teacher Notes`,
icon: 'assignment',
color: '#AD1457'
},
notes: [
{
reportId: 'teacherReport',
title: $localize`Teacher Notes`,
description: $localize`Notes for the teacher as they're running the WISE unit`,
prompt: $localize`Use this space to take notes for this unit`,
content: $localize`<p>Use this space to take notes for this unit</p>`
}
]
}
}
},
inactiveNodes: []
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { insertWiseLinks, replaceWiseLinks } from '../../common/wise-link/wise-l
import { ConfigService } from '../../services/configService';
import { TeacherProjectService } from '../../services/teacherProjectService';
import { Subject, debounceTime } from 'rxjs';
import { copy } from '../../common/object/object';
import { newProjectTemplate } from '../new-project-template';

@Component({
selector: 'notebook-authoring',
Expand All @@ -24,12 +26,12 @@ export class NotebookAuthoringComponent {
this.reportIdToAuthoringNote = {};

if (this.project.notebook == null) {
const projectTemplate = this.projectService.getNewProjectTemplate();
const projectTemplate = copy(newProjectTemplate);
this.project.notebook = projectTemplate.notebook;
}

if (this.project.teacherNotebook == null) {
const projectTemplate = this.projectService.getNewProjectTemplate();
const projectTemplate = copy(newProjectTemplate);
projectTemplate.teacherNotebook.enabled = false;
this.project.teacherNotebook = projectTemplate.teacherNotebook;
}
Expand Down
142 changes: 2 additions & 140 deletions src/assets/wise5/services/teacherProjectService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export class TeacherProjectService extends ProjectService {
public errorSavingProject$: Observable<void> = this.errorSavingProjectSource.asObservable();
private nodeTypeSelected: WritableSignal<NodeTypeSelected> = signal(null);
private notAllowedToEditThisProjectSource: Subject<void> = new Subject<void>();
public notAllowedToEditThisProject$: Observable<void> = this.notAllowedToEditThisProjectSource.asObservable();
public notAllowedToEditThisProject$: Observable<void> =
this.notAllowedToEditThisProjectSource.asObservable();
private projectSavedSource: Subject<void> = new Subject<void>();
public projectSaved$: Observable<void> = this.projectSavedSource.asObservable();
private savingProjectSource: Subject<void> = new Subject<void>();
Expand All @@ -44,145 +45,6 @@ export class TeacherProjectService extends ProjectService {
super(branchService, componentServiceLookupService, http, configService, pathService);
}

getNewProjectTemplate() {
return {
nodes: [
{
id: 'group0',
type: 'group',
title: 'Master',
startId: 'group1',
ids: ['group1']
},
{
id: 'group1',
type: 'group',
title: $localize`First Lesson`,
startId: 'node1',
ids: ['node1'],
icons: {
default: {
color: '#2196F3',
type: 'font',
fontSet: 'material-icons',
fontName: 'info'
}
},
transitionLogic: {
transitions: []
}
},
{
id: 'node1',
type: 'node',
title: $localize`First Step`,
components: [],
constraints: [],
showSaveButton: false,
showSubmitButton: false,
transitionLogic: {
transitions: []
}
}
],
constraints: [],
startGroupId: 'group0',
startNodeId: 'node1',
navigationMode: 'guided',
layout: {
template: 'starmap|leftNav|rightNav'
},
metadata: {
title: ''
},
notebook: {
enabled: false,
label: $localize`Notebook`,
enableAddNew: true,
itemTypes: {
note: {
type: 'note',
enabled: true,
enableLink: true,
enableAddNote: true,
enableClipping: true,
enableStudentUploads: true,
requireTextOnEveryNote: false,
label: {
singular: $localize`note`,
plural: $localize`notes`,
link: $localize`Notes`,
icon: 'note',
color: '#1565C0'
}
},
report: {
enabled: false,
label: {
singular: $localize`report`,
plural: $localize`reports`,
link: $localize`Report`,
icon: 'assignment',
color: '#AD1457'
},
notes: [
{
reportId: 'finalReport',
title: $localize`Final Report`,
description: $localize`Final summary report of what you learned in this unit`,
prompt: $localize`Use this space to write your final report using evidence from your notebook.`,
content: $localize`<h3>This is a heading</h3><p>This is a paragraph.</p>`
}
]
}
}
},
teacherNotebook: {
enabled: true,
label: $localize`Teacher Notebook`,
enableAddNew: true,
itemTypes: {
note: {
type: 'note',
enabled: false,
enableLink: true,
enableAddNote: true,
enableClipping: true,
enableStudentUploads: true,
requireTextOnEveryNote: false,
label: {
singular: $localize`note`,
plural: $localize`notes`,
link: $localize`Notes`,
icon: 'note',
color: '#1565C0'
}
},
report: {
enabled: true,
label: {
singular: $localize`teacher notes`,
plural: $localize`teacher notes`,
link: $localize`Teacher Notes`,
icon: 'assignment',
color: '#AD1457'
},
notes: [
{
reportId: 'teacherReport',
title: $localize`Teacher Notes`,
description: $localize`Notes for the teacher as they're running the WISE unit`,
prompt: $localize`Use this space to take notes for this unit`,
content: $localize`<p>Use this space to take notes for this unit</p>`
}
]
}
}
},
inactiveNodes: []
};
}

notifyAuthorProjectBeginEnd(projectId, isBegin) {
return this.http.post(`/api/author/project/notify/${projectId}/${isBegin}`, null).toPromise();
}
Expand Down
Loading