Browse Source

add .html views to /templates/users (part of Chapter 5).

These are new files I created whilst working through Chapter 5. They
are just '.html' template files which connect to the new (URL) routes
created in Chapter 5.
master
Craig Oates 2 years ago
parent
commit
c5f6122b63
  1. 40
      templates/users/index.html
  2. 54
      templates/users/show.html

40
templates/users/index.html

@ -0,0 +1,40 @@
{% extends "layouts/app.html" %}
{% block title %}{% lisp (title! "list of users") %}{% endblock %}
{% block content %}
<h1>{% lisp (title!) %}</h1>
<form class="search" action="/user/search" accept-charset="UTF=8" method="get">
<input name="utf=8" type="hidden" value="v"/>
<input type="text" name="q" id="q"/>
<input type="submit" name="commit" value="search" data-disable-with="search"/>
</form>
<div class="toolbar"><a href="/user/new">Add a New User</a></div>
{% if users %}
<table class="list">
<thead>
<tr>
<th>Number</th>
<th>Name</th>
<th>Full Name</th>
<th>Operation</th>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr>
<td style="text-align: right">{{user.number}}</td>
<td><a href="/users/{{user.id}}">{{user.name}}</a></td>
<td>{{user.full-name}}</td>
<td>
<a href="/user/{{user.id}}/edit">Edit</a> |
<a data-confirm="Really delete it?"
rel="nofollow" data-method="delete"
href="/user/{{user.id}}">Delete
</a>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>There are no accounts on this site.</p>
{% endif %}
{% endblock %}

54
templates/users/show.html

@ -0,0 +1,54 @@
{% extends "layouts/app.html" %}
{% block title %}{% lisp (title! "User detail") %}{% endblock %}
{% block content %}
<h1>{% lisp (title!) %}</h1>
<div class="toolbar"><a href="/users/{{id}}/edit">Edit</a></div>
<table class="attr">
<tr>
<th width="150">Number</th>
<td>{{user.number}}</td>
</tr>
<tr>
<th>Name</th>
<td>{{user.name}}</td>
</tr>
<tr>
<th>Full name</th>
<td>{{user.full-name}}</td>
</tr>
<tr>
<th>Sex</th>
<td>
{% ifequal user.sex 1 %}
Male
{% else %}
Female
{% endifequal %}
</td>
</tr>
<tr>
<th>Birthday</th>
<td>
{{ user.birthday|
lisp: local-time:timestamp-to-universal|
date: ((:year 4)"/"(:month 2)"/"(:day 2)) }}
</td>
</tr>
<tr>
<th>Mail adress</th>
<td>{{user.email}}</td>
</tr>
<tr>
<th>administrator</th>
<td>
{% if user.administrator %}
Yes
{% else %}
No
{% endif %}
</td>
</tr>
</table>
{% endblock %}
Loading…
Cancel
Save