-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Authoring): Allow expanding and collapsing lessons (#1622)
- Loading branch information
1 parent
6228412
commit 6af15b1
Showing
15 changed files
with
424 additions
and
70 deletions.
There are no files selected for viewing
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,4 @@ | ||
export interface ExpandEvent { | ||
expanded: boolean; | ||
id: string; | ||
} |
82 changes: 58 additions & 24 deletions
82
...sets/wise5/authoringTool/project-authoring-lesson/project-authoring-lesson.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 |
---|---|---|
@@ -1,26 +1,60 @@ | ||
<div id="{{ lesson.id }}" fxLayoutAlign="start center" class="pointer groupHeader projectItem"> | ||
<mat-checkbox | ||
color="primary" | ||
(change)="selectNode($event.checked)" | ||
[disabled]="nodeTypeSelected() === 'step'" | ||
aria-label="Select lesson" | ||
i18n-aria-label | ||
> | ||
</mat-checkbox> | ||
<div | ||
class="projectItemTitleDiv" | ||
fxLayoutAlign="start center" | ||
fxLayoutGap="10px" | ||
(click)="setCurrentNode(lesson.id)" | ||
> | ||
<node-icon-and-title [nodeId]="lesson.id" [showPosition]="showPosition"></node-icon-and-title> | ||
<div id="{{ lesson.id }}" class="lesson"> | ||
<div class="lesson-bar full-width pointer" fxLayoutAlign="start center"> | ||
<mat-checkbox | ||
color="primary" | ||
(change)="selectNode($event.checked)" | ||
[disabled]="nodeTypeSelected() === 'step'" | ||
aria-label="Select lesson" | ||
i18n-aria-label | ||
> | ||
</mat-checkbox> | ||
<div class="full-width" fxLayoutAlign="start center" fxLayoutGap="10px"> | ||
<div | ||
(click)="setCurrentNode(lesson.id)" | ||
fxFlex | ||
matTooltip="Click to enter lesson" | ||
matTooltipPosition="above" | ||
i18n-matTooltip | ||
> | ||
<node-icon-and-title | ||
[nodeId]="lesson.id" | ||
[showPosition]="showPosition" | ||
></node-icon-and-title> | ||
</div> | ||
<div *ngIf="lesson.ids.length > 0" fxLayout="row" fxLayoutAlign="end center"> | ||
<button | ||
mat-icon-button | ||
*ngIf="!expanded" | ||
(click)="toggleExpanded()" | ||
fxLayoutAlign="end center" | ||
matTooltip="Click to expand" | ||
matTooltipPosition="above" | ||
i18n-matTooltip | ||
> | ||
<mat-icon>expand_more</mat-icon> | ||
</button> | ||
<button | ||
mat-icon-button | ||
*ngIf="expanded" | ||
(click)="toggleExpanded()" | ||
fxLayoutAlign="end center" | ||
matTooltip="Click to collapse" | ||
matTooltipPosition="above" | ||
i18n-matTooltip | ||
> | ||
<mat-icon>expand_less</mat-icon> | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
<div *ngIf="expanded" fxLayout="column"> | ||
<ng-container *ngFor="let childId of lesson.ids"> | ||
<project-authoring-step | ||
[step]="idToNode[childId]" | ||
(selectNodeEvent)="selectNodeEvent.emit($event)" | ||
[showPosition]="showPosition" | ||
[projectId]="projectId" | ||
></project-authoring-step> | ||
</ng-container> | ||
</div> | ||
</div> | ||
<div *ngFor="let childId of lesson.ids"> | ||
<project-authoring-step | ||
[step]="idToNode[childId]" | ||
(selectNodeEvent)="selectNodeEvent.emit($event)" | ||
[showPosition]="showPosition" | ||
[projectId]="projectId" | ||
></project-authoring-step> | ||
</div> |
23 changes: 11 additions & 12 deletions
23
...sets/wise5/authoringTool/project-authoring-lesson/project-authoring-lesson.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 |
---|---|---|
@@ -1,20 +1,19 @@ | ||
.groupHeader { | ||
margin-left: 5px !important; | ||
.lesson { | ||
padding: 8px; | ||
margin: 16px 0px; | ||
border: 2px solid #dddddd; | ||
border-radius: 6px; | ||
position: relative; | ||
} | ||
|
||
.pointer { | ||
cursor: pointer; | ||
} | ||
|
||
.projectItem:hover { | ||
.lesson-bar:hover { | ||
background-color: #add8e6; | ||
} | ||
|
||
.projectItemTitleDiv:hover { | ||
background-color: #add8e6; | ||
.full-width { | ||
width: 100%; | ||
} | ||
|
||
.projectItemTitleDiv { | ||
width: 100%; | ||
font-weight: initial; | ||
.pointer { | ||
cursor: pointer; | ||
} |
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
22 changes: 22 additions & 0 deletions
22
src/assets/wise5/authoringTool/project-authoring-lesson/project-authoring-lesson.harness.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,22 @@ | ||
import { ComponentHarness } from '@angular/cdk/testing'; | ||
import { MatButtonHarness } from '@angular/material/button/testing'; | ||
import { ProjectAuthoringStepHarness } from '../project-authoring-step/project-authoring-step.harness'; | ||
|
||
export class ProjectAuthoringLessonHarness extends ComponentHarness { | ||
static hostSelector = 'project-authoring-lesson'; | ||
getExpandButton = this.locatorForOptional( | ||
MatButtonHarness.with({ selector: '[matTooltip="Click to expand"]' }) | ||
); | ||
getCollapseButton = this.locatorForOptional( | ||
MatButtonHarness.with({ selector: '[matTooltip="Click to collapse"]' }) | ||
); | ||
getSteps = this.locatorForAll(ProjectAuthoringStepHarness); | ||
|
||
async isExpanded(): Promise<boolean> { | ||
return (await this.getExpandButton()) == null; | ||
} | ||
|
||
async isCollapsed(): Promise<boolean> { | ||
return (await this.getCollapseButton()) == null; | ||
} | ||
} |
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
5 changes: 5 additions & 0 deletions
5
src/assets/wise5/authoringTool/project-authoring-step/project-authoring-step.harness.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,5 @@ | ||
import { ComponentHarness } from '@angular/cdk/testing'; | ||
|
||
export class ProjectAuthoringStepHarness extends ComponentHarness { | ||
static hostSelector = 'project-authoring-step'; | ||
} |
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 |
---|---|---|
|
@@ -8,7 +8,6 @@ | |
|
||
.all-nodes-div { | ||
margin-top: 20px; | ||
margin-left: 20px; | ||
} | ||
|
||
.componentHeader { | ||
|
Oops, something went wrong.