aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--controllers/list.php4
-rw-r--r--views/list/new/index.php12
-rw-r--r--views/profile/index.php12
-rw-r--r--views/styles.css13
4 files changed, 37 insertions, 4 deletions
diff --git a/controllers/list.php b/controllers/list.php
index 7bbb739..0561700 100644
--- a/controllers/list.php
+++ b/controllers/list.php
@@ -6,11 +6,13 @@ use Exception;
function on_post() {
global $TOKEN;
global $list_status;
+ global $lid;
$list_status = "";
+ $lid = 0;
try {
$uid = Database\Cookie::fromDB($TOKEN)->UID;
- Database\ArchiveList::create($uid, $_POST["name"], $_POST["description"]);
+ $lid = Database\ArchiveList::create($uid, $_POST["name"], $_POST["description"]);
}
catch(Exception $e) {
$list_status = $e;
diff --git a/views/list/new/index.php b/views/list/new/index.php
index 72ac7a3..7f1aaf5 100644
--- a/views/list/new/index.php
+++ b/views/list/new/index.php
@@ -1,3 +1,7 @@
+<?php
+ if (isset($list_status) && $list_status === "") {
+ }
+?>
<script type="text/javascript">
if (!cookieStorage.getItem('token')) {
window.location.href = '/login';
@@ -8,16 +12,20 @@
<hr class="new-section"/>
-<form action="#" method="POST">
+<form action="#" method="POST" class="font-115 flex-col-centered max-width-20 center-margin">
<?php if (isset($list_status)): ?>
<?php if ($list_status !== ""): ?>
<p class="item error"><span>
<strong>Error:</strong> <?= $list_status ?>
</span></p>
+ <?php else: ?>
+ <script type="text/javascript">
+ window.location.href = '/list/<?= $lid ?>';
+ </script>
<?php endif; ?>
<?php endif; ?>
<input type="text" name="name" placeholder="List title" minlength="1">
<textarea name="description" placeholder="Description"></textarea>
- <input type="submit" value="Login">
+ <input type="submit" value="Create">
</form>
diff --git a/views/profile/index.php b/views/profile/index.php
index c1e067d..4ade4e7 100644
--- a/views/profile/index.php
+++ b/views/profile/index.php
@@ -15,6 +15,18 @@
<div class="user-blank-afterspace"></div>
+ <section id="user-buttons" hidden>
+ <form action="/list/new" method="GET">
+ <input type="submit" value="Create a new list">
+ </form>
+ </section>
+ <script type="text/javascript">
+ function showUserButtons() {
+ document.getElementById('user-buttons').hidden = false;
+ }
+ authenticated(showUserButtons);
+ </script>
+
<nav id="user-nav">
<button id="openArchives" onclick="openArchives()">Archives</button>
<button id="openLists" onclick="openLists()" class="not-selected">Lists</button>
diff --git a/views/styles.css b/views/styles.css
index 440da4e..e2a712f 100644
--- a/views/styles.css
+++ b/views/styles.css
@@ -45,7 +45,7 @@ h1 {
text-align: center;
}
-input, button {
+input, button, textarea {
color: inherit;
background-image: url(/paper.jpg);
@@ -63,6 +63,11 @@ input, button {
box-shadow: 0 0 0.4em var(--dark-purple);
}
+textarea {
+ resize: vertical;
+ min-height: 4em;
+}
+
input[type=text]:focus {
outline: 2px solid var(--highlight-border-color);
}
@@ -394,6 +399,12 @@ hr.new-section {
height: 4em;
}
+#user-buttons {
+ margin: 0 1em 2em 1em;
+ display: flex;
+ flex-direction: row;
+}
+
#user-nav {
display: flex;
flex-direction: row;