summaryrefslogtreecommitdiff
path: root/src/templates
diff options
context:
space:
mode:
Diffstat (limited to 'src/templates')
-rw-r--r--src/templates/confirm_deletion.php2
-rw-r--r--src/templates/form_fields.php4
-rw-r--r--src/templates/index.php2
-rw-r--r--src/templates/view.php20
4 files changed, 26 insertions, 2 deletions
diff --git a/src/templates/confirm_deletion.php b/src/templates/confirm_deletion.php
index 85cf924..87ddf8a 100644
--- a/src/templates/confirm_deletion.php
+++ b/src/templates/confirm_deletion.php
@@ -14,7 +14,7 @@
<a href="/">Back</a>
<form action="/delete/" method="POST">
<input type="hidden" name="id" value="<?= $todo->id; ?>"/>
- <?= htmlentities("$todo->url | $todo->task | $todo->tag"); ?>
+ <?= htmlentities("$todo->task | $todo->tag"); ?>
<button type="submit">Delete</button>
</form>
<p>Copyright © 2021 David T. Sadler.</p>
diff --git a/src/templates/form_fields.php b/src/templates/form_fields.php
index 505cf26..3b58adb 100644
--- a/src/templates/form_fields.php
+++ b/src/templates/form_fields.php
@@ -2,6 +2,10 @@
<?php if ($errors->has('task')) { ?>
<p><?= htmlentities(implode(', ', $errors->get('task'))); ?></p>
<?php } ?>
+<label>Description<textarea name="description" maxlength="512" rows="8"><?= htmlspecialchars($old->get('description', $todo->description)); ?></textarea></label>
+<?php if ($errors->has('description')) { ?>
+ <p><?= htmlentities(implode(', ', $errors->get('description'))); ?></p>
+<?php } ?>
<label>Tag<input type="text" name="tag" maxlength="16" value="<?= htmlspecialchars($old->get('tag', $todo->tag)); ?>"></label>
<?php if ($errors->has('tag')) { ?>
<p><?= htmlentities(implode(', ', $errors->get('tag'))); ?></p>
diff --git a/src/templates/index.php b/src/templates/index.php
index d309b2c..5abe8b3 100644
--- a/src/templates/index.php
+++ b/src/templates/index.php
@@ -25,7 +25,7 @@
<ol>
<?php foreach ($todos as $todo) { ?>
<li>
- <?= htmlentities($todo->task); ?></a> | <?php if ($todo->tag) { ?><a class="no-decoration tag" href="/?tag=<?= htmlentities($todo->tag); ?>"><?= htmlentities($todo->tag); ?></a> | <?php } ?><a class="no-decoration" href="/edit/?id=<?= $todo->id; ?>">Edit</a> | <a class="no-decoration" href="/delete/confirm/?id=<?= $todo->id; ?>">Delete</a>
+ <a href="/view/?id=<?= $todo->id; ?>"><?= htmlentities($todo->task); ?></a> | <?php if ($todo->tag) { ?></a><a class="no-decoration tag" href="/?tag=<?= htmlentities($todo->tag); ?>"><?= htmlentities($todo->tag); ?></a> | <?php } ?><a class="no-decoration" href="/edit/?id=<?= $todo->id; ?>">Edit</a> | <a class="no-decoration" href="/delete/confirm/?id=<?= $todo->id; ?>">Delete</a>
</li>
<?php } ?>
</ol>
diff --git a/src/templates/view.php b/src/templates/view.php
new file mode 100644
index 0000000..35d4c36
--- /dev/null
+++ b/src/templates/view.php
@@ -0,0 +1,20 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <title>Edit - Todo</title>
+ <link rel="shortcut icon" href="/images/favicon.png">
+ <link rel="stylesheet" href="/css/site.css">
+ </head>
+ <body>
+ <section>
+ <h1>Todo</h1>
+ <h2>View</h2>
+ <a href="/">Back</a>
+ <h3><?= htmlentities("$todo->task | $todo->tag"); ?></h3>
+ <p><?= nl2br(htmlentities($todo->description), false); ?></p>
+ <p>Copyright © 2021 David T. Sadler.</p>
+ </section>
+ </body>
+</html>