aboutsummaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
Diffstat (limited to 'templates')
-rw-r--r--templates/edit_post.html46
-rw-r--r--templates/index.html12
-rw-r--r--templates/layout.html9
-rw-r--r--templates/new_post.html44
-rw-r--r--templates/show_post.html30
5 files changed, 59 insertions, 82 deletions
diff --git a/templates/edit_post.html b/templates/edit_post.html
index 9154e3d..ef9c79a 100644
--- a/templates/edit_post.html
+++ b/templates/edit_post.html
@@ -1,30 +1,22 @@
-<!DOCTYPE html>
-<html>
- <head>
- <title>Edit {{ post.title }}</title>
- </head>
- <body>
- <h1>Edit post</h1>
- <form id="new_post" name="post" method="post" action="/posts/update">
- <input type="hidden" name="id" value="{{ post.id }}">
- <div class="field">
- <label>Title:</label>
- <input type="text" name="title" value="{{ post.title }}">
- </div>
+<h1>Edit post</h1>
+<form id="new_post" name="post" method="post" action="/posts/update">
+ <input type="hidden" name="id" value="{{ post.id }}">
+ <div class="field">
+ <label>Title:</label>
+ <input type="text" name="title" value="{{ post.title }}">
+ </div>
- <div class="field">
- <label>Contents:</label>
- <textarea name="body">{{ post.body }}</textarea>
- </div>
+ <div class="field">
+ <label>Contents:</label>
+ <textarea name="body">{{ post.body }}</textarea>
+ </div>
- <div class="field">
- <input type="checkbox" checked="{{ post.published }}">
- <label>Published</label>
- </div>
+ <div class="field">
+ <input type="checkbox" checked="{{ post.published }}">
+ <label>Published</label>
+ </div>
- <div class="actions">
- <input type="submit" value="Save">
- </div>
- </form>
- </body>
-</html>
+ <div class="actions">
+ <input type="submit" value="Save">
+ </div>
+</form>
diff --git a/templates/index.html b/templates/index.html
index 674b867..1b40864 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -1,10 +1,2 @@
-<!DOCTYPE html>
-<html>
- <head>
- <title>{{ title }}</title>
- </head>
- <body>
- <p><a href="/posts/new">Create new post</a></p>
- {{# posts }}{{> post_teaser.html }}{{/ posts }}
- </body>
-</html>
+<p><a href="/posts/new">Create new post</a></p>
+{{# posts }}{{> post_teaser.html }}{{/ posts }}
diff --git a/templates/layout.html b/templates/layout.html
new file mode 100644
index 0000000..09ecd1c
--- /dev/null
+++ b/templates/layout.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>{{ title }}</title>
+ </head>
+ <body>
+ {{{ content }}}
+ </body>
+</html>
diff --git a/templates/new_post.html b/templates/new_post.html
index 93de696..a3a1a0f 100644
--- a/templates/new_post.html
+++ b/templates/new_post.html
@@ -1,29 +1,21 @@
-<!DOCTYPE html>
-<html>
- <head>
- <title>{{ title }}</title>
- </head>
- <body>
- <h1>Create a new post</h1>
- <form id="new_post" name="post" method="post" action="/posts/create">
- <div class="field">
- <label>Title:</label>
- <input type="text" name="title" value="{{ post.title }}">
- </div>
+<h1>Create a new post</h1>
+<form id="new_post" name="post" method="post" action="/posts/create">
+ <div class="field">
+ <label>Title:</label>
+ <input type="text" name="title" value="{{ post.title }}">
+ </div>
- <div class="field">
- <label>Contents:</label>
- <textarea name="body">{{ post.body }}</textarea>
- </div>
+ <div class="field">
+ <label>Contents:</label>
+ <textarea name="body">{{ post.body }}</textarea>
+ </div>
- <div class="field">
- <input type="checkbox" checked="{{ post.published }}">
- <label>Published</label>
- </div>
+ <div class="field">
+ <input type="checkbox" checked="{{ post.published }}">
+ <label>Published</label>
+ </div>
- <div class="actions">
- <input type="submit" value="Create post">
- </div>
- </form>
- </body>
-</html>
+ <div class="actions">
+ <input type="submit" value="Create post">
+ </div>
+</form>
diff --git a/templates/show_post.html b/templates/show_post.html
index 31c2ca3..9e633cc 100644
--- a/templates/show_post.html
+++ b/templates/show_post.html
@@ -1,19 +1,11 @@
-<!DOCTYPE html>
-<html>
- <head>
- <title>{{ post.title }}</title>
- </head>
- <body>
- <article class="post-teaser">
- {{# post. }}
- <header>
- <h1>{{ .title }}</h1>
- {{> post_actions.html }}
- </header>
- <section class="teaser">
- {{ .body }}
- </section>
- {{/ post }}
- </article>
- </body>
-</html>
+<article class="post-teaser">
+ {{# post. }}
+ <header>
+ <h1>{{ .title }}</h1>
+ {{> post_actions.html }}
+ </header>
+ <section class="teaser">
+ {{ .body }}
+ </section>
+ {{/ post }}
+</article>