<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
% if $proj == nil then
<title>new project - {{$title}}</title>
% else
<title>edit {{$proj.name}} - {{$title}}</title>
% end
<style>
.centered { text-align: center; }
% include view/menu.css
% include view/form.css
</style>
</head>
<body>
% include view/menu.html
<h1 class="centered">project</h1>
% if $proj == nil then
% set action = "/p"
% set proj = {name="", desc="", goal="", color="#000000", priority=0}
% set submit_value = "Create"
% else
% set action = "/p/" .. $proj.name .. "/put"
% set submit_value = "Save"
% end
<form action="{{$action}}" method="post">
<table class="field-list">
<tbody>
<tr>
<td>
<label for="name">Name:</label>
</td>
<td>
<input
type="text" class="flat-field" id="name" name="name" required
pattern="[-_A-Za-z0-9]+" value="{{$proj.name}}" autofocus>
</td>
</tr>
<tr>
<td>
<label for="desc">Description:</label>
</td>
<td>
<input
type="text" class="flat-field" id="desc" name="desc" size="30"
value="{{$proj.desc}}">
</td>
</tr>
<tr>
<td>
<label for="goal">Goal:</label>
</td>
<td>
<input
type="text" class="flat-field" id="goal" name="goal" size="50"
value="{{$proj.goal}}">
</td>
</tr>
<tr>
<td>
<label for="color">Color:</label>
</td>
<td>
<input
type="color" class="flat-field" id="color" name="color"
value="{{$proj.color}}">
</td>
</tr>
<tr>
<td>
<label for="priority">Priority:</label>
</td>
<td>
<input
type="number" class="flat-field" id="priority" name="priority"
required value="{{$proj.priority}}">
</td>
</tr>
</tbody>
</table>
<br>
<input type="submit" class="flat-button" value="{{$submit_value}}">
</form>
</body>
</html>