-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(web): replace angularjs with angular2
- Loading branch information
Showing
23 changed files
with
438 additions
and
162 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 |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
node_modules | ||
coverage | ||
share | ||
www |
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 was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright (c) 2017, Hugo Freire <hugo@exec.sh>. | ||
* | ||
* This source code is licensed under the license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
const { Route } = require('serverful') | ||
|
||
const _ = require('lodash') | ||
|
||
const { join } = require('path') | ||
|
||
class Web extends Route { | ||
constructor () { | ||
super('GET', '/', 'www', 'www') | ||
} | ||
|
||
auth () { | ||
return false | ||
} | ||
|
||
toRoute () { | ||
return _(super.toRoute()) | ||
.omit('config.handler') | ||
.merge({ | ||
method: 'GET', | ||
path: '/{param*}', | ||
handler: { | ||
directory: { | ||
path: join(__dirname, '../web'), | ||
index: true | ||
} | ||
} | ||
}) | ||
.value() | ||
} | ||
} | ||
|
||
module.exports = new Web() |
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,4 @@ | ||
node_modules | ||
*.js | ||
!systemjs.config.js | ||
*.js.map |
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,38 @@ | ||
/* | ||
* Copyright (c) 2017, Hugo Freire <hugo@exec.sh>. | ||
* | ||
* This source code is licensed under the license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import {Component} from "@angular/core"; | ||
|
||
import {PeopleService} from "./people/people.service"; | ||
import {PersonDialogComponent} from "./people/person-dialog.component"; | ||
|
||
import {MdDialog, MdDialogConfig, MdDialogRef} from "@angular/material"; | ||
|
||
@Component({ | ||
selector: 'app', | ||
templateUrl: '/app/people/people.html', | ||
providers: [ PeopleService ] | ||
}) | ||
export class AppComponent { | ||
people: any; | ||
person: any; | ||
dialogRef: MdDialogRef<PersonDialogComponent>; | ||
|
||
constructor (private service: PeopleService, public dialog: MdDialog) { | ||
service.getAll() | ||
.subscribe((people) => { | ||
this.people = people; | ||
}); | ||
} | ||
|
||
openPersonDialog (person: any) { | ||
const config = new MdDialogConfig() | ||
config.data = {person} | ||
|
||
this.dialogRef = this.dialog.open(PersonDialogComponent, config); | ||
} | ||
} |
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 @@ | ||
/* | ||
* Copyright (c) 2017, Hugo Freire <hugo@exec.sh>. | ||
* | ||
* This source code is licensed under the license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import {NgModule} from "@angular/core"; | ||
import {BrowserModule} from "@angular/platform-browser"; | ||
import {HttpModule} from "@angular/http"; | ||
import {NoopAnimationsModule} from "@angular/platform-browser/animations"; | ||
import {MdButtonModule, MdDialogModule, MdTooltipModule} from "@angular/material"; | ||
|
||
import {MomentModule} from "angular2-moment"; | ||
|
||
import {AppComponent} from "./app.component"; | ||
import {PersonDialogComponent} from "./people/person-dialog.component"; | ||
|
||
@NgModule({ | ||
imports: [ BrowserModule, HttpModule, NoopAnimationsModule, MdDialogModule, MdTooltipModule, MdButtonModule, MomentModule ], | ||
declarations: [ AppComponent, PersonDialogComponent ], | ||
entryComponents: [ PersonDialogComponent ], | ||
bootstrap: [ AppComponent ] | ||
}) | ||
|
||
export class AppModule { | ||
} |
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,18 @@ | ||
<!-- | ||
~ Copyright (c) 2017, Hugo Freire <hugo@exec.sh>. | ||
~ | ||
~ This source code is licensed under the license found in the | ||
~ LICENSE file in the root directory of this source tree. | ||
--> | ||
|
||
<ul class="no-bullet"> | ||
<li *ngFor="let person of people"> | ||
<div class="tint" | ||
[ngClass]="{pass: !person.like, like: person.like, train: person.train}" | ||
(click)="openPersonDialog(person)" | ||
mdTooltip="Similarity: {{person.photos_similarity_mean}}%" | ||
tooltipPosition="bottom"> | ||
<img [src]="person.data.photos[0].url"/> | ||
</div> | ||
</li> | ||
</ul> |
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,28 @@ | ||
/* | ||
* Copyright (c) 2017, Hugo Freire <hugo@exec.sh>. | ||
* | ||
* This source code is licensed under the license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import {Injectable} from "@angular/core"; | ||
import {Http} from "@angular/http"; | ||
import "rxjs/add/operator/map"; | ||
|
||
@Injectable() | ||
export class PeopleService { | ||
constructor (private http: Http) { | ||
} | ||
|
||
getAll () { | ||
return this.http.get('/people') | ||
.map((res) => res.json()); | ||
} | ||
|
||
train (id: string) { | ||
console.log(id) | ||
|
||
return this.http.post(`/train/${id}`, {}) | ||
.map(() => {}) | ||
} | ||
} |
Oops, something went wrong.