aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2016-04-06 01:46:24 +0900
committerKazuki Yamaguchi <k@rhe.jp>2016-04-06 01:46:24 +0900
commitf612778a4c180e876acc0122b02c3ffef93e42bf (patch)
treebefd5ab07c09edb1619601ac51401d3ce957157c
parent102bc6b205057e2cb3e47ccb178ffbe4f43a15a0 (diff)
downloadpoe-f612778a4c180e876acc0122b02c3ffef93e42bf.tar.gz
frontend: タイトルを修正
-rw-r--r--frontend/app/app.component.ts2
-rw-r--r--frontend/app/editing-data.service.ts16
-rw-r--r--frontend/app/home.component.ts4
3 files changed, 12 insertions, 10 deletions
diff --git a/frontend/app/app.component.ts b/frontend/app/app.component.ts
index 4119eec..b5ac25c 100644
--- a/frontend/app/app.component.ts
+++ b/frontend/app/app.component.ts
@@ -75,7 +75,7 @@ export class AppComponent {
generateHeader() {
const summary = this.editing.summarize();
if (summary === "")
- return "poe: run code in 10+ Ruby interpreters";
+ return "untitled";
else
return summary;
}
diff --git a/frontend/app/editing-data.service.ts b/frontend/app/editing-data.service.ts
index d58478a..924295e 100644
--- a/frontend/app/editing-data.service.ts
+++ b/frontend/app/editing-data.service.ts
@@ -27,13 +27,13 @@ export class EditingData {
}
summarize() {
- let head = this.code.substring(0, 40)
+ let head = this.code.substring(0, 50)
switch (this.lang) {
case "ruby":
- head = head.replace(/^#+ */m, "");
+ head = head.replace(/^#+ */mg, "");
let firstLine = head.substr(0, head.indexOf("\n")).trim();
- if (firstLine.length >= 3)
+ if (firstLine.length > 3)
head = firstLine;
else
head = head.replace("\n", " ").replace(/\s{3,}/, " ");
@@ -41,8 +41,8 @@ export class EditingData {
}
head = head.trim();
- if (head.length >= 30)
- return head.substring(0, 29) + "…";
+ if (head.length >= 40)
+ return head.substring(0, 39) + "…";
else
return head;
}
@@ -60,9 +60,9 @@ export class EditingDataService {
return this.data;
}
- reset() {
- this.data.code = "";
- this.data.lang = EditingData.availableLangs[0];
+ set(lang: string, code: string) {
+ this.data.lang = lang;
+ this.data.code = code;
}
fromSnippet(snip: Snippet) {
diff --git a/frontend/app/home.component.ts b/frontend/app/home.component.ts
index 86bf263..5491f9b 100644
--- a/frontend/app/home.component.ts
+++ b/frontend/app/home.component.ts
@@ -13,6 +13,8 @@ export class HomeComponent {
private _routeParams: RouteParams,
private _service: SnippetService,
private _edit_service: EditingDataService) {
- _edit_service.reset();
+ const msg = "# poe: eval in 10+ Ruby interpreters\n" +
+ "# paste your code here"
+ _edit_service.set("ruby", msg);
}
}