feat(templates): Slightly less barebones index & thread templates

This commit is contained in:
Vincent Ambo 2018-04-09 23:37:21 +02:00
parent 7c73949066
commit fb7df7a346
2 changed files with 115 additions and 39 deletions

View file

@ -1,28 +1,41 @@
<!DOCTYPE html> <!doctype html>
<html> <html lang="en">
<head> <head>
<title>Converse Index page</title> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<title>Converse Index</title>
</head> </head>
<body> <body>
<h1>Welcome to Converse</h1> <header>
<ul> <nav class="navbar navbar-light bg-light justify-content-between mb-3">
{% for thread in threads -%} <a class="navbar-brand" href="/">
<li><a href="/thread/{{ thread.id }}">{{ thread.title }}</a> (posted at {{ thread.posted }} by {{ thread.author_name }})</li> <h2>Converse</h2>
{%- endfor %} </a>
</ul> <form class="form-inline">
<hr> <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search" disabled>
<form action="/thread/submit" method="post"> <button class="btn btn-outline-success my-2 my-sm-0 mr-1" type="submit" disabled>Search</button>
<div> <a class="btn btn-outline-secondary my-2" href="/thread/new">New thread</a>
<label for="title">Title:</label>
<input type="text" id="title" name="title">
</div>
<div>
<label for="body">Content:</label>
<textarea id="body" name="body"></textarea>
</div>
<div>
<input type="submit" value="Submit">
</div>
</form> </form>
</nav>
</header>
<div class="container">
<div class="row">
<div class="col-12">
<div class="list-group">
{% for thread in threads -%}
<a href="/thread/{{ thread.id }}" class="list-group-item list-group-item-action flex-column align-items-start">
<div class="d-flex w-100 justify-content-between">
<h5 class="mb-1">{{ thread.title }}</h5>
<small class="text-muted">{{ thread.posted }}</small>
</div>
<p class="mb-1">Created by {{ thread.author_name }}</p>
</a>
{%- endfor %}
</div>
</div>
</div>
</div>
</body> </body>
</html> </html>

View file

@ -1,26 +1,89 @@
<!DOCTYPE html> <!doctype html>
<html> <html lang="en">
<head> <head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<title>Converse: {{ thread.title }}</title> <title>Converse: {{ thread.title }}</title>
</head> </head>
<body> <body>
<h1>{{ thread.title }}</h1> <header>
<nav class="navbar navbar-light bg-light justify-content-between mb-3">
<a class="navbar-brand" href="/">
<h2>Converse</h2>
</a>
<form class="form-inline">
<a class="btn btn-outline-secondary my-2" href="/">Back to index</a>
</form>
</nav>
</header>
<div class="container">
<div class="row">
<div class="col-12">
<div class="list-group">
<div class="list-group-item flex-column">
<div class="row">
<div class="col-12">
<h3>{{ thread.title }}</h3>
</div>
</div>
</div>
<div class="list-group-item flex-column align-items-start">
<div class="row">
<div class="col-2 border-right">
<div class="row">
<div class="col-12">
<img src="https://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50" />
</div>
</div>
<div class="row">
<div class="col-12">
<strong>{{ thread.author_name }}</strong>
</div>
</div>
</div>
<div class="col-10">
{{ thread.body }}
</div>
<small class="text muted"> {{ thread.posted }} </small>
</div>
</div>
<p>{{ thread.body }}<br><i>Posted at {{ thread.posted }} by {{ thread.author_name }}</i></p>
{% for post in posts -%} {% for post in posts -%}
<li>{{ post.body }}<br><i>Posted at {{ post.posted }} by {{ post.author_name }}</i></li> <div class="list-group-item flex-column align-items-start">
<div class="row">
<div class="col-2 border-right">
<img src="https://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50" />
{{ post.author_name }}
</div>
<div class="col-10">
{{ post.body }}
</div>
<small class="text muted"> {{ post.posted }} </small>
</div>
</div>
{%- endfor %} {%- endfor %}
<div class="list-group-item flex-column align-items-start">
<hr> <div class="row">
<div class="col-12">
<form action="/thread/reply" method="post"> <form action="/thread/reply" method="post">
<input type="hidden" id="thread_id" name="thread_id" value="{{ thread.id }}"> <input type="hidden" id="thread_id" name="thread_id" value="{{ thread.id }}">
<div> <label for="body">You can use <strong>Markdown</strong>!</label>
<label for="body">Content:</label> <div class="input-group">
<textarea id="body" name="body"></textarea> <textarea class="form-control" id="body" name="body" aria-label="thread response"></textarea>
<div class="input-group-append">
<button class="btn btn-outline-primary" type="submit">Post!</button>
</div> </div>
<div>
<input type="submit" value="Reply">
</div> </div>
</form> </form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body> </body>
</html> </html>