-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* docs: Add highlight sintax for code blocks in README * docs: Add GNU AGPL (#4) * Add Heroku generated app.json * chore(ci): Testing Heroku pipelines (#5) * chore(ci): test change for heroku pipeline * chore(vendor): add ng-cli to main deps * Revert "chore(vendor): add ng-cli to main deps" This reverts commit 7f38c3c. * chore(git): update gitignore, ignore yarn lock * chore(ci): fix install and startup * chore(ci): Add dependencies to make it run on Heroku (#6) * docs: Update README (#7) * Update README.md * Update README.md * feat: Books front-end (#8)
- Loading branch information
1 parent
ca3fe75
commit 00262b3
Showing
29 changed files
with
1,237 additions
and
24 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 |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
|
||
# dependencies | ||
/node_modules | ||
yarn.lock | ||
|
||
# IDEs and editors | ||
/.idea | ||
|
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,17 @@ | ||
{ | ||
"name": "halp-workers-app", | ||
"scripts": { | ||
}, | ||
"env": { | ||
}, | ||
"formation": { | ||
}, | ||
"addons": [ | ||
|
||
], | ||
"buildpacks": [ | ||
{ | ||
"url": "heroku/nodejs" | ||
} | ||
] | ||
} |
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,14 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { Routes, RouterModule } from '@angular/router'; | ||
|
||
export const routes: Routes = [ | ||
{ path: '', redirectTo: 'auth', pathMatch: 'full'}, | ||
{ path: 'auth', loadChildren: 'app/auth/auth.module#AuthModule' }, | ||
{ path: 'books', loadChildren: 'app/books/books.module#BooksModule' } | ||
]; | ||
|
||
@NgModule({ | ||
imports: [RouterModule.forRoot(routes)], | ||
exports: [RouterModule] | ||
}) | ||
export class AppRoutingModule { } |
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,3 +1,2 @@ | ||
<h1> | ||
{{title}} | ||
</h1> | ||
<router-outlet></router-outlet> | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { RouterModule } from '@angular/router'; | ||
|
||
import { AuthComponent } from './auth.component'; | ||
|
||
@NgModule({ | ||
imports: [RouterModule.forChild([ | ||
{ path: 'auth', component: AuthComponent } | ||
])], | ||
exports: [ RouterModule ] | ||
}) | ||
export class AuthRoutingModule {} |
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 @@ | ||
#button-login { | ||
position: fixed; | ||
top: 50%; | ||
left: 50%; | ||
transform: translate(-50%, -50%); | ||
} |
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 @@ | ||
<button routerLink="../books" routerLinkActive="active" type="button" class="btn btn-primary" id="button-login">Login</button> |
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 } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-auth', | ||
templateUrl: './auth.component.html', | ||
styleUrls: ['./auth.component.css'] | ||
}) | ||
export class AuthComponent implements OnInit { | ||
|
||
constructor() { } | ||
|
||
ngOnInit() { | ||
} | ||
|
||
} |
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 { NgModule } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; | ||
|
||
import { AuthRoutingModule } from './auth-routing.module'; | ||
import { AuthComponent } from './auth.component'; | ||
|
||
@NgModule({ | ||
imports: [ | ||
CommonModule, | ||
AuthRoutingModule, | ||
NgbModule | ||
], | ||
declarations: [ AuthComponent ] | ||
}) | ||
export class AuthModule { } |
16 changes: 16 additions & 0 deletions
16
src/app/books/books-grid/book-card/book-card.component.css
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 @@ | ||
.book-image { | ||
max-height: 100%; | ||
} | ||
|
||
.book-image-box { | ||
height: 200px; | ||
width: 200px; | ||
text-align: center; | ||
} | ||
|
||
card { | ||
width: 20rem; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} |
52 changes: 52 additions & 0 deletions
52
src/app/books/books-grid/book-card/book-card.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,52 @@ | ||
<div class="card"> | ||
<div class="book-image-box"> | ||
<img class="card-img-top book-image" [src]='book.image' alt="Card image cap"> | ||
</div> | ||
<div class="card-block"> | ||
<h4 class="card-title">{{ book.id }} {{ book.title }}</h4> | ||
<p class="card-text">{{ book.author }}</p> | ||
<button (click)="edit(content)" type="button" class="btn btn-primary"> | ||
<i class="fa fa-pencil" aria-hidden="true"></i> Edit | ||
</button> | ||
<button (click)="delete()" type="button" class="btn btn-danger"> | ||
<i class="fa fa-trash-o" aria-hidden="true"></i> Delete | ||
</button> | ||
</div> | ||
</div> | ||
|
||
<template #content let-c="close" let-d="dismiss"> | ||
<div class="modal-header"> | ||
<h4 class="modal-title">Edit book</h4> | ||
<button type="button" class="close" aria-label="Close" (click)="d('Cross click')"> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
</div> | ||
<div class="modal-body"> | ||
<form> | ||
<div class="form-group"> | ||
<label for="id">ID</label> | ||
<input type="text" class="form-control" id="id" [value]="book.id" required> | ||
</div> | ||
<div class="form-group"> | ||
<label for="title">Title</label> | ||
<input type="text" class="form-control" id="title" [value]="book.title" required> | ||
</div> | ||
<div class="form-group"> | ||
<label for="author">Author</label> | ||
<input type="text" class="form-control" id="author" [value]="book.author" required> | ||
</div> | ||
<div class="form-group"> | ||
<label for="description">Description</label> | ||
<input type="text" class="form-control" id="description" [value]="book.description" required> | ||
</div> | ||
<div class="form-group"> | ||
<label for="image">Image</label> | ||
<input type="text" class="form-control" id="image" [value]="book.image" required> | ||
</div> | ||
</form> | ||
</div> | ||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-secondary" (click)="c('Close click')">Close</button> | ||
<button type="button" class="btn btn-success" (click)="c('Close click')">Save</button> | ||
</div> | ||
</template> |
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,43 @@ | ||
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; | ||
import { NgbModal, ModalDismissReasons } from '@ng-bootstrap/ng-bootstrap'; | ||
|
||
import { Book } from '../book'; | ||
|
||
@Component({ | ||
selector: 'app-book-card', | ||
templateUrl: './book-card.component.html', | ||
styleUrls: ['./book-card.component.css'] | ||
}) | ||
export class BookCardComponent implements OnInit { | ||
@Input() book: Book; | ||
@Output() _delete: EventEmitter<number> = new EventEmitter(); | ||
closeResult: string; | ||
|
||
constructor(private modalService: NgbModal) { } | ||
|
||
ngOnInit() { | ||
} | ||
|
||
delete() { | ||
this._delete.emit(this.book.id); | ||
} | ||
|
||
edit(content) { | ||
this.modalService.open(content).result.then((result) => { | ||
this.closeResult = `Closed with: ${result}`; | ||
}, (reason) => { | ||
this.closeResult = `Dismissed ${this.getDismissReason(reason)}`; | ||
}); | ||
} | ||
|
||
private getDismissReason(reason: any): string { | ||
if (reason === ModalDismissReasons.ESC) { | ||
return 'by pressing ESC'; | ||
} else if (reason === ModalDismissReasons.BACKDROP_CLICK) { | ||
return 'by clicking on a backdrop'; | ||
} else { | ||
return `with: ${reason}`; | ||
} | ||
} | ||
|
||
} |
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 @@ | ||
export class Book { | ||
id: number; | ||
title: string; | ||
author: string; | ||
description: string; | ||
image: string; | ||
|
||
constructor( | ||
id: number, | ||
title: string, | ||
author: string, | ||
description: string, | ||
image: 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
.activity-content { | ||
} | ||
|
||
.book-box, .activity-content { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
margin: 1.5em 0em; | ||
} | ||
|
||
.book-box { | ||
min-width: 200px; | ||
} | ||
|
||
.row-centered { | ||
text-align:center; | ||
} | ||
|
||
.col-centered { | ||
display:inline-block; | ||
float:none; | ||
text-align:left; | ||
} |
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 @@ | ||
<div class="activity-content"> | ||
<div class="container-fluid activity-container"> | ||
<div class="col-3 col-centered book-box" *ngFor="let book of books"> | ||
<app-book-card [book]="book" (_delete)="deleteBook($bookId)"></app-book-card> | ||
</div> | ||
</div> | ||
</div> |
Oops, something went wrong.