-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3b0c809
commit 63461ed
Showing
13 changed files
with
197 additions
and
88 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
37 changes: 37 additions & 0 deletions
37
src/app/courses/courses-details/courses-details.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,37 @@ | ||
<mat-card> | ||
<mat-card-header> | ||
<mat-card-title><span *ngIf="course.id; else noSelection">{{course.title}}</span> | ||
<ng-template #noSelection>Select Course</ng-template> | ||
Select Course | ||
</mat-card-title> | ||
</mat-card-header> | ||
<form #form="ngForm" (submit)="saved.emit(course)"> | ||
<mat-card-content> | ||
<mat-form-field> | ||
<input matInput placeholder="title" | ||
type="text" name="title"required | ||
[(ngModel)]="course.title"> | ||
</mat-form-field> | ||
<mat-form-field> | ||
<input matInput placeholder="Description" | ||
type="text" name="title" | ||
[(ngModel)]="course.description"> | ||
</mat-form-field> | ||
<section> | ||
<h4>{{course.percentComplete}}% Complete</h4> | ||
<mat-slider class="full-width" | ||
min="0" max="100" | ||
name="percentComplete" | ||
thumbLabel | ||
[(ngModel)]="course.percentComplete"></mat-slider> | ||
</section> | ||
<mat-checkbox name="favorite" [(ngModel)]="course.favorite" ></mat-checkbox> //Na | ||
</mat-card-content> | ||
<mat-card-actions> | ||
<button [disabled]="form.invalid" type="submit" mat-button color="primary">Submit</button> | ||
<button type="button" mat-button (click)="cancelled.emit()">CANCEL</button> | ||
</mat-card-actions> | ||
</form> | ||
<pre>{{form.value | json}}</pre> | ||
<pre>{{form.valid | json}}</pre> | ||
</mat-card> |
Empty file.
25 changes: 25 additions & 0 deletions
25
src/app/courses/courses-details/courses-details.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,25 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { CoursesDetailsComponent } from './courses-details.component'; | ||
|
||
describe('CoursesDetailsComponent', () => { | ||
let component: CoursesDetailsComponent; | ||
let fixture: ComponentFixture<CoursesDetailsComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [ CoursesDetailsComponent ] | ||
}) | ||
.compileComponents(); | ||
}); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(CoursesDetailsComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
15 changes: 15 additions & 0 deletions
15
src/app/courses/courses-details/courses-details.component.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,15 @@ | ||
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-courses-details', | ||
templateUrl: './courses-details.component.html', | ||
styleUrls: ['./courses-details.component.scss'], | ||
}) | ||
export class CoursesDetailsComponent implements OnInit { | ||
@Input() course; | ||
@Output() saved = new EventEmitter(); | ||
@Output() cancelled = new EventEmitter(); | ||
constructor() {} | ||
|
||
ngOnInit(): void {} | ||
} |
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,19 @@ | ||
<mat-card> | ||
<mat-card-header> | ||
<mat-card-title> | ||
Course List | ||
</mat-card-title> | ||
</mat-card-header> | ||
<mat-card-content> | ||
<mat-list> | ||
<mat-list-item *ngFor="let course of courses" (click)="selected.emit(course)"> | ||
<h3 matLine>{{course.title}}</h3> | ||
<p matLine>{{course.description}}</p> | ||
<button mat-icon-button color="warn" (click)="deleted.emit(course.id);$event.stopImmediatePropagation()"> | ||
<mat-icon>delete</mat-icon> | ||
</button> | ||
</mat-list-item> | ||
</mat-list> | ||
|
||
</mat-card-content> | ||
</mat-card> |
Empty file.
25 changes: 25 additions & 0 deletions
25
src/app/courses/courses-list/courses-list.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,25 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { CoursesListComponent } from './courses-list.component'; | ||
|
||
describe('CoursesListComponent', () => { | ||
let component: CoursesListComponent; | ||
let fixture: ComponentFixture<CoursesListComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [ CoursesListComponent ] | ||
}) | ||
.compileComponents(); | ||
}); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(CoursesListComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
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,16 @@ | ||
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-courses-list', | ||
templateUrl: './courses-list.component.html', | ||
styleUrls: ['./courses-list.component.scss'], | ||
}) | ||
export class CoursesListComponent implements OnInit { | ||
@Input() courses; | ||
@Output() selected = new EventEmitter(); | ||
@Output() deleted = new EventEmitter(); | ||
|
||
constructor() {} | ||
|
||
ngOnInit(): void {} | ||
} |
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,66 +1,17 @@ | ||
<div class="courses-containers"> | ||
<div class="courses-list"> | ||
<mat-card> | ||
<mat-card-header> | ||
<mat-card-title> | ||
Course List | ||
</mat-card-title> | ||
</mat-card-header> | ||
<mat-card-content> | ||
<mat-list> | ||
<mat-list-item *ngFor="let course of courses" (click)="onClick(course)"> | ||
<h3 matLine>{{course.title}}</h3> | ||
<p matLine>{{course.description}}</p> | ||
|
||
<button mat-icon-button color="warn" (click)="deleteCourse(course.id); $event.stopImmediatePropagation()"> | ||
<mat-icon>delete</mat-icon> | ||
</button> | ||
</mat-list-item> | ||
</mat-list> | ||
|
||
</mat-card-content> | ||
</mat-card> | ||
<app-courses-list [courses]="courses" | ||
(selected)="onClick($event)" | ||
(deleted)="deleteCourse($event)" | ||
></app-courses-list> | ||
</div> | ||
|
||
<div class="course-details"> | ||
<mat-card> | ||
<mat-card-header> | ||
<mat-card-title> | ||
<span *ngIf="tempData; else noSelection">{{tempData.title}}</span> | ||
<ng-template #noSelection>Select Course</ng-template> | ||
Select Course | ||
</mat-card-title> | ||
</mat-card-header> | ||
<form #form="ngForm" (submit)="saveCourse(tempData)"> | ||
<mat-card-content> | ||
<mat-form-field> | ||
<input matInput placeholder="title" | ||
type="text" name="title"required | ||
[(ngModel)]="tempData.title"> | ||
</mat-form-field> | ||
<mat-form-field> | ||
<input matInput placeholder="Description" | ||
type="text" name="title" | ||
[(ngModel)]="tempData.description"> | ||
</mat-form-field> | ||
<section> | ||
<h4>{{tempData.percentComplete}}% Complete</h4> | ||
<mat-slider class="full-width" | ||
min="0" max="100" | ||
name="percentComplete" | ||
thumbLabel | ||
[(ngModel)]="tempData.percentComplete"></mat-slider> | ||
</section> | ||
<mat-checkbox name="favorite" [(ngModel)]="tempData.favorite" ></mat-checkbox> //Na | ||
</mat-card-content> | ||
<mat-card-actions> | ||
<!-- COURSE ACTIONS --> | ||
<button [disabled]="form.invalid" type="submit" mat-button color="primary">Submit</button> | ||
<button type="button" mat-button (click)="cancel()">CANCEL</button> | ||
</mat-card-actions> | ||
</form> | ||
<pre>{{form.value | json}}</pre> | ||
<pre>{{form.valid | json}}</pre> | ||
</mat-card> | ||
<app-courses-details | ||
[course]="tempData" | ||
(saved)="saveCourse($event)" | ||
(cancelled)="cancel()" | ||
></app-courses-details> | ||
|
||
</div> | ||
</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
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