-
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.
Merge pull request #1727 from WISE-Community/implement-tag-color
feat(Tag): Implement tag color
- Loading branch information
Showing
24 changed files
with
284 additions
and
185 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,6 @@ | ||
import { Tag } from './tag'; | ||
|
||
export interface ProjectAndTagsResponse { | ||
projectId: number; | ||
tags: Tag[]; | ||
} |
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,5 +1,6 @@ | ||
export interface Tag { | ||
checked?: boolean; | ||
color: string; | ||
id: number; | ||
text: string; | ||
} |
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 was deleted.
Oops, something went wrong.
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
13 changes: 6 additions & 7 deletions
13
src/app/teacher/create-tag-dialog/create-tag-dialog.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,15 +1,14 @@ | ||
<h2 mat-dialog-title i18n>Create New Tag</h2> | ||
<mat-dialog-content> | ||
<mat-form-field class="tag-name"> | ||
<mat-label i18n>Tag Name</mat-label> | ||
<input matInput (keyup.enter)="create()" [formControl]="tagControl" autofocus /> | ||
<mat-error *ngIf="tagControl.hasError('required')" i18n>Required</mat-error> | ||
<mat-error *ngIf="tagControl.hasError('tagAlreadyExists')" i18n>Tag already exists</mat-error> | ||
</mat-form-field> | ||
<edit-tag | ||
[nameControl]="nameControl" | ||
[colorControl]="colorControl" | ||
(enterKeyEvent)="create()" | ||
></edit-tag> | ||
</mat-dialog-content> | ||
<mat-dialog-actions align="end"> | ||
<button mat-button mat-dialog-close i18n>Cancel</button> | ||
<button mat-raised-button color="primary" [disabled]="!tagControl.valid" (click)="create()" i18n> | ||
<button mat-raised-button color="primary" [disabled]="!nameControl.valid" (click)="create()" i18n> | ||
Create | ||
</button> | ||
</mat-dialog-actions> |
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
14 changes: 7 additions & 7 deletions
14
src/app/teacher/edit-tag-dialog/edit-tag-dialog.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,15 +1,15 @@ | ||
<h2 mat-dialog-title i18n>Edit Tag</h2> | ||
<mat-dialog-content> | ||
<mat-form-field class="tag-name"> | ||
<mat-label i18n>Tag Name</mat-label> | ||
<input matInput (keyup.enter)="save()" [formControl]="tagControl" autofocus /> | ||
<mat-error *ngIf="tagControl.hasError('required')" i18n>Required</mat-error> | ||
<mat-error *ngIf="tagControl.hasError('tagAlreadyExists')" i18n>Tag already exists</mat-error> | ||
</mat-form-field> | ||
<edit-tag | ||
[tag]="tag" | ||
[nameControl]="nameControl" | ||
[colorControl]="colorControl" | ||
(enterKeyEvent)="save()" | ||
></edit-tag> | ||
</mat-dialog-content> | ||
<mat-dialog-actions align="end"> | ||
<button mat-button mat-dialog-close i18n>Cancel</button> | ||
<button mat-raised-button color="primary" [disabled]="!tagControl.valid" (click)="save()" i18n> | ||
<button mat-raised-button color="primary" [disabled]="!nameControl.valid" (click)="save()" i18n> | ||
Save | ||
</button> | ||
</mat-dialog-actions> |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<div fxLayout="row" fxLayoutAlign="space-between"> | ||
<mat-form-field class="name-input"> | ||
<mat-label i18n>Tag Name</mat-label> | ||
<input matInput (keyup.enter)="enterKeyPressed()" [formControl]="nameControl" /> | ||
<mat-error *ngIf="nameControl.errors?.required" i18n>Required</mat-error> | ||
<mat-error *ngIf="nameControl.errors?.tagAlreadyExists" i18n>Tag already exists</mat-error> | ||
</mat-form-field> | ||
<mat-form-field class="color-input"> | ||
<mat-label i18n>Color</mat-label> | ||
<input matInput (keyup.enter)="enterKeyPressed()" [formControl]="colorControl" /> | ||
</mat-form-field> | ||
</div> |
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,7 @@ | ||
.name-input { | ||
width: 80%; | ||
} | ||
|
||
.color-input { | ||
width: 15%; | ||
} |
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,27 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { EditTagComponent } from './edit-tag.component'; | ||
import { ProjectTagService } from '../../../assets/wise5/services/projectTagService'; | ||
import { HttpClientTestingModule } from '@angular/common/http/testing'; | ||
import { FormControl, Validators } from '@angular/forms'; | ||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; | ||
|
||
describe('EditTagComponent', () => { | ||
let component: EditTagComponent; | ||
let fixture: ComponentFixture<EditTagComponent>; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [BrowserAnimationsModule, EditTagComponent, HttpClientTestingModule], | ||
providers: [ProjectTagService] | ||
}); | ||
fixture = TestBed.createComponent(EditTagComponent); | ||
component = fixture.componentInstance; | ||
component.nameControl = new FormControl('', [Validators.required]); | ||
component.colorControl = new FormControl(''); | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
Oops, something went wrong.