issue: indicate image presence in overview
authorMischa POSLAWSKY <perl@shiar.org>
Sun, 1 Dec 2019 22:14:15 +0000 (23:14 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Thu, 5 Dec 2019 18:02:07 +0000 (19:02 +0100)
Advertise uploads as they are proverbially worth more than text replies.

issue/index.php

index cefe00f363f8765f22faa649267ebfbab2efe751..8a3d9078627a0a9f998dd654f28855362d89574f 100644 (file)
@@ -52,8 +52,9 @@ if ($_POST) {
                $_POST = [];
 }
 
-$cols = "*, (SELECT count(*) FROM comments WHERE"
-       . " page=i.page||'/'||i.id AND message IS NOT NULL) AS replycount";
+$subsql = "SELECT count(*) FROM comments WHERE page=i.page||'/'||i.id";
+$cols = "*, ($subsql AND message IS NOT NULL) AS replycount";
+$cols .= ", ($subsql AND message ~ 'img') AS imagecount";
 $sql = "SELECT $cols FROM issues i WHERE page = ?";
 if (isset($_GET['open'])) {
        $sql .= ' AND closed IS NULL';
@@ -75,7 +76,8 @@ while ($row = $query->fetch()) {
                        htmlspecialchars($row->subject)),
                showdate(array_slice(preg_split('/\D/', $row->updated), 0, 3)),
                implode(' ', [
-                       $row->replycount ? sprintf('<span class=right>+%d</span>', $row->replycount) : '',
+                       $row->imagecount ? sprintf('<span class=right><i class="right icon images" title="afbeeldingen">*</i></span>') : '',
+                       $row->replycount ? sprintf('<span class=right><i class="icon replies" title="reacties">+</i>%d</span>', $row->replycount) : '',
                        isset($row->assign) ? '<em class="right">'.$row->assign.'</em>' : '',
                ])
        );