Rocket/examples/todo/templates/index.html.tera

70 lines
2.4 KiB
Plaintext

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Rocket Todo Example</title>
<meta name="description" content="A todo application written in Rocket.">
<meta name="author" content="Sergio Benitez">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="//fonts.googleapis.com/css?family=Raleway:400,300,600" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="/css/normalize.css">
<link rel="stylesheet" href="/css/skeleton.css">
<link rel="stylesheet" href="/css/style.css">
<link rel="icon" type="image/png" href="/images/favicon.png">
</head>
<body>
<div class="container">
<p><!--Nothing to see here --></p>
<div class="row">
<h4>Rocket Todo</h4>
<form action="/todo" method="post">
<div class="ten columns">
<input type="text" placeholder="enter a task description..."
name="description" id="description" value="" autofocus
class="u-full-width {% if msg %}field-{{msg.0}}{% endif %}" />
{% if msg %}
<small class="field-{{msg.0}}-msg">
{{ msg.1 }}
</small>
{% endif %}
</div>
<div class="two columns">
<input type="submit" value="add task">
</div>
</form>
</div>
<div class="row">
<div class="twelve columns">
<ul>
{% for task in tasks %}
{% if task.completed %}
<li>
<span class="completed">{{ task.description }}</span>
<form class="inline" action="/todo/{{task.id}}" method="post">
<input type="hidden" name="_method" value="put" />
<button class="small" type="submit">undo</button>
</form>
<form class="inline" action="/todo/{{task.id}}" method="post">
<input type="hidden" name="_method" value="delete" />
<button class="primary small" type="submit">delete</button>
</form>
</li>
{% else %}
<li>
<form class="link" action="/todo/{{task.id}}" method="post">
<input type="hidden" name="_method" value="put" />
<button class="link" type="submit">{{ task.description }}</button>
</form>
</li>
{% endif %}
{% endfor %}
</ul>
</div>
</div>
</div>
</body>
</html>