aboutsummaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
authorSyndamia <kamen@syndamia.com>2025-02-09 19:59:10 +0200
committerSyndamia <kamen@syndamia.com>2025-02-09 19:59:10 +0200
commitaa600d9b16f73ba3af5e42fc1558e710ae955b5b (patch)
tree042fb25832780ba6ff06a88016f6be734ae1dd94 /views
parentd081c605227d9210e5b02a308272452283cf47d7 (diff)
downloadnowayforward_human-aa600d9b16f73ba3af5e42fc1558e710ae955b5b.tar
nowayforward_human-aa600d9b16f73ba3af5e42fc1558e710ae955b5b.tar.gz
nowayforward_human-aa600d9b16f73ba3af5e42fc1558e710ae955b5b.zip
feat(views/list): Add buttons to items
Diffstat (limited to 'views')
-rw-r--r--views/img/edit.svg1
-rw-r--r--views/list/item.php14
-rw-r--r--views/styles.css12
3 files changed, 21 insertions, 6 deletions
diff --git a/views/img/edit.svg b/views/img/edit.svg
new file mode 100644
index 0000000..4646926
--- /dev/null
+++ b/views/img/edit.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="list-icon"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1" /><path d="M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z" /><path d="M16 5l3 3" /></svg>
diff --git a/views/list/item.php b/views/list/item.php
index 17a6a59..0146dbe 100644
--- a/views/list/item.php
+++ b/views/list/item.php
@@ -13,7 +13,17 @@
</p>
</section>
<section name="itemButton" hidden>
- <span><!-- Edit button --></span>
- <span><!-- Delete button --></span>
+ <?php if ($user !== null && $user->UID === $list->AuthorUID): ?>
+ <form action="/list/update" method="GET">
+ <input type="hidden" name="lid" value="<?= $list->LID ?>">
+ <button><?php include $VIEWS_DIR . '/img/edit.svg' ?></button>
+ </form>
+ <?php endif; ?>
+ <?php if ($user !== null && ($user->UID === $list->AuthorUID || $user->Role === 'Admin')): ?>
+ <form action="/list/delete" method="GET">
+ <input type="hidden" name="lid" value="<?= $list->LID ?>">
+ <button><?php include $VIEWS_DIR . '/img/delete.svg' ?></button>
+ </form>
+ <?php endif; ?>
</section>
</section>
diff --git a/views/styles.css b/views/styles.css
index fecbfeb..0ec7895 100644
--- a/views/styles.css
+++ b/views/styles.css
@@ -328,7 +328,7 @@ hr.new-section {
border-color: var(--dark-green);
}
-.item [name=itemButton], .item .global-buttons {
+[name=itemButton], .item .global-buttons {
border-left: 3px solid var(--dark-purple);
margin: -0.5em 0 -0.5em 0.5em;
padding: 0.5em 0 0.5em 0.5em;
@@ -337,14 +337,18 @@ hr.new-section {
gap: 0.3em;
}
-.item [name=itemButton] > *, .item .global-buttons > * {
+.list [name=itemButton] {
+ border-color: var(--cherry);
+}
+
+[name=itemButton] > *, .item .global-buttons > * {
display: flex;
align-items: end;
flex: 1;
}
-.item [name=itemButton] input,
-.item [name=itemButton] button,
+[name=itemButton] input,
+[name=itemButton] button,
.item .global-buttons input,
.item .global-buttons button {
box-shadow: none;