diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2018-01-14 12:39:50 +0100 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2018-01-14 12:39:50 +0100 |
commit | 0dae37a2e98c13fbc78acd58b86565fd6f14c654 (patch) | |
tree | 681be6b03971acca3f57fd30d613909b60aaa984 /templates | |
parent | a77f6e9d27f98bc36d0911ce58c109f4a18bd835 (diff) | |
download | rocket-blog-0dae37a2e98c13fbc78acd58b86565fd6f14c654.tar.gz rocket-blog-0dae37a2e98c13fbc78acd58b86565fd6f14c654.tar.bz2 rocket-blog-0dae37a2e98c13fbc78acd58b86565fd6f14c654.zip |
Split out layout from templates.
Diffstat (limited to 'templates')
-rw-r--r-- | templates/edit_post.html | 46 | ||||
-rw-r--r-- | templates/index.html | 12 | ||||
-rw-r--r-- | templates/layout.html | 9 | ||||
-rw-r--r-- | templates/new_post.html | 44 | ||||
-rw-r--r-- | templates/show_post.html | 30 |
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> |