diff --git a/src/app/teacher/component-authoring.module.ts b/src/app/teacher/component-authoring.module.ts
index 1d3dd967c1..1e9af7218a 100644
--- a/src/app/teacher/component-authoring.module.ts
+++ b/src/app/teacher/component-authoring.module.ts
@@ -82,6 +82,7 @@ import { ConstraintAuthoringModule } from '../../assets/wise5/authoringTool/cons
import { EditComponentAdvancedComponent } from '../authoring-tool/edit-component-advanced/edit-component-advanced.component';
import { ComponentAuthoringComponent } from '../../assets/wise5/authoringTool/components/component-authoring.component';
import { WiseTinymceEditorModule } from '../../assets/wise5/directives/wise-tinymce-editor/wise-tinymce-editor.module';
+import { WiseLinkAuthoringDialogComponent } from '../../assets/wise5/authoringTool/wise-link-authoring-dialog/wise-link-authoring-dialog.component';
@NgModule({
declarations: [
@@ -163,7 +164,8 @@ import { WiseTinymceEditorModule } from '../../assets/wise5/directives/wise-tiny
ShowMyWorkAuthoringComponent,
SelectStepAndComponentComponent,
SummaryAuthoring,
- TableAuthoring
+ TableAuthoring,
+ WiseLinkAuthoringDialogComponent
],
imports: [
ConstraintAuthoringModule,
diff --git a/src/assets/wise5/authoringTool/wise-link-authoring-dialog/wise-link-authoring-dialog.component.html b/src/assets/wise5/authoringTool/wise-link-authoring-dialog/wise-link-authoring-dialog.component.html
new file mode 100644
index 0000000000..c8ecb41d7c
--- /dev/null
+++ b/src/assets/wise5/authoringTool/wise-link-authoring-dialog/wise-link-authoring-dialog.component.html
@@ -0,0 +1,52 @@
+
Create a WISE Link
+
+
+
+ Step
+
+
+
+ {{ getNodePositionById(item.key) }}: {{ getNodeTitle(item.key) }} ({{ item.key }})
+
+
+
+
+
+ Component (Optional)
+
+
+ {{ componentIndex + 1 }}. {{ component.type }}
+
+
+
+
+
+
+ Link Text
+
+
+
+
+
+ Link
+ Button
+
+
+
+
diff --git a/src/assets/wise5/authoringTool/wise-link-authoring-dialog/wise-link-authoring-dialog.component.scss b/src/assets/wise5/authoringTool/wise-link-authoring-dialog/wise-link-authoring-dialog.component.scss
new file mode 100644
index 0000000000..64498bc624
--- /dev/null
+++ b/src/assets/wise5/authoringTool/wise-link-authoring-dialog/wise-link-authoring-dialog.component.scss
@@ -0,0 +1,15 @@
+.choose-step {
+ width: 400px;
+}
+
+.choose-component {
+ width: 250px;
+}
+
+.type-div {
+ margin-bottom: 20px;
+}
+
+.link-text {
+ width: 500px;
+}
diff --git a/src/assets/wise5/authoringTool/wise-link-authoring-dialog/wise-link-authoring-dialog.component.spec.ts b/src/assets/wise5/authoringTool/wise-link-authoring-dialog/wise-link-authoring-dialog.component.spec.ts
new file mode 100644
index 0000000000..934f2c1eb5
--- /dev/null
+++ b/src/assets/wise5/authoringTool/wise-link-authoring-dialog/wise-link-authoring-dialog.component.spec.ts
@@ -0,0 +1,42 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+import { WiseLinkAuthoringDialogComponent } from './wise-link-authoring-dialog.component';
+import { MatDialogRef } from '@angular/material/dialog';
+import { ProjectService } from '../../services/projectService';
+import { StudentTeacherCommonServicesModule } from '../../../../app/student-teacher-common-services.module';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { MatFormFieldModule } from '@angular/material/form-field';
+import { MatSelectModule } from '@angular/material/select';
+import { MatRadioModule } from '@angular/material/radio';
+import { MatInputModule } from '@angular/material/input';
+import { FormsModule } from '@angular/forms';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
+
+describe('WiseLinkAuthoringDialogComponent', () => {
+ let component: WiseLinkAuthoringDialogComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ declarations: [WiseLinkAuthoringDialogComponent],
+ imports: [
+ BrowserAnimationsModule,
+ FormsModule,
+ HttpClientTestingModule,
+ MatFormFieldModule,
+ MatInputModule,
+ MatRadioModule,
+ MatSelectModule,
+ StudentTeacherCommonServicesModule
+ ],
+ providers: [{ provide: MatDialogRef, useValue: {} }, ProjectService]
+ }).compileComponents();
+
+ fixture = TestBed.createComponent(WiseLinkAuthoringDialogComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/assets/wise5/authoringTool/wise-link-authoring-dialog/wise-link-authoring-dialog.component.ts b/src/assets/wise5/authoringTool/wise-link-authoring-dialog/wise-link-authoring-dialog.component.ts
new file mode 100644
index 0000000000..0830ae259f
--- /dev/null
+++ b/src/assets/wise5/authoringTool/wise-link-authoring-dialog/wise-link-authoring-dialog.component.ts
@@ -0,0 +1,75 @@
+import { Component } from '@angular/core';
+import { MatDialogRef } from '@angular/material/dialog';
+import { ProjectService } from '../../services/projectService';
+
+@Component({
+ selector: 'wise-link-authoring-dialog',
+ templateUrl: './wise-link-authoring-dialog.component.html',
+ styleUrls: ['./wise-link-authoring-dialog.component.scss']
+})
+export class WiseLinkAuthoringDialogComponent {
+ items: any[];
+ wiseLinkComponentId: string = '';
+ wiseLinkNodeId: string = '';
+ wiseLinkText: string = '';
+ wiseLinkType: string = 'link';
+
+ constructor(
+ protected dialogRef: MatDialogRef,
+ private projectService: ProjectService
+ ) {}
+
+ ngOnInit(): void {
+ this.items = Object.entries(this.projectService.idToOrder)
+ .map((entry: any) => {
+ return { key: entry[0], order: entry[1].order };
+ })
+ .sort((a: any, b: any) => {
+ return a.order - b.order;
+ });
+ }
+
+ protected wiseLinkNodeIdChanged(): void {
+ if (this.wiseLinkNodeId != null && this.wiseLinkNodeId !== '') {
+ this.wiseLinkComponentId = '';
+ const position = this.getNodePositionById(this.wiseLinkNodeId);
+ const title = this.getNodeTitle(this.wiseLinkNodeId);
+ this.wiseLinkText = `${position}: ${title}`;
+ }
+ }
+
+ private getNodePositionById(nodeId: string): string {
+ return this.projectService.getNodePositionById(nodeId);
+ }
+
+ private getNodeTitle(nodeId: string): string {
+ return this.projectService.getNodeTitle(nodeId);
+ }
+
+ protected isGroupNode(nodeId: string): boolean {
+ return this.projectService.isGroupNode(nodeId);
+ }
+
+ protected getComponents(nodeId: string): any[] {
+ return this.projectService.getComponents(nodeId);
+ }
+
+ protected createWISELink(): void {
+ if (this.wiseLinkNodeId == null || this.wiseLinkNodeId === '') {
+ alert($localize`You must select a step.`);
+ } else if (this.wiseLinkText == null || this.wiseLinkText === '') {
+ alert($localize`You must enter text.`);
+ } else {
+ this.dialogRef.close({
+ wiseLinkNodeId: this.wiseLinkNodeId,
+ wiseLinkComponentId: this.wiseLinkComponentId,
+ wiseLinkType: this.wiseLinkType,
+ wiseLinkText: this.wiseLinkText
+ });
+ }
+ }
+
+ protected cancelWISELinkAuthoring(): void {
+ this.dialogRef.close();
+ }
+}
diff --git a/src/assets/wise5/authoringTool/wiseLink/wiseLinkAuthoring.html b/src/assets/wise5/authoringTool/wiseLink/wiseLinkAuthoring.html
deleted file mode 100644
index 0962b8cf42..0000000000
--- a/src/assets/wise5/authoringTool/wiseLink/wiseLinkAuthoring.html
+++ /dev/null
@@ -1,68 +0,0 @@
-
-
-
-
{{ ::'createAWISELink' | translate }}
-
-
-
-
-
- {{ ::$ctrl.getNodePositionById(item.$key) + ': '}} {{ ::$ctrl.getNodeTitle(item.$key) }}
- ({{item.$key}})
-
-
-
-
-
-
-
- {{componentIndex + 1}}. {{component.type}}
-
-
-
-
-
-
- {{ ::'link' | translate }}
- {{ ::'button' | translate }}
-
-
-
-
-
-
-
-
- {{ ::'create' | translate }}
-
-
- {{ ::'CANCEL' | translate }}
-
-
diff --git a/src/assets/wise5/authoringTool/wiseLink/wiseLinkAuthoringController.ts b/src/assets/wise5/authoringTool/wiseLink/wiseLinkAuthoringController.ts
deleted file mode 100644
index 12ac3ab901..0000000000
--- a/src/assets/wise5/authoringTool/wiseLink/wiseLinkAuthoringController.ts
+++ /dev/null
@@ -1,89 +0,0 @@
-'use strict';
-
-import { ProjectService } from '../../services/projectService';
-
-class WISELinkAuthoringController {
- $rootScope: any;
- $stateParams: any;
- $mdDialog: any;
- ProjectService: ProjectService;
- projectId: number;
- nodeId: string;
- componentId: string;
- target: any;
- items: any[];
- wiseLinkNodeId: string = '';
- wiseLinkComponentId: string = '';
- wiseLinkType: string = 'link';
- wiseLinkText: string = '';
- wiseLinkClass: string = '';
-
- static $inject = ['$rootScope', '$stateParams', '$mdDialog', 'ProjectService'];
-
- constructor($rootScope, $stateParams, $mdDialog, ProjectService) {
- this.$rootScope = $rootScope;
- this.$stateParams = $stateParams;
- this.$mdDialog = $mdDialog;
- this.ProjectService = ProjectService;
- this.projectId = $stateParams.projectId;
- this.nodeId = $stateParams.nodeId;
- this.componentId = $stateParams.componentId;
- this.target = $stateParams.target;
- this.items = this.ProjectService.idToOrder;
- }
-
- wiseLinkNodeIdChanged() {
- if (this.wiseLinkNodeId != null && this.wiseLinkNodeId != '') {
- this.wiseLinkComponentId = '';
- let position = this.getNodePositionById(this.wiseLinkNodeId);
- let title = this.getNodeTitle(this.wiseLinkNodeId);
- this.wiseLinkText = position + ': ' + title;
- }
- }
-
- getNodePositionById(nodeId) {
- return this.ProjectService.getNodePositionById(nodeId);
- }
-
- getNodeTitle(nodeId: string): string {
- return this.ProjectService.getNodeTitle(nodeId);
- }
-
- isGroupNode(nodeId) {
- return this.ProjectService.isGroupNode(nodeId);
- }
-
- getComponents(nodeId: string): any[] {
- return this.ProjectService.getComponents(nodeId);
- }
-
- /**
- * TODO: i18n
- */
- createWISELink() {
- if (this.wiseLinkNodeId == null || this.wiseLinkNodeId == '') {
- alert('You must select a step.');
- } else if (this.wiseLinkText == null || this.wiseLinkText == '') {
- alert('You must enter text.');
- } else {
- const params = {
- projectId: this.projectId,
- nodeId: this.nodeId,
- componentId: this.componentId,
- target: this.target,
- wiseLinkNodeId: this.wiseLinkNodeId,
- wiseLinkComponentId: this.wiseLinkComponentId,
- wiseLinkType: this.wiseLinkType,
- wiseLinkText: this.wiseLinkText,
- wiseLinkClass: this.wiseLinkClass
- };
- this.$mdDialog.hide(params);
- }
- }
-
- cancelWISELinkAuthoring() {
- this.$mdDialog.cancel();
- }
-}
-
-export default WISELinkAuthoringController;
diff --git a/src/assets/wise5/components/component-authoring.module.ts b/src/assets/wise5/components/component-authoring.module.ts
index b59bf5ecab..1ebc294387 100644
--- a/src/assets/wise5/components/component-authoring.module.ts
+++ b/src/assets/wise5/components/component-authoring.module.ts
@@ -28,7 +28,6 @@ import { EditComponentSubmitButtonComponent } from '../../../app/authoring-tool/
import { EditComponentTagsComponent } from '../../../app/authoring-tool/edit-component-tags/edit-component-tags.component';
import { EditComponentWidthComponent } from '../../../app/authoring-tool/edit-component-width/edit-component-width.component';
import { EditComponentExcludeFromTotalScoreComponent } from '../../../app/authoring-tool/edit-component-exclude-from-total-score/edit-component-exclude-from-total-score.component';
-import WISELinkAuthoringController from '../authoringTool/wiseLink/wiseLinkAuthoringController';
import { EditComponentDefaultFeedback } from '../../../app/authoring-tool/edit-advanced-component/edit-component-default-feedback/edit-component-default-feedback.component';
import { AuthorUrlParametersComponent } from '../../../app/authoring-tool/author-url-parameters/author-url-parameters.component';
import { EditConnectedComponentsComponent } from '../../../app/authoring-tool/edit-connected-components/edit-connected-components.component';
@@ -62,7 +61,6 @@ export default angular
'summaryAuthoringComponentModule',
'tableAuthoringComponentModule'
])
- .controller('WISELinkAuthoringController', WISELinkAuthoringController)
.directive(
'authorUrlParameters',
downgradeComponent({
diff --git a/src/assets/wise5/directives/wise-tinymce-editor/wise-authoring-tinymce-editor.component.ts b/src/assets/wise5/directives/wise-tinymce-editor/wise-authoring-tinymce-editor.component.ts
index af8f5d674b..833f3d3824 100644
--- a/src/assets/wise5/directives/wise-tinymce-editor/wise-authoring-tinymce-editor.component.ts
+++ b/src/assets/wise5/directives/wise-tinymce-editor/wise-authoring-tinymce-editor.component.ts
@@ -6,6 +6,8 @@ import 'tinymce';
import { UpgradeModule } from '@angular/upgrade/static';
import { MatDialog } from '@angular/material/dialog';
import { ProjectAssetAuthoringComponent } from '../../authoringTool/project-asset-authoring/project-asset-authoring.component';
+import { WiseLinkAuthoringDialogComponent } from '../../authoringTool/wise-link-authoring-dialog/wise-link-authoring-dialog.component';
+import { filter } from 'rxjs';
declare let tinymce: any;
@@ -56,47 +58,33 @@ export class WiseAuthoringTinymceEditorComponent extends WiseTinymceEditorCompon
tooltip: $localize`Insert WISE Link`,
icon: 'wiselink',
onAction: function () {
- const params = {
- projectId: '',
- nodeId: '',
- componentId: '',
- target: ''
- };
- thisComponent.openWISELinkChooser(params).then((result) => {
- let content = '';
- if (result.wiseLinkType === 'link') {
- content =
- `${result.wiseLinkText}`;
- } else if (result.wiseLinkType === 'button') {
- content =
- ``;
- }
- editor.insertContent(content);
- });
+ thisComponent
+ .openWISELinkChooser()
+ .afterClosed()
+ .pipe(filter((result: any) => result != null))
+ .subscribe((result: any) => {
+ let content = '';
+ if (result.wiseLinkType === 'link') {
+ content =
+ `${result.wiseLinkText}`;
+ } else if (result.wiseLinkType === 'button') {
+ content =
+ ``;
+ }
+ editor.insertContent(content);
+ });
}
});
});
}
- private openWISELinkChooser({ projectId, nodeId, componentId, target }): any {
- const stateParams = {
- projectId: projectId,
- nodeId: nodeId,
- componentId: componentId,
- target: target
- };
- return this.upgrade.$injector.get('$mdDialog').show({
- templateUrl: 'assets/wise5/authoringTool/wiseLink/wiseLinkAuthoring.html',
- controller: 'WISELinkAuthoringController',
- controllerAs: '$ctrl',
- $stateParams: stateParams,
- clickOutsideToClose: true,
- escapeToClose: true,
- multiple: true
+ private openWISELinkChooser(): any {
+ return this.dialog.open(WiseLinkAuthoringDialogComponent, {
+ width: '80%'
});
}
diff --git a/src/messages.xlf b/src/messages.xlf
index 2acfed76b1..9f146b40df 100644
--- a/src/messages.xlf
+++ b/src/messages.xlf
@@ -469,6 +469,10 @@
src/assets/wise5/authoringTool/structure/self-directed-investigation/self-directed-investigation.component.html
21
+
+ src/assets/wise5/authoringTool/wise-link-authoring-dialog/wise-link-authoring-dialog.component.html
+ 50
+
src/assets/wise5/classroomMonitor/classroomMonitorComponents/manageStudents/add-team-dialog/add-team-dialog.component.html
54
@@ -1615,6 +1619,10 @@ Click "Cancel" to keep the invalid JSON open so you can fix it.src/app/authoring-tool/select-step-and-component/select-step-and-component.component.html
2
+
+ src/assets/wise5/authoringTool/wise-link-authoring-dialog/wise-link-authoring-dialog.component.html
+ 5
+
src/assets/wise5/classroomMonitor/dataExport/data-export/data-export.component.html
322
@@ -10257,63 +10265,63 @@ Click "Cancel" to keep the invalid JSON open so you can fix it.Are you sure you want to delete Milestone ?
src/assets/wise5/authoringTool/milestones-authoring/milestones-authoring.component.ts
- 162
+ 159
src/assets/wise5/authoringTool/milestones-authoring/milestones-authoring.component.ts
- 206,208
+ 203,205
src/assets/wise5/authoringTool/milestones-authoring/milestones-authoring.component.ts
- 225
+ 222
src/assets/wise5/authoringTool/milestones-authoring/milestones-authoring.component.ts
- 306
+ 303
src/assets/wise5/authoringTool/milestones-authoring/milestones-authoring.component.ts
- 331
+ 328
src/assets/wise5/authoringTool/milestones-authoring/milestones-authoring.component.ts
- 334
+ 331
src/assets/wise5/authoringTool/milestones-authoring/milestones-authoring.component.ts
- 356
+ 353
src/assets/wise5/authoringTool/milestones-authoring/milestones-authoring.component.ts
- 393
+ 390
src/assets/wise5/authoringTool/milestones-authoring/milestones-authoring.component.ts
- 443
+ 440
@@ -11293,6 +11301,10 @@ Click "Cancel" to keep the invalid JSON open so you can fix it.src/assets/wise5/authoringTool/peer-grouping/create-new-peer-grouping-dialog/create-new-peer-grouping-dialog.component.html
53
+
+ src/assets/wise5/authoringTool/wise-link-authoring-dialog/wise-link-authoring-dialog.component.html
+ 51
+
src/assets/wise5/classroomMonitor/classroomMonitorComponents/manageStudents/add-team-dialog/add-team-dialog.component.html
63
@@ -11847,6 +11859,73 @@ Click "Cancel" to keep the invalid JSON open so you can fix it.2,7
+
+
+
+ src/assets/wise5/authoringTool/wise-link-authoring-dialog/wise-link-authoring-dialog.component.html
+ 1
+
+
+
+
+
+ src/assets/wise5/authoringTool/wise-link-authoring-dialog/wise-link-authoring-dialog.component.html
+ 8
+
+
+
+
+
+ src/assets/wise5/authoringTool/wise-link-authoring-dialog/wise-link-authoring-dialog.component.html
+ 20
+
+
+
+
+
+ src/assets/wise5/authoringTool/wise-link-authoring-dialog/wise-link-authoring-dialog.component.html
+ 23
+
+
+
+
+
+ src/assets/wise5/authoringTool/wise-link-authoring-dialog/wise-link-authoring-dialog.component.html
+ 37
+
+
+
+
+
+ src/assets/wise5/authoringTool/wise-link-authoring-dialog/wise-link-authoring-dialog.component.html
+ 43
+
+
+ src/assets/wise5/components/conceptMap/edit-concept-map-advanced/edit-concept-map-advanced.component.html
+ 82
+
+
+
+
+
+ src/assets/wise5/authoringTool/wise-link-authoring-dialog/wise-link-authoring-dialog.component.html
+ 44
+
+
+
+
+
+ src/assets/wise5/authoringTool/wise-link-authoring-dialog/wise-link-authoring-dialog.component.ts
+ 59
+
+
+
+
+
+ src/assets/wise5/authoringTool/wise-link-authoring-dialog/wise-link-authoring-dialog.component.ts
+ 61
+
+
@@ -15979,13 +16058,6 @@ Are you ready to receive feedback on this answer?
78
-
-
-
- src/assets/wise5/components/conceptMap/edit-concept-map-advanced/edit-concept-map-advanced.component.html
- 82
-
-
@@ -19963,14 +20035,14 @@ If this problem continues, let your teacher know and move on to the next activit
src/assets/wise5/directives/wise-tinymce-editor/wise-authoring-tinymce-editor.component.ts
- 24
+ 26
src/assets/wise5/directives/wise-tinymce-editor/wise-authoring-tinymce-editor.component.ts
- 56
+ 58