Skip to content

Commit defdb5d

Browse files
committed
bs4
1 parent 8679304 commit defdb5d

27 files changed

+1908
-110
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"@angular/router": "^4.0.0",
2626
"@types/lodash": "^4.14.61",
2727
"angularfire2": "^2.0.0-beta.8",
28+
"bootstrap": "^4.0.0-alpha.6",
2829
"core-js": "^2.4.1",
2930
"firebase": "^3.7.2",
3031
"lodash": "^4.17.4",

src/app/app.component.html

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
1-
<h1>{{title}}</h1>
1+
<top-nav></top-nav>
22

3-
<user-profile></user-profile>
3+
<!-- <div class="jumbotron jumbotron-fluid">
4+
<div class="container">
5+
<h1 class="display-3"><i class="fa fa-fire"></i> {{title}}</h1>
6+
<p class="lead">Angular v4 starter app wired up with Firebase</p>
7+
</div>
8+
</div> -->
49

5-
<router-outlet></router-outlet>
10+
<div class="container">
11+
12+
<div class="row">
13+
<div class="col-md-3 align-self-start">
14+
15+
<user-profile></user-profile>
16+
17+
<a routerLink="/items">Realtime DB Demo</a><br>
18+
<a routerLink="/uploads">File Uploads Demo</a>
19+
20+
21+
</div>
22+
<div class="col-md-9">
23+
24+
<router-outlet></router-outlet>
25+
26+
</div>
27+
</div>
28+
</div>

src/app/app.module.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { BrowserModule } from '@angular/platform-browser';
22
import { NgModule } from '@angular/core';
33
import { FormsModule } from '@angular/forms';
44
import { HttpModule } from '@angular/http';
5+
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
56

67
import { AppRoutingModule } from './app-routing.module';
78
import { AppComponent } from './app.component';
@@ -27,6 +28,11 @@ import { UploadFormComponent } from './uploads/upload-form/upload-form.component
2728
import { UploadsListComponent } from './uploads/uploads-list/uploads-list.component';
2829
import { UploadDetailComponent } from './uploads/upload-detail/upload-detail.component';
2930

31+
// FireStarter Navigation
32+
import { NavService } from './ui/shared/nav.service';
33+
import { TopNavComponent } from './ui/top-nav/top-nav.component';
34+
35+
3036
export const firebaseConfig = environment.firebaseConfig;
3137

3238
///// End FireStarter
@@ -42,19 +48,22 @@ export const firebaseConfig = environment.firebaseConfig;
4248
ItemDetailComponent,
4349
UploadFormComponent,
4450
UploadsListComponent,
45-
UploadDetailComponent
51+
UploadDetailComponent,
52+
TopNavComponent
4653
],
4754
imports: [
4855
BrowserModule,
4956
FormsModule,
5057
HttpModule,
5158
AppRoutingModule,
52-
AngularFireModule.initializeApp(firebaseConfig)
59+
AngularFireModule.initializeApp(firebaseConfig),
60+
BrowserAnimationsModule,
5361
],
5462
providers: [
5563
AuthService,
5664
ItemService,
5765
UploadService,
66+
NavService,
5867

5968
],
6069
bootstrap: [
Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
{{ item.title || 'no title' }}<br>
2-
{{ item.body || 'no body' }}<br>
3-
Active: {{ item.active }}<br>
4-
{{ item.lastClick | date: 'medium' }}<br>
51

2+
<h5 class="card-header">{{ item.title || 'missing title' }}</h5>
3+
<div class="card-block">
64

7-
<span (click)='deleteItem()'>Delete</span>
8-
<span (click)='updateTimeStamp()'>Log Timestamp</span>
5+
Active: {{ item.active }}<br>
6+
{{ item.timeStamp | date: 'medium' }}
97

10-
<span *ngIf='item.active' (click)='updateActive(false)'>Mark Active</span>
11-
<span *ngIf='!item.active' (click)='updateActive(true)'>Mark Complete</span>
8+
</div>
129

13-
<hr>
10+
<div class="card-footer text-muted text-xs-center">
11+
<span class="btn btn-sm btn-secondary" (click)='updateTimeStamp()'>Update Timestamp</span>
12+
<span class="btn btn-sm btn-success" *ngIf='item.active' (click)='updateActive(false)'>Mark Complete</span>
13+
<span class="btn btn-sm btn-primary" *ngIf='!item.active' (click)='updateActive(true)'>Mark Active</span>
14+
<span class="btn btn-sm btn-danger" (click)='deleteItem()'>Delete</span>
15+
</div>

src/app/items/item-detail/item-detail.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export class ItemDetailComponent implements OnInit {
1818

1919
updateTimeStamp() {
2020
let date = new Date()
21-
this.itemSvc.updateItem(this.item.$key, { lastClick: date })
21+
this.itemSvc.updateItem(this.item.$key, { timeStamp: date })
2222
}
2323

2424
updateActive(value: boolean) {
Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,39 @@
11
<h3>New Task Form</h3>
22

3-
<div>
4-
<label>Name: </label>
5-
<input placeholder="Item Title" class="form-control"
6-
[(ngModel)]="item.title"
7-
required minlength="2" maxlength="23"
8-
#title='ngModel'>
9-
10-
<div *ngIf="title.dirty || title.touched">
11-
<p *ngIf='title.errors; then errors else valid'>template renders here...</p>
12-
</div>
13-
14-
<br>
15-
<label>Body: </label>
16-
<textarea placeholder="Item Body" class="form-control"
17-
[(ngModel)]="item.body"
18-
required minlength="2" maxlength="23"
19-
#body='ngModel'>
20-
</textarea>
21-
<br>
22-
<button (click)='createItem()' [disabled]="!title.valid || !body.valid">Create</button>
3+
<div class='form-group'>
4+
<fieldset>
5+
<label class="control-label">Name: </label>
6+
7+
<input placeholder="Item Title" class="form-control"
8+
[(ngModel)]="item.title"
9+
required minlength="2" maxlength="23"
10+
#title='ngModel'>
11+
12+
<div *ngIf="title.dirty">
13+
<span *ngIf='title.errors; then errors else valid'>template renders here...</span>
14+
</div>
15+
16+
<!-- <br>
17+
<label class="control-label">Body</label>
18+
<textarea placeholder="Item Body" class="form-control" rows="5"
19+
[(ngModel)]="item.body"
20+
required minlength="5" maxlength="200"
21+
#body='ngModel'>
22+
</textarea>
23+
24+
<div *ngIf="body.dirty">
25+
<span *ngIf='body.errors; then errors else valid'>template renders here...</span>
26+
</div> -->
27+
28+
29+
<button class="btn btn-primary" (click)='createItem()' [disabled]="!title.valid">Create</button>
30+
</fieldset>
2331
</div>
2432

25-
<ng-template #valid>looks good!</ng-template>
26-
<ng-template #errors>form contains errors!</ng-template>
33+
<ng-template #valid>
34+
<p class="text-success">looks good!</p>
35+
</ng-template>
36+
37+
<ng-template #errors>
38+
<p class="text-danger">form contains errors!</p>
39+
</ng-template>

src/app/items/items-list/items-list.component.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
<h1>Items</h1>
22

3-
<div *ngFor="let item of items | async">
3+
<div *ngFor="let item of items | async" class="card">
44
<item-detail [item]='item'></item-detail>
55
</div>
66

77

88

9-
<button (click)='addEmptyItem()'>Add Item</button>
10-
<button (click)='deleteItems()'>Delete Entire List</button>
9+
<button type="button" class="btn btn-danger" (click)='deleteItems()'>Delete Entire List</button>
1110

1211
<hr>
1312

src/app/items/items-list/items-list.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export class ItemsListComponent implements OnInit {
1515
constructor(private itemSvc: ItemService) { }
1616

1717
ngOnInit() {
18-
this.items = this.itemSvc.getItemsList()
18+
this.items = this.itemSvc.getItemsList({limitToLast: 5})
1919
}
2020

2121

src/app/items/shared/item.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ export class Item {
99
title: string;
1010
body: string;
1111
active: boolean = true;
12-
lastClick: Date = new Date();
12+
timeStamp: Date = new Date();
1313
}

src/app/ui/shared/nav.service.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { Injectable } from '@angular/core';
2+
3+
@Injectable()
4+
export class NavService {
5+
6+
constructor() { }
7+
8+
}

0 commit comments

Comments
 (0)