Skip to content

Commit

Permalink
refactor(TeacherNodeIcon): Convert to standalone (#1849)
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffreykwan authored Jun 26, 2024
1 parent 4669d23 commit cec07ca
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/app/teacher/authoring-tool.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ import { StepToolsComponent } from '../../assets/wise5/common/stepTools/step-too
ProjectAuthoringStepComponent,
RecoveryAuthoringComponent,
RubricAuthoringComponent,
TeacherNodeIconComponent,
TopBarComponent,
ProjectListComponent
],
Expand All @@ -119,6 +118,7 @@ import { StepToolsComponent } from '../../assets/wise5/common/stepTools/step-too
SaveIndicatorComponent,
StepToolsComponent,
StructureAuthoringModule,
TeacherNodeIconComponent,
WiseTinymceEditorModule
]
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="top-button-bar">
<div fxLayout="row wrap" fxLayoutAlign="start center" fxLayoutGap="16px">
<teacher-node-icon [nodeId]="nodeId" [canEdit]="true" size="18"></teacher-node-icon>
<teacher-node-icon [nodeId]="nodeId" [canEdit]="true" size="18" />
<edit-node-title [node]="node"></edit-node-title>
<div class="node-buttons" fxLayoutGap="16px">
<button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,7 @@ let teacherProjectService: TeacherProjectService;
describe('NodeAuthoringComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [
CopyComponentButtonComponent,
EditNodeTitleComponent,
NodeAuthoringComponent,
TeacherNodeIconComponent
],
declarations: [CopyComponentButtonComponent, EditNodeTitleComponent, NodeAuthoringComponent],
imports: [
AddComponentButtonComponent,
BrowserAnimationsModule,
Expand All @@ -60,7 +55,8 @@ describe('NodeAuthoringComponent', () => {
MatInputModule,
PreviewComponentButtonComponent,
RouterTestingModule,
StudentTeacherCommonServicesModule
StudentTeacherCommonServicesModule,
TeacherNodeIconComponent
],
providers: [
ClassroomStatusService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ describe('ProjectAuthoringComponent', () => {
NodeAuthoringComponent,
ProjectAuthoringComponent,
ProjectAuthoringLessonComponent,
ProjectAuthoringStepComponent,
TeacherNodeIconComponent
ProjectAuthoringStepComponent
],
imports: [
AddLessonButtonComponent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,36 @@ import { ProjectService } from '../../services/projectService';
import { NodeIconComponent } from '../../vle/node-icon/node-icon.component';
import { NodeIconChooserDialog } from '../../common/node-icon-chooser-dialog/node-icon-chooser-dialog.component';
import { Component } from '@angular/core';
import { MatButtonModule } from '@angular/material/button';
import { FlexLayoutModule } from '@angular/flex-layout';
import { CommonModule } from '@angular/common';
import { MatTooltipModule } from '@angular/material/tooltip';
import { MatIconModule } from '@angular/material/icon';
import { MatBadgeModule } from '@angular/material/badge';

@Component({
imports: [
CommonModule,
FlexLayoutModule,
MatBadgeModule,
MatButtonModule,
MatIconModule,
MatTooltipModule
],
selector: 'teacher-node-icon',
templateUrl: '../../vle/node-icon/node-icon.component.html',
styleUrls: ['../../vle/node-icon/node-icon.component.scss']
standalone: true,
styleUrl: '../../vle/node-icon/node-icon.component.scss',
templateUrl: '../../vle/node-icon/node-icon.component.html'
})
export class TeacherNodeIconComponent extends NodeIconComponent {
constructor(protected dialog: MatDialog, protected projectService: ProjectService) {
constructor(
protected dialog: MatDialog,
protected projectService: ProjectService
) {
super(dialog, projectService);
}

openNodeIconChooserDialog() {
protected openNodeIconChooserDialog(): void {
this.dialog.open(NodeIconChooserDialog, {
data: { node: this.node },
panelClass: 'dialog-md'
Expand Down
7 changes: 4 additions & 3 deletions src/assets/wise5/vle/node-icon/node-icon.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,17 @@
<button
*ngIf="canEdit"
mat-button
matTooltip="Choose an Icon"
matTooltip="Choose an icon"
matTooltipPosition="above"
i18n-matTooltip
matBadge="edit"
class="mdc-text-field--filled has-icon-badge"
(click)="openNodeIconChooserDialog()"
>
<div class="mat-form-field-flex" fxLayout="row" fxLayoutAlign="center" fxLayoutGap="4px">
<ng-container *ngTemplateOutlet="iconContent"></ng-container>
<ng-container *ngTemplateOutlet="iconContent" />
</div>
</button>
<ng-container *ngIf="!canEdit">
<ng-container *ngTemplateOutlet="iconContent"></ng-container>
<ng-container *ngTemplateOutlet="iconContent" />
</ng-container>
11 changes: 11 additions & 0 deletions src/messages.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -22084,6 +22084,17 @@ If this problem continues, let your teacher know and move on to the next activit
<context context-type="linenumber">88</context>
</context-group>
</trans-unit>
<trans-unit id="d4dcc586339ab168041be68bea2c0f182a08dc41" datatype="html">
<source>Choose an icon</source>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/vle/node-icon/node-icon.component.html</context>
<context context-type="linenumber">20</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/vle/node-icon/node-icon.component.html</context>
<context context-type="linenumber">20</context>
</context-group>
</trans-unit>
<trans-unit id="b570c9b6f5d96fb6f6969cb9397019829c34e82c" datatype="html">
<source> Submit </source>
<context-group purpose="location">
Expand Down

0 comments on commit cec07ca

Please sign in to comment.