diff options
Diffstat (limited to 'src/templates')
| -rw-r--r-- | src/templates/confirm_deletion.php | 23 | ||||
| -rw-r--r-- | src/templates/create.php | 22 | ||||
| -rw-r--r-- | src/templates/edit.php | 23 | ||||
| -rw-r--r-- | src/templates/form_fields.php | 8 | ||||
| -rw-r--r-- | src/templates/index.php | 35 | 
5 files changed, 111 insertions, 0 deletions
diff --git a/src/templates/confirm_deletion.php b/src/templates/confirm_deletion.php new file mode 100644 index 0000000..85cf924 --- /dev/null +++ b/src/templates/confirm_deletion.php @@ -0,0 +1,23 @@ +<!doctype html> +<html lang="en"> +    <head> +        <meta charset="utf-8"> +        <meta name="viewport" content="width=device-width, initial-scale=1"> +        <title>Confirm - Todo</title> +        <link rel="shortcut icon" href="/images/favicon.png"> +        <link rel="stylesheet" href="/css/site.css"> +    </head> +    <body> +        <section> +            <h1>Todo</h1> +            <h2>Confirm Deletion</h2> +            <a href="/">Back</a> +            <form action="/delete/" method="POST"> +                <input type="hidden" name="id" value="<?= $todo->id; ?>"/> +                <?= htmlentities("$todo->url | $todo->task | $todo->tag"); ?> +                <button type="submit">Delete</button> +            </form> +            <p>Copyright © 2021 David T. Sadler.</p> +        </section> +    </body> +</html> diff --git a/src/templates/create.php b/src/templates/create.php new file mode 100644 index 0000000..81ec7f8 --- /dev/null +++ b/src/templates/create.php @@ -0,0 +1,22 @@ +<!doctype html> +<html lang="en"> +    <head> +        <meta charset="utf-8"> +        <meta name="viewport" content="width=device-width, initial-scale=1"> +        <title>Add - Todo</title> +        <link rel="shortcut icon" href="/images/favicon.png"> +        <link rel="stylesheet" href="/css/site.css"> +    </head> +    <body> +        <section> +            <h1>Todo</h1> +            <h2>Add</h2> +            <a href="/">Back</a> +            <form action="/store/" method="POST"> +                <?php require_once('form_fields.php'); ?> +                <button type="submit">Add</button> +            </form> +            <p>Copyright © 2021 David T. Sadler.</p> +        </section> +    </body> +</html> diff --git a/src/templates/edit.php b/src/templates/edit.php new file mode 100644 index 0000000..9a8a1a6 --- /dev/null +++ b/src/templates/edit.php @@ -0,0 +1,23 @@ +<!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>Edit</h2> +            <a href="/">Back</a> +            <form action="/update/" method="POST"> +                <input type="hidden" name="id" value="<?= $todo->id; ?>"/> +                <?php require_once('form_fields.php'); ?> +                <button type="submit">Update</button> +            </form> +            <p>Copyright © 2021 David T. Sadler.</p> +        </section> +    </body> +</html> diff --git a/src/templates/form_fields.php b/src/templates/form_fields.php new file mode 100644 index 0000000..505cf26 --- /dev/null +++ b/src/templates/form_fields.php @@ -0,0 +1,8 @@ +<label>Task<input type="text" name="task" maxlength="256" value="<?= htmlspecialchars($old->get('task', $todo->task)); ?>"></label> +<?php if ($errors->has('task')) { ?> +    <p><?= htmlentities(implode(', ', $errors->get('task'))); ?></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> +<?php } ?> diff --git a/src/templates/index.php b/src/templates/index.php new file mode 100644 index 0000000..d309b2c --- /dev/null +++ b/src/templates/index.php @@ -0,0 +1,35 @@ +<!doctype html> +<html lang="en"> +    <head> +        <meta charset="utf-8"> +        <meta name="viewport" content="width=device-width, initial-scale=1"> +        <title>Todo</title> +        <link rel="shortcut icon" href="/images/favicon.png"> +        <link rel="stylesheet" href="/css/site.css"> +    </head> +    <body> +        <section> +            <h1>Todo</h1> +            <?php if ($message) { ?> +                <p class="message"><?= $message; ?></p> +            <?php } ?> +            <a href="/create/">Add Todo</a> +            <h2>Tags</h2> +            <ul> +                <a href="/">All</a> +                <?php foreach($todos->tags() as $tag) { ?> +                    <li><a href="/?tag=<?= htmlentities($tag); ?>"><?= htmlentities($tag); ?></a></li> +                <?php } ?> +            </ul> +            <h2>Todo</h2> +            <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> +                    </li> +                <?php } ?> +            </ol> +            <p>Copyright © 2021 David T. Sadler.</p> +        </section> +    </body> +</html>  | 
