diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2016-04-04 22:41:56 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2016-04-04 22:41:56 +0900 |
commit | 7650ee9fc24262b2b97393526a224340669736c4 (patch) | |
tree | fe3d261b2df019f09edeb98f78474bc4f9be34b3 | |
parent | 7a70b6ec4e9046cd354e5a4f27a55d3be1c41c05 (diff) | |
download | poe-7650ee9fc24262b2b97393526a224340669736c4.tar.gz |
frontend: タイトル生成をいいかんじにした
-rw-r--r-- | frontend/app/app.component.ts | 25 | ||||
-rw-r--r-- | frontend/index.html | 4 |
2 files changed, 19 insertions, 10 deletions
diff --git a/frontend/app/app.component.ts b/frontend/app/app.component.ts index a88633a..662f34f 100644 --- a/frontend/app/app.component.ts +++ b/frontend/app/app.component.ts @@ -16,11 +16,11 @@ import {EditorComponent} from "./editor.component"; template: ` <nav class="navbar"> <div class="brand"> - <a class="navbar-brand" href="#">snippet: {{editing.summarize()}}</a> + <a class="navbar-brand" href="#">{{generateHeader()}}</a> </div> - <ul> + <!--<ul> <li><a href="/">about poe</a></li> - </ul> + </ul>--> </nav> <div class="container"> <div class="panel panel-default"> @@ -29,7 +29,7 @@ import {EditorComponent} from "./editor.component"; <div class="form-group" id="code-field"> <editor (onSubmit)="onSubmit()" [(value)]="editing.code" [mode]="editing.lang"></editor> </div> - <div class="form-inline"> + <div class="form-group form-inline"> <select class="form-control" [(ngModel)]="editing.lang" required> <option *ngFor="#p of availableLangs()" [value]="p">{{p}}</option> </select> @@ -57,10 +57,7 @@ export class AppComponent { _edit_service: EditingDataService, private _title: Title) { this.editing = _edit_service.get(); - this.editing.onChange(e => { - const summary = this.editing.summarize(); - this._title.setTitle("poe: " + summary); - }); + this.editing.onChange(e => this._title.setTitle(this.generateTitle())); } onSubmit() { @@ -74,4 +71,16 @@ export class AppComponent { availableLangs() { return EditingData.availableLangs; } + + generateHeader() { + const summary = this.editing.summarize(); + if (summary === "") + return "poe: eval in 30+ Ruby interpreters"; + else + return summary; + } + + generateTitle() { + return this.generateHeader() + " - poe"; + } } diff --git a/frontend/index.html b/frontend/index.html index b5b0cfa..0fb356d 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -1,9 +1,9 @@ <!DOCTYPE html> -<html lang="ja"> +<html> <head> <meta charset="UTF-8"> <meta content="width=device-width, initial-scale=1" name="viewport"> - <title>poe: online ruby environment</title> + <title>loading... - poe</title> <link rel="stylesheet" href="dist/codemirror.css"> <link rel="stylesheet" href="poe.css"> <script src="dist/es6-shim.min.js"></script> |