Skip to content

Commit f4e784d

Browse files
Merge branch 'release-5.20.3'
2 parents 7e55d70 + b1f4e39 commit f4e784d

136 files changed

Lines changed: 4474 additions & 2668 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.prettierignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
1-
*.ts
21
*.html
2+
*.js
3+
*.css
4+
*.scss
5+
*.json
6+
*.md
7+
src/main/webapp/curriculum
8+
src/main/webapp/site/dist

.prettierrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"semi": true,
3+
"trailingComma": "none",
4+
"singleQuote": true,
5+
"printWidth": 100
6+
}

.prettierrc.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "wise",
3-
"version": "5.20.2",
3+
"version": "5.20.3",
44
"description": "Web-based Inquiry Science Environment",
55
"main": "app.js",
66
"browserslist": [
@@ -121,7 +121,7 @@
121121
"moment-locales-webpack-plugin": "^1.2.0",
122122
"ng-bullet": "^1.0.3",
123123
"node-sass": "^4.14.1",
124-
"prettier": "1.19.1",
124+
"prettier": "2.2.1",
125125
"protractor": "~7.0.0",
126126
"ts-loader": "^6.2.2",
127127
"ts-node": "~8.2.0",
@@ -141,6 +141,7 @@
141141
"build-prod-hans": "node --max_old_space_size=4096 ./node_modules/@angular/cli/bin/ng build wise --configuration=production-zh-Hans; gulp rename-styles-bundle",
142142
"build-prod-hant": "node --max_old_space_size=4096 ./node_modules/@angular/cli/bin/ng build wise --configuration=production-zh-Hant; gulp rename-styles-bundle",
143143
"bundle-report": "node ./node_modules/webpack-bundle-analyzer/lib/bin/analyzer.js src/main/webapp/site/dist/stats.json",
144+
"prettier-format": "prettier --config .prettierrc 'src' --write",
144145
"watch-all-wise5": "node node_modules/concurrently/bin/concurrently.js \"node ./node_modules/gulp/bin/gulp.js\" \"npm run test-wise5-watch\"",
145146
"watch-sass": "npm rebuild node-sass && node ./node_modules/gulp/bin/gulp.js",
146147
"update-i18n": "node ./node_modules/gulp/bin/gulp.js update-i18n",

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<artifactId>wise</artifactId>
3535
<packaging>war</packaging>
3636
<name>Web-based Inquiry Science Environment</name>
37-
<version>5.20.2</version>
37+
<version>5.20.3</version>
3838
<url>http://wise5.org</url>
3939
<licenses>
4040
<license>

src/main/resources/version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5.20.2
1+
5.20.3
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { Directive, Input } from "@angular/core";
2+
import { TeacherProjectService } from "../../../../../wise5/services/teacherProjectService";
3+
4+
@Directive()
5+
export abstract class EditAdvancedComponentComponent {
6+
7+
authoringComponentContent: any;
8+
@Input()
9+
componentId: string;
10+
@Input()
11+
nodeId: string;
12+
13+
constructor(protected ProjectService: TeacherProjectService) {}
14+
15+
ngOnInit() {
16+
this.authoringComponentContent = this.ProjectService.getComponentByNodeIdAndComponentId(
17+
this.nodeId, this.componentId);
18+
}
19+
}
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
import { NodeService } from "../../../../../wise5/services/nodeService";
2+
import { TeacherProjectService } from "../../../../../wise5/services/teacherProjectService";
3+
4+
export class EditAdvancedComponentAngularJSController {
5+
6+
authoringComponentContent: any;
7+
componentId: string;
8+
nodeId: string;
9+
allowedConnectedComponentTypes: string[] = [];
10+
idToOrder: any;
11+
12+
static $inject = ['NodeService', 'ProjectService'];
13+
14+
constructor(protected NodeService: NodeService, protected ProjectService: TeacherProjectService) {
15+
}
16+
17+
$onInit(): void {
18+
this.authoringComponentContent = this.ProjectService.getComponentByNodeIdAndComponentId(
19+
this.nodeId, this.componentId);
20+
this.idToOrder = this.ProjectService.idToOrder;
21+
}
22+
23+
componentChanged(): void {
24+
this.ProjectService.nodeChanged();
25+
}
26+
27+
addConnectedComponent(): void {
28+
this.addConnectedComponentAndSetComponentIdIfPossible();
29+
this.componentChanged();
30+
}
31+
32+
addConnectedComponentAndSetComponentIdIfPossible(): void {
33+
const connectedComponent = this.createConnectedComponent();
34+
if (this.authoringComponentContent.connectedComponents == null) {
35+
this.authoringComponentContent.connectedComponents = [];
36+
}
37+
this.authoringComponentContent.connectedComponents.push(connectedComponent);
38+
this.automaticallySetConnectedComponentComponentIdIfPossible(connectedComponent);
39+
}
40+
41+
automaticallySetConnectedComponentComponentIdIfPossible(connectedComponent: any): void {
42+
let numberOfAllowedComponents = 0;
43+
let allowedComponent = null;
44+
for (const component of this.ProjectService.getComponentsByNodeId(connectedComponent.nodeId)) {
45+
if (this.isConnectedComponentTypeAllowed(component.type) &&
46+
component.id != this.componentId) {
47+
numberOfAllowedComponents += 1;
48+
allowedComponent = component;
49+
}
50+
}
51+
if (numberOfAllowedComponents === 1) {
52+
connectedComponent.componentId = allowedComponent.id;
53+
connectedComponent.type = 'importWork';
54+
}
55+
this.automaticallySetConnectedComponentTypeIfPossible(connectedComponent);
56+
}
57+
58+
connectedComponentTypeChanged(connectedComponent: any): void {
59+
this.componentChanged();
60+
}
61+
62+
connectedComponentNodeIdChanged(connectedComponent: any): void {
63+
connectedComponent.componentId = null;
64+
connectedComponent.type = null;
65+
this.automaticallySetConnectedComponentComponentIdIfPossible(connectedComponent);
66+
this.componentChanged();
67+
}
68+
69+
connectedComponentComponentIdChanged(connectedComponent: any): void {
70+
this.automaticallySetConnectedComponentTypeIfPossible(connectedComponent);
71+
this.componentChanged();
72+
}
73+
74+
isConnectedComponentTypeAllowed(componentType: string): boolean {
75+
return this.allowedConnectedComponentTypes.includes(componentType);
76+
}
77+
78+
automaticallySetConnectedComponentTypeIfPossible(connectedComponent: any): void {
79+
if (connectedComponent.componentId != null) {
80+
connectedComponent.type = 'importWork';
81+
}
82+
this.automaticallySetConnectedComponentFieldsIfPossible(connectedComponent);
83+
}
84+
85+
automaticallySetConnectedComponentFieldsIfPossible(connectedComponent: any): void {
86+
}
87+
88+
createConnectedComponent(): any {
89+
return {
90+
nodeId: this.nodeId,
91+
componentId: null,
92+
type: null
93+
};
94+
}
95+
96+
deleteConnectedComponent(index: number): void {
97+
if (confirm($localize`Are you sure you want to delete this connected component?`)) {
98+
if (this.authoringComponentContent.connectedComponents != null) {
99+
this.authoringComponentContent.connectedComponents.splice(index, 1);
100+
}
101+
this.componentChanged();
102+
}
103+
}
104+
105+
getNodePositionAndTitleByNodeId(nodeId: string): string {
106+
return this.ProjectService.getNodePositionAndTitleByNodeId(nodeId);
107+
}
108+
109+
isApplicationNode(nodeId: string): boolean {
110+
return this.ProjectService.isApplicationNode(nodeId);
111+
}
112+
113+
getComponentsByNodeId(nodeId: string): any[] {
114+
return this.ProjectService.getComponentsByNodeId(nodeId);
115+
}
116+
117+
setShowSubmitButtonValue(show: boolean): void {
118+
if (show == null || show == false) {
119+
this.authoringComponentContent.showSaveButton = false;
120+
this.authoringComponentContent.showSubmitButton = false;
121+
} else {
122+
this.authoringComponentContent.showSaveButton = true;
123+
this.authoringComponentContent.showSubmitButton = true;
124+
}
125+
this.NodeService.broadcastComponentShowSubmitButtonValueChanged({
126+
nodeId: this.nodeId,
127+
componentId: this.componentId,
128+
showSubmitButton: show
129+
});
130+
}
131+
132+
getConnectedComponentType(
133+
{nodeId, componentId}: { nodeId: string, componentId: string }) {
134+
const component = this.ProjectService.getComponentByNodeIdAndComponentId(nodeId, componentId);
135+
if (component != null) {
136+
return component.type;
137+
}
138+
return null;
139+
}
140+
141+
}

src/main/webapp/site/src/app/authoring-tool/edit-component-json/edit-component-json.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<div>
2-
<label class='node__label--vertical-alignment' i18n>JSON</label>
1+
<div fxLayout="row" fxLayoutGap="8px" fxLayoutAlign="start center">
2+
<mat-label class='node__label--vertical-alignment' i18n>JSON</mat-label>
33
<button mat-button class='topButton mat-raised-button mat-primary'
44
(click)="toggleJSONView()"
55
matTooltip="Show JSON" i18n-matTooltip matTooltipPosition="above">

0 commit comments

Comments
 (0)