Skip to content
This repository was archived by the owner on Oct 14, 2019. It is now read-only.

Commit d706a75

Browse files
author
Your Name
committed
initial commit
0 parents  commit d706a75

File tree

79 files changed

+2601
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+2601
-0
lines changed

.gitignore

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
node_modules
2+
typings
3+
tsd_typings/
4+
npm-debug.log
5+
dist/
6+
.idea
7+
.DS_Store
8+
tmp
9+
*.js
10+
*.map

README.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# FinalProject
2+
3+
This project was generated with [angular-cli](https://github.com/angular/angular-cli) version 1.0.0-beta.11-webpack.8.
4+
5+
## Development server
6+
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
7+
8+
## Code scaffolding
9+
10+
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive/pipe/service/class`.
11+
12+
## Build
13+
14+
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build.
15+
16+
## Running unit tests
17+
18+
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
19+
20+
## Running end-to-end tests
21+
22+
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
23+
Before running the tests make sure you are serving the app via `ng serve`.
24+
25+
## Deploying to Github Pages
26+
27+
Run `ng github-pages:deploy` to deploy to Github Pages.
28+
29+
## Further help
30+
31+
To get more help on the `angular-cli` use `ng --help` or go check out the [Angular-CLI README](https://github.com/angular/angular-cli/blob/master/README.md).

angular-cli.json

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"project": {
3+
"version": "1.0.0-beta.11-webpack.8",
4+
"name": "final-project"
5+
},
6+
"apps": [
7+
{
8+
"root": "src",
9+
"outDir": "dist",
10+
"assets": "assets",
11+
"index": "index.html",
12+
"main": "main.ts",
13+
"test": "test.ts",
14+
"tsconfig": "tsconfig.json",
15+
"prefix": "app",
16+
"mobile": false,
17+
"styles": [
18+
"styles.css"
19+
],
20+
"scripts": [],
21+
"environments": {
22+
"source": "environments/environment.ts",
23+
"prod": "environments/environment.prod.ts",
24+
"dev": "environments/environment.dev.ts"
25+
}
26+
}
27+
],
28+
"addons": [],
29+
"packages": [],
30+
"e2e": {
31+
"protractor": {
32+
"config": "./protractor.conf.js"
33+
}
34+
},
35+
"test": {
36+
"karma": {
37+
"config": "./karma.conf.js"
38+
}
39+
},
40+
"defaults": {
41+
"styleExt": "css",
42+
"prefixInterfaces": false,
43+
"lazyRoutePrefix": "+"
44+
}
45+
}

db-data.ts

+277
Large diffs are not rendered by default.

e2e/app.e2e-spec.ts

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import {FinalProjectPage} from "./app.po";
2+
3+
describe('final-project App', function() {
4+
let page: FinalProjectPage;
5+
6+
beforeEach(() => {
7+
page = new FinalProjectPage();
8+
});
9+
10+
it('should display message saying app works', () => {
11+
page.navigateTo();
12+
expect(page.getParagraphText()).toEqual('app works!');
13+
});
14+
});

e2e/app.po.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import {browser, element, by} from "protractor/globals";
2+
3+
export class FinalProjectPage {
4+
navigateTo() {
5+
return browser.get('/');
6+
}
7+
8+
getParagraphText() {
9+
return element(by.css('app-root h1')).getText();
10+
}
11+
}

e2e/tsconfig.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"compileOnSave": false,
3+
"compilerOptions": {
4+
"declaration": false,
5+
"emitDecoratorMetadata": true,
6+
"experimentalDecorators": true,
7+
"module": "commonjs",
8+
"moduleResolution": "node",
9+
"outDir": "../dist/out-tsc-e2e",
10+
"sourceMap": true,
11+
"target": "es5",
12+
"typeRoots": [
13+
"../node_modules/@types"
14+
]
15+
}
16+
}

package.json

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"name": "final-project",
3+
"version": "0.0.0",
4+
"license": "MIT",
5+
"angular-cli": {},
6+
"scripts": {
7+
"start": "ng serve",
8+
"lint": "tslint \"src/**/*.ts\"",
9+
"test": "ng test",
10+
"pree2e": "webdriver-manager update",
11+
"e2e": "protractor",
12+
"populate-db": "./node_modules/.bin/ts-node ./populate-db.ts",
13+
"server": "node src/server/batch-server.js"
14+
},
15+
"private": true,
16+
"dependencies": {
17+
"@angular/common": "2.0.1",
18+
"@angular/compiler": "2.0.1",
19+
"@angular/core": "2.0.1",
20+
"@angular/forms": "2.0.1",
21+
"@angular/http": "2.0.1",
22+
"@angular/platform-browser": "2.0.1",
23+
"@angular/platform-browser-dynamic": "2.0.1",
24+
"@angular/router": "3.0.0",
25+
"@types/request": "0.0.30",
26+
"angularfire2": "^2.0.0-beta.4",
27+
"core-js": "^2.4.0",
28+
"firebase": "^3.3.1",
29+
"firebase-queue": "^1.5.0",
30+
"lodash": "^4.15.0",
31+
"rxjs": "5.0.0-beta.12",
32+
"ts-helpers": "^1.1.1",
33+
"ts-node": "^1.2.1",
34+
"zone.js": "^0.6.21"
35+
},
36+
"devDependencies": {
37+
"@types/jasmine": "^2.2.30",
38+
"angular-cli": "1.0.0-beta.16",
39+
"codelyzer": "~0.0.26",
40+
"jasmine-core": "2.4.1",
41+
"jasmine-spec-reporter": "2.5.0",
42+
"karma": "0.13.22",
43+
"karma-chrome-launcher": "0.2.3",
44+
"karma-jasmine": "0.3.8",
45+
"karma-remap-istanbul": "^0.2.1",
46+
"protractor": "4.0.3",
47+
"ts-node": "1.2.1",
48+
"tslint": "3.13.0",
49+
"typescript": "^2.0.2"
50+
}
51+
}

populate-db.ts

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import {database, initializeApp} from "firebase";
2+
import {firebaseConfig} from "./src/environments/firebase.config";
3+
import {dbData} from "./db-data";
4+
5+
6+
console.log('Initizalizing Firebase database ... ');
7+
8+
initializeApp(firebaseConfig);
9+
10+
11+
const coursesRef = database().ref('courses');
12+
const lessonsRef = database().ref('lessons');
13+
14+
15+
16+
dbData.courses.forEach( course => {
17+
18+
console.log('adding course', course.url);
19+
20+
const courseRef = coursesRef.push({
21+
url: course.url,
22+
description: course.description,
23+
iconUrl: course.iconUrl,
24+
courseListIcon: course.courseListIcon,
25+
longDescription: course.longDescription
26+
});
27+
28+
let lessonKeysPerCourse = [];
29+
30+
course.lessons.forEach((lesson:any) => {
31+
32+
console.log('adding lesson ', lesson.url);
33+
34+
lessonKeysPerCourse.push(lessonsRef.push({
35+
description: lesson.description,
36+
duration: lesson.duration,
37+
url: lesson.url,
38+
tags: lesson.tags,
39+
videoUrl: lesson.videoUrl || null,
40+
longDescription: lesson.longDescription,
41+
courseId: courseRef.key
42+
}).key);
43+
44+
});
45+
46+
47+
const association = database().ref('lessonsPerCourse');
48+
49+
const lessonsPerCourse = association.child(courseRef.key);
50+
51+
lessonKeysPerCourse.forEach(lessonKey => {
52+
console.log('adding lesson to course ');
53+
54+
const lessonCourseAssociation = lessonsPerCourse.child(lessonKey);
55+
56+
lessonCourseAssociation.set(true);
57+
});
58+
59+
60+
});
61+
62+
63+
64+
65+
66+
67+
68+
69+

src/app/app.component.css

Whitespace-only changes.

src/app/app.component.html

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
<app-menu></app-menu>
3+
4+
<main class="l-main l-sample-app">
5+
6+
<div>
7+
8+
<div class="main-container">
9+
<div class="list">
10+
<router-outlet></router-outlet>
11+
</div>
12+
</div>
13+
14+
</div>
15+
16+
</main>
17+

src/app/app.component.ts

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import {Component} from "@angular/core";
2+
3+
4+
@Component({
5+
selector: 'app-root',
6+
templateUrl: './app.component.html',
7+
styleUrls: ['./app.component.css']
8+
})
9+
export class AppComponent {
10+
title = 'Final Project ongoing !';
11+
12+
13+
}

src/app/app.module.ts

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import {BrowserModule} from "@angular/platform-browser";
2+
import {NgModule} from "@angular/core";
3+
import {FormsModule, ReactiveFormsModule} from "@angular/forms";
4+
import {HttpModule} from "@angular/http";
5+
import {AppComponent} from "./app.component";
6+
import {AngularFireModule} from "angularfire2";
7+
import {CoursesComponent} from "./courses/courses.component";
8+
import {RouterModule} from "@angular/router";
9+
import {routerConfig} from "../router.config";
10+
import {CoursesService} from "./shared/model/courses.service";
11+
import {MenuComponent} from "./menu/menu.component";
12+
import {CourseDetailComponent} from "./course-detail/course-detail.component";
13+
import {HomeComponent} from "./home/home.component";
14+
import {firebaseConfig, authConfig} from "../environments/firebase.config";
15+
import {LessonComponent} from "./lesson/lesson.component";
16+
import {LessonsService} from ".//shared/model/lessons.service";
17+
import {SafePipe} from "./shared/safe.pipe";
18+
import {LessonFormComponent} from "./lesson-form/lesson-form.component";
19+
import {NewLessonComponent} from "./new-lesson/new-lesson.component";
20+
import {EditLessonComponent} from "./edit-lesson/edit-lesson.component";
21+
import {LessonResolver} from "./shared/resolvers/lesson.resolver";
22+
import {LoginComponent} from "./login/login.component";
23+
import {RegisterComponent} from "./register/register.component";
24+
import {AuthService} from "./shared/security/auth.service";
25+
import {AuthGuard} from "./shared/security/auth.guard";
26+
import {LessonsRestService} from "./shared/model/lessons-rest.service";
27+
28+
29+
@NgModule({
30+
declarations: [
31+
AppComponent,
32+
CoursesComponent,
33+
MenuComponent,
34+
CourseDetailComponent,
35+
HomeComponent,
36+
LessonComponent,
37+
SafePipe,
38+
LessonFormComponent,
39+
NewLessonComponent,
40+
EditLessonComponent,
41+
LoginComponent,
42+
RegisterComponent
43+
],
44+
imports: [
45+
BrowserModule,
46+
FormsModule,
47+
HttpModule,
48+
AngularFireModule.initializeApp(firebaseConfig, authConfig),
49+
RouterModule.forRoot(routerConfig),
50+
ReactiveFormsModule,
51+
HttpModule
52+
],
53+
providers: [LessonResolver, CoursesService, LessonsService, AuthService, AuthGuard, LessonsRestService],
54+
bootstrap: [AppComponent]
55+
})
56+
export class AppModule { }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
.nav-bar {
3+
margin-bottom: 20px;
4+
background: #FAFAFA;
5+
}
6+
7+
8+
.lessons-list-container {
9+
background: #FAFAFA;
10+
}
11+
12+
13+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
2+
<h2>{{course?.description }}</h2>
3+
4+
5+
<div class="lessons-list-container v-h-center-block-parent">
6+
7+
<div class="nav-bar">
8+
<button (click)="previous()">Previous Page</button>
9+
<button (click)="next()" >Next Page</button>
10+
</div>
11+
12+
<table class="table lessons-list card card-strong" *ngIf="course && lessonsPage">
13+
<tbody>
14+
<tr *ngFor="let lesson of lessonsPage.pagedData" [routerLink]="[lesson.url]">
15+
<td class="course-icon"><img [src]="course.courseListIcon"></td>
16+
<td class="lesson-title"> {{lesson.description}}</td>
17+
<td class="duration">
18+
<i class="md-icon duration-icon">access_time</i>
19+
<span>{{lesson.duration}}</span>
20+
</td>
21+
</tr>
22+
</tbody>
23+
</table>
24+
25+
<div class="tools-bar">
26+
<button routerLink="new" [queryParams]="{courseId:course?.$key}">New Lesson</button>
27+
</div>
28+
29+
</div>
30+
31+
32+
33+

0 commit comments

Comments
 (0)