-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
62 changed files
with
916 additions
and
1,840 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
5.20.0 | ||
5.20.1 |
16 changes: 16 additions & 0 deletions
16
...webapp/site/src/app/authoring-tool/edit-component-json/edit-component-json.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<div> | ||
<label class='node__label--vertical-alignment' i18n>JSON</label> | ||
<button mat-button class='topButton mat-raised-button mat-primary' | ||
(click)="toggleJSONView()" | ||
matTooltip="Show JSON" i18n-matTooltip matTooltipPosition="above"> | ||
<mat-icon>code</mat-icon> | ||
</button> | ||
</div> | ||
<div *ngIf="showJSONAuthoring" fxLayout="column" fxLayoutGap="8px"> | ||
<span i18n>Close the JSON view to save the changes</span> | ||
<mat-form-field fxFlex appearance="outline"> | ||
<mat-label i18n>Edit Component JSON</mat-label> | ||
<textarea class="mat-body-1" matInput cdkTextareaAutosize [(ngModel)]="componentContentJSONString" | ||
(ngModelChange)='jsonChanged.next($event)'></textarea> | ||
</mat-form-field> | ||
</div> |
3 changes: 3 additions & 0 deletions
3
...webapp/site/src/app/authoring-tool/edit-component-json/edit-component-json.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
div { | ||
margin-bottom: 10px; | ||
} |
107 changes: 107 additions & 0 deletions
107
...n/webapp/site/src/app/authoring-tool/edit-component-json/edit-component-json.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
import * as angular from 'angular'; | ||
import { Component, Input } from "@angular/core"; | ||
import { UpgradeModule } from "@angular/upgrade/static"; | ||
import { NotificationService } from "../../../../../wise5/services/notificationService"; | ||
import { TeacherProjectService } from '../../../../../wise5/services/teacherProjectService'; | ||
import { Subject, Subscription } from 'rxjs'; | ||
import { debounceTime, distinctUntilChanged } from 'rxjs/operators'; | ||
|
||
@Component({ | ||
selector: 'edit-component-json', | ||
templateUrl: 'edit-component-json.component.html', | ||
styleUrls: ['edit-component-json.component.scss'] | ||
}) | ||
export class EditComponentJsonComponent { | ||
|
||
validComponentContentJSONString: string; | ||
componentContentJSONString: string; | ||
@Input() | ||
componentId: string; | ||
nodeChangedSubscription: Subscription; | ||
@Input() | ||
nodeId: string; | ||
showJSONAuthoring: boolean = false; | ||
jsonChanged: Subject<string> = new Subject<string>(); | ||
jsonChangedSubscription: Subscription; | ||
|
||
constructor(private upgrade: UpgradeModule, private NotificationService: NotificationService, | ||
private ProjectService: TeacherProjectService) { | ||
} | ||
|
||
ngOnInit() { | ||
this.setComponentContentJsonString() | ||
this.jsonChangedSubscription = this.jsonChanged | ||
.pipe( | ||
debounceTime(1000), | ||
distinctUntilChanged() | ||
) | ||
.subscribe(() => { | ||
if (this.isJSONValid()) { | ||
this.rememberRecentValidJSON(); | ||
this.NotificationService.showJSONValidMessage(); | ||
} else { | ||
this.NotificationService.showJSONInvalidMessage(); | ||
} | ||
}); | ||
this.nodeChangedSubscription = this.ProjectService.nodeChanged$.subscribe(() => { | ||
this.setComponentContentJsonString(); | ||
}); | ||
} | ||
|
||
ngOnDestory() { | ||
this.jsonChangedSubscription.unsubscribe(); | ||
this.nodeChangedSubscription.unsubscribe(); | ||
} | ||
|
||
setComponentContentJsonString() { | ||
const authoringComponentContent = this.ProjectService.getComponentByNodeIdAndComponentId( | ||
this.nodeId, this.componentId); | ||
this.componentContentJSONString = angular.toJson(authoringComponentContent, 4); | ||
} | ||
|
||
toggleJSONView(): void { | ||
if (this.showJSONAuthoring) { | ||
if (this.isJSONValid()) { | ||
this.saveChanges(); | ||
this.showJSONAuthoring = false; | ||
} else { | ||
const doRollback = | ||
confirm(this.upgrade.$injector.get('$filter')('translate')('jsonInvalidErrorMessage')); | ||
if (doRollback) { | ||
this.rollbackToRecentValidJSON(); | ||
this.saveChanges(); | ||
} | ||
} | ||
} else { | ||
this.showJSONAuthoring = true; | ||
this.rememberRecentValidJSON(); | ||
} | ||
} | ||
|
||
isJSONValid(): boolean { | ||
try { | ||
angular.fromJson(this.componentContentJSONString); | ||
return true; | ||
} catch (e) { | ||
return false; | ||
} | ||
} | ||
|
||
saveChanges(): void { | ||
try { | ||
const editedComponentContent = angular.fromJson(this.componentContentJSONString); | ||
this.ProjectService.replaceComponent(this.nodeId, this.componentId, editedComponentContent); | ||
this.ProjectService.componentChanged(); | ||
} catch(e) { | ||
this.NotificationService.showJSONInvalidMessage(); | ||
} | ||
} | ||
|
||
rememberRecentValidJSON(): void { | ||
this.validComponentContentJSONString = this.componentContentJSONString; | ||
} | ||
|
||
rollbackToRecentValidJSON(): void { | ||
this.componentContentJSONString = this.validComponentContentJSONString; | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
...e/src/app/authoring-tool/edit-component-max-score/edit-component-max-score.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<mat-form-field> | ||
<mat-label i18n>Max Score</mat-label> | ||
<input matInput | ||
type='number' | ||
[(ngModel)]='authoringComponentContent.maxScore' | ||
(ngModelChange)='maxScoreChanged.next($event)'/> | ||
</mat-form-field> |
34 changes: 34 additions & 0 deletions
34
...ite/src/app/authoring-tool/edit-component-max-score/edit-component-max-score.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { Component, Input } from "@angular/core"; | ||
import { Subject, Subscription } from "rxjs"; | ||
import { debounceTime, distinctUntilChanged } from "rxjs/operators"; | ||
import { TeacherProjectService } from "../../../../../wise5/services/teacherProjectService"; | ||
|
||
@Component({ | ||
selector: 'edit-component-max-score', | ||
templateUrl: 'edit-component-max-score.component.html' | ||
}) | ||
export class EditComponentMaxScoreComponent { | ||
|
||
@Input() | ||
authoringComponentContent: any; | ||
maxScoreChanged: Subject<string> = new Subject<string>(); | ||
maxScoreChangedSubscription: Subscription; | ||
|
||
constructor(private ProjectService: TeacherProjectService) { | ||
} | ||
|
||
ngOnInit() { | ||
this.maxScoreChangedSubscription = this.maxScoreChanged | ||
.pipe( | ||
debounceTime(1000), | ||
distinctUntilChanged() | ||
) | ||
.subscribe(() => { | ||
this.ProjectService.componentChanged(); | ||
}); | ||
} | ||
|
||
ngOnDestroy() { | ||
this.maxScoreChangedSubscription.unsubscribe(); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...pp/site/src/app/authoring-tool/edit-component-rubric/edit-component-rubric.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<div> | ||
<label class='node__label--vertical-alignment' i18n>Rubric</label> | ||
<button mat-button class='topButton mat-raised-button mat-primary' | ||
(click)='showRubricAuthoring = !showRubricAuthoring' | ||
matTooltip="Edit Component Rubric" i18n-matTooltip matTooltipPosition="above"> | ||
<mat-icon>message</mat-icon> | ||
</button> | ||
</div> | ||
<wise-authoring-tinymce-editor *ngIf='showRubricAuthoring' | ||
[(model)]='rubric' | ||
(modelChange)='rubricChanged()'> | ||
</wise-authoring-tinymce-editor> |
7 changes: 7 additions & 0 deletions
7
...pp/site/src/app/authoring-tool/edit-component-rubric/edit-component-rubric.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
label { | ||
margin-right: 10px; | ||
} | ||
|
||
div { | ||
margin-bottom: 10px; | ||
} |
35 changes: 35 additions & 0 deletions
35
...bapp/site/src/app/authoring-tool/edit-component-rubric/edit-component-rubric.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Component, Input } from "@angular/core"; | ||
import { ConfigService } from "../../../../../wise5/services/configService"; | ||
import { TeacherProjectService } from "../../../../../wise5/services/teacherProjectService"; | ||
|
||
@Component({ | ||
selector: 'edit-component-rubric', | ||
templateUrl: 'edit-component-rubric.component.html', | ||
styleUrls: ['edit-component-rubric.component.scss'] | ||
}) | ||
export class EditComponentRubricComponent { | ||
|
||
@Input() | ||
authoringComponentContent: any; | ||
rubric: string; | ||
showRubricAuthoring: boolean = false; | ||
|
||
constructor(private ConfigService: ConfigService, private ProjectService: TeacherProjectService) { | ||
} | ||
|
||
ngOnInit() { | ||
const componentContent = this.ConfigService.replaceStudentNames( | ||
this.ProjectService.injectAssetPaths(this.authoringComponentContent)); | ||
if (componentContent.rubric == null) { | ||
this.rubric = ''; | ||
} else { | ||
this.rubric = componentContent.rubric; | ||
} | ||
} | ||
|
||
rubricChanged(): void { | ||
this.authoringComponentContent.rubric = | ||
this.ConfigService.removeAbsoluteAssetPaths(this.rubric); | ||
this.ProjectService.componentChanged(); | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
...webapp/site/src/app/authoring-tool/edit-component-tags/edit-component-tags.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<div fxLayout="row" fxLayoutGap="8px" fxLayoutAlign="start center"> | ||
<mat-label class="node__label--vertical-alignment" i18n>Tags</mat-label> | ||
<button mat-button | ||
class="topButton mat-raised-button mat-primary" | ||
matTooltip="Add Tag" | ||
i18n-matTooltip | ||
matTooltipPosition="above" | ||
(click)="addTag()"> | ||
<mat-icon>add</mat-icon> | ||
</button> | ||
</div> | ||
<div *ngFor="let tag of authoringComponentContent.tags; let i = index" | ||
fxLayout="row" fxLayoutGap="8px" fxLayoutAlign="start center" style="margin-top: 16px"> | ||
<mat-form-field> | ||
<mat-label i18n>Tag Name</mat-label> | ||
<input matInput | ||
[ngModel]="tag" | ||
(ngModelChange)="tagChanged.next({tagIndex: i, tag: $event})"/> | ||
</mat-form-field> | ||
<button mat-button | ||
class="moveComponentButton mat-raised-button mat-primary" | ||
matTooltip="Move Up" | ||
i18n-matTooltip | ||
matTooltipPosition="above" | ||
(click)="moveTagUp(i)"> | ||
<mat-icon>arrow_upward</mat-icon> | ||
</button> | ||
<button mat-button | ||
class="moveComponentButton mat-raised-button mat-primary" | ||
matTooltip="Move Down" | ||
i18n-matTooltip | ||
matTooltipPosition="above" | ||
(click)="moveTagDown(i)"> | ||
<mat-icon>arrow_downward</mat-icon> | ||
</button> | ||
<button mat-button | ||
class="moveComponentButton mat-raised-button mat-primary" | ||
matTooltip="Delete" | ||
i18n-matTooltip | ||
matTooltipPosition="above" | ||
(click)="deleteTag(i)"> | ||
<mat-icon>delete</mat-icon> | ||
</button> | ||
</div> |
70 changes: 70 additions & 0 deletions
70
...n/webapp/site/src/app/authoring-tool/edit-component-tags/edit-component-tags.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import { Component, Input } from "@angular/core"; | ||
import { UpgradeModule } from "@angular/upgrade/static"; | ||
import { Subject, Subscription } from "rxjs"; | ||
import { debounceTime, distinctUntilChanged } from "rxjs/operators"; | ||
import { TeacherProjectService } from "../../../../../wise5/services/teacherProjectService"; | ||
|
||
@Component({ | ||
selector: 'edit-component-tags', | ||
templateUrl: 'edit-component-tags.component.html' | ||
}) | ||
export class EditComponentTagsComponent { | ||
|
||
@Input() | ||
authoringComponentContent: any; | ||
tagChanged: Subject<any> = new Subject<any>(); | ||
tagChangedSubscription: Subscription; | ||
|
||
constructor(private ProjectService: TeacherProjectService, private upgrade: UpgradeModule) { | ||
} | ||
|
||
ngOnInit() { | ||
this.tagChangedSubscription = this.tagChanged | ||
.pipe( | ||
debounceTime(1000), | ||
distinctUntilChanged() | ||
) | ||
.subscribe(({tagIndex, tag}) => { | ||
this.authoringComponentContent.tags[tagIndex] = tag; | ||
this.ProjectService.componentChanged(); | ||
}); | ||
} | ||
|
||
ngOnDestroy() { | ||
this.tagChangedSubscription.unsubscribe(); | ||
} | ||
|
||
addTag() { | ||
if (this.authoringComponentContent.tags == null) { | ||
this.authoringComponentContent.tags = []; | ||
} | ||
this.authoringComponentContent.tags.push(''); | ||
this.ProjectService.componentChanged(); | ||
} | ||
|
||
moveTagUp(index: number) { | ||
if (index > 0) { | ||
const tag = this.authoringComponentContent.tags[index]; | ||
this.authoringComponentContent.tags.splice(index, 1); | ||
this.authoringComponentContent.tags.splice(index - 1, 0, tag); | ||
this.ProjectService.componentChanged(); | ||
} | ||
} | ||
|
||
moveTagDown(index: number) { | ||
if (index < this.authoringComponentContent.tags.length - 1) { | ||
const tag = this.authoringComponentContent.tags[index]; | ||
this.authoringComponentContent.tags.splice(index, 1); | ||
this.authoringComponentContent.tags.splice(index + 1, 0, tag); | ||
this.ProjectService.componentChanged(); | ||
} | ||
} | ||
|
||
deleteTag(indexOfTagToDelete: number) { | ||
if (confirm( | ||
this.upgrade.$injector.get('$filter')('translate')('areYouSureYouWantToDeleteThisTag'))) { | ||
this.authoringComponentContent.tags.splice(indexOfTagToDelete, 1); | ||
this.ProjectService.componentChanged(); | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
...bapp/site/src/app/authoring-tool/edit-component-width/edit-component-width.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<mat-form-field> | ||
<mat-label i18n>Component Width</mat-label> | ||
<input matInput | ||
type='number' | ||
[(ngModel)]='authoringComponentContent.componentWidth' | ||
(ngModelChange)='widthChanged.next($event)'/> | ||
</mat-form-field> |
Oops, something went wrong.