-
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.
chore(Authoring Tool): Convert TopBar to Angular (#1356)
Remove unused CM topBar
- Loading branch information
1 parent
2d8d5b9
commit ccfa3c9
Showing
12 changed files
with
371 additions
and
448 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
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
156 changes: 0 additions & 156 deletions
156
src/assets/wise5/authoringTool/components/shared/topBar/topBar.ts
This file was deleted.
Oops, something went wrong.
82 changes: 82 additions & 0 deletions
82
src/assets/wise5/authoringTool/components/top-bar/top-bar.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,82 @@ | ||
<mat-toolbar class="l-header" color="primary"> | ||
<span class="button logo-link"> | ||
<a href="{{ contextPath }}/teacher" target="_self"> | ||
<img [src]="logoPath" alt="WISE logo" i18n-alt class="logo" /> | ||
</a> | ||
</span> | ||
<h3 fxLayout="row" fxLayoutAlign="start center" class="title-header"> | ||
<span *ngIf="projectTitle" id="projectTitleSpan">{{ projectTitle }}</span> | ||
<span *ngIf="!projectTitle" id="projectTitleSpan" i18n>Authoring Tool</span> | ||
<span class="mat-caption" *ngIf="projectId" fxLayout="row" fxLayoutAlign="start center"> | ||
<span fxHide.xs fxHide.sm fxHide.md>({{ projectInfo }})</span> | ||
<button | ||
mat-icon-button | ||
aria-label="Project Info" | ||
i18n-aria-label | ||
fxHide.gt-md | ||
[matTooltip]="projectInfo" | ||
> | ||
<mat-icon>info</mat-icon> | ||
</button> | ||
<button | ||
mat-icon-button | ||
*ngIf="runId" | ||
fxHide.xs | ||
aria-label="Switch to Grading View" | ||
i18n-aria-label | ||
matTooltip="Switch to Grading View" | ||
i18n-matTooltip | ||
(click)="switchToGradingView()" | ||
> | ||
<mat-icon mat-menu-origin>assignment_turned_in</mat-icon> | ||
</button> | ||
</span> | ||
</h3> | ||
<span fxFlex></span> | ||
<button | ||
mat-button | ||
aria-label="Help" | ||
i18n-aria-label | ||
style="text-transform: none" | ||
(click)="showHelp()" | ||
i18n | ||
> | ||
Help | ||
</button> | ||
<button | ||
mat-icon-button | ||
aria-label="User Menu" | ||
i18n-aria-label | ||
class="mat-icon-button" | ||
[matMenuTriggerFor]="accountMenu" | ||
> | ||
<mat-icon mat-menu-origin>account_box</mat-icon> | ||
</button> | ||
<mat-menu #accountMenu class="account-menu account-menu--fixed-width"> | ||
<div | ||
class="account-menu__info" | ||
(click)="$event.stopPropagation()" | ||
fxLayout="row" | ||
fxLayoutAlign="start center" | ||
> | ||
<div class="account-menu__info__title"> | ||
<div class="account-menu-avatar" fxLayoutAlign="start center"> | ||
<mat-icon style="color: {{ avatarColor }}" class="mat-36"> account_circle </mat-icon> | ||
</div> | ||
</div> | ||
<div class="mat-subtitle-2"> | ||
{{ userInfo.firstName }} {{ userInfo.lastName }} | ||
<span class="mat-caption">({{ userInfo.username }})</span> | ||
</div> | ||
</div> | ||
<div class="account-menu__actions" (click)="$event.stopPropagation()" fxLayout="row"> | ||
<button mat-button color="primary" class="account-menu-button" (click)="goHome()" i18n> | ||
Go Home | ||
</button> | ||
<span fxFlex></span> | ||
<button mat-button color="primary" class="account-menu-button" (click)="logOut()" i18n> | ||
Sign Out | ||
</button> | ||
</div> | ||
</mat-menu> | ||
</mat-toolbar> |
37 changes: 37 additions & 0 deletions
37
src/assets/wise5/authoringTool/components/top-bar/top-bar.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,37 @@ | ||
@import 'style/abstracts/variables','style/abstracts/functions', 'style/abstracts/mixins'; | ||
|
||
.mat-toolbar { | ||
padding: 0 8px; | ||
} | ||
|
||
.title-header { | ||
font-weight: inherit !important; | ||
} | ||
|
||
.title { | ||
white-space: normal; | ||
line-height: 1.2; | ||
|
||
@media (max-width: breakpoint('xs.max')) { | ||
font-size: 14px; | ||
} | ||
} | ||
|
||
.mat-mdc-icon-button { | ||
margin: 0 4px; | ||
font-size: 16px; | ||
} | ||
|
||
/* TODO(mdc-migration): The following rule targets internal classes of list that may no longer apply for the MDC version. */ | ||
.mat-list-item-content { | ||
padding: 0; | ||
} | ||
|
||
.account-menu-avatar { | ||
height: 48px; | ||
width: 48px; | ||
} | ||
|
||
.account-menu-button { | ||
margin: 8px; | ||
} |
50 changes: 50 additions & 0 deletions
50
src/assets/wise5/authoringTool/components/top-bar/top-bar.component.spec.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,50 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { MatIconModule } from '@angular/material/icon'; | ||
import { MatMenuModule } from '@angular/material/menu'; | ||
import { MatToolbarModule } from '@angular/material/toolbar'; | ||
import { MatTooltipModule } from '@angular/material/tooltip'; | ||
import { UpgradeModule } from '@angular/upgrade/static'; | ||
import { TopBarComponent } from './top-bar.component'; | ||
import { ConfigService } from '../../../services/configService'; | ||
import { StudentTeacherCommonServicesModule } from '../../../../../app/student-teacher-common-services.module'; | ||
import { HttpClientTestingModule } from '@angular/common/http/testing'; | ||
import { TeacherProjectService } from '../../../services/teacherProjectService'; | ||
|
||
class MockUpgradeModule { | ||
$injector: any = { | ||
get() { | ||
return {}; | ||
} | ||
}; | ||
} | ||
|
||
describe('TopBarComponent', () => { | ||
let component: TopBarComponent; | ||
let fixture: ComponentFixture<TopBarComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [TopBarComponent], | ||
imports: [ | ||
HttpClientTestingModule, | ||
MatIconModule, | ||
MatMenuModule, | ||
MatToolbarModule, | ||
MatTooltipModule, | ||
StudentTeacherCommonServicesModule | ||
], | ||
providers: [TeacherProjectService, { provide: UpgradeModule, useClass: MockUpgradeModule }] | ||
}).compileComponents(); | ||
}); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(TopBarComponent); | ||
component = fixture.componentInstance; | ||
spyOn(TestBed.inject(ConfigService), 'getMyUserInfo').and.returnValue({}); | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
Oops, something went wrong.