Browse Source

Make table on homepage responsive

Skylar Ittner 3 months ago
parent
commit
050e13cbe8
1 changed files with 48 additions and 46 deletions
  1. 48
    46
      pages/home.php

+ 48
- 46
pages/home.php View File

@@ -22,53 +22,55 @@ include __DIR__ . "/../bits/navbar.php";
22 22
 
23 23
     </div>
24 24
 
25
-    <table id="questions" class="table table-hover mt-4">
26
-        <thead>
27
-            <tr>
28
-                <th data-priority="0"></th>
29
-                <th data-priority="1"><i class="far fa-fw fa-question-circle d-none d-md-inline"></i> Question</th>
30
-                <th data-priority="2"><i class="fas fa-fw fa-link d-none d-md-inline"></i> Code</th>
31
-                <th data-priority="2"><i class="fas fa-fw fa-list d-none d-md-inline"></i> Answers</th>
32
-                <th data-priority="1"><i class="fas fa-fw fa-reply-all d-none d-md-inline"></i> Responses</th>
33
-            </tr>
34
-        </thead>
35
-        <tbody>
36
-            <?php
37
-            $table = $database->select("questions", ['qid', 'qtext', 'qcode']);
38
-            foreach ($table as $row) {
39
-                $answers = $database->count("answers", ['qid' => $row['qid']]);
40
-                $responses = $database->count("responses", ['qid' => $row['qid']]);
41
-                ?>
25
+    <div class="table-responsive">
26
+        <table id="questions" class="table table-hover mt-4">
27
+            <thead>
42 28
                 <tr>
43
-                    <td>
44
-                        <a class="btn btn-sm btn-info" href="<?php echo "./q/" . $row['qcode']; ?>">
45
-                            <i class="fas fa-chart-bar"></i> Results
46
-                        </a>
47
-                    </td>
48
-                    <td>
49
-                        <?php echo $row['qtext']; ?>
50
-                    </td>
51
-                    <td>
52
-                        <?php echo $row['qcode']; ?>
53
-                    </td>
54
-                    <td>
55
-                        <?php echo $answers; ?>
56
-                    </td>
57
-                    <td>
58
-                        <?php echo $responses; ?>
59
-                    </td>
29
+                    <th data-priority="0"></th>
30
+                    <th data-priority="1"><i class="far fa-fw fa-question-circle d-none d-md-inline"></i> Question</th>
31
+                    <th data-priority="2"><i class="fas fa-fw fa-link d-none d-md-inline"></i> Code</th>
32
+                    <th data-priority="2"><i class="fas fa-fw fa-list d-none d-md-inline"></i> Answers</th>
33
+                    <th data-priority="1"><i class="fas fa-fw fa-reply-all d-none d-md-inline"></i> Responses</th>
60 34
                 </tr>
35
+            </thead>
36
+            <tbody>
61 37
                 <?php
62
-            }
63
-            ?>
64
-        </tbody>
65
-        <tfoot>
66
-            <tr>
67
-                <th data-priority="0"></th>
68
-                <th data-priority="1"><i class="far fa-fw fa-question-circle d-none d-md-inline"></i> Question</th>
69
-                <th data-priority="2"><i class="fas fa-fw fa-link d-none d-md-inline"></i> Code</th>
70
-                <th data-priority="2"><i class="fas fa-fw fa-list d-none d-md-inline"></i> Answers</th>
71
-                <th data-priority="1"><i class="fas fa-fw fa-reply-all d-none d-md-inline"></i> Responses</th>
72
-        </tfoot>
73
-    </table>
38
+                $table = $database->select("questions", ['qid', 'qtext', 'qcode']);
39
+                foreach ($table as $row) {
40
+                    $answers = $database->count("answers", ['qid' => $row['qid']]);
41
+                    $responses = $database->count("responses", ['qid' => $row['qid']]);
42
+                    ?>
43
+                    <tr>
44
+                        <td>
45
+                            <a class="btn btn-sm btn-info" href="<?php echo "./q/" . $row['qcode']; ?>">
46
+                                <i class="fas fa-chart-bar"></i> Results
47
+                            </a>
48
+                        </td>
49
+                        <td>
50
+                            <?php echo $row['qtext']; ?>
51
+                        </td>
52
+                        <td>
53
+                            <?php echo $row['qcode']; ?>
54
+                        </td>
55
+                        <td>
56
+                            <?php echo $answers; ?>
57
+                        </td>
58
+                        <td>
59
+                            <?php echo $responses; ?>
60
+                        </td>
61
+                    </tr>
62
+                    <?php
63
+                }
64
+                ?>
65
+            </tbody>
66
+            <tfoot>
67
+                <tr>
68
+                    <th data-priority="0"></th>
69
+                    <th data-priority="1"><i class="far fa-fw fa-question-circle d-none d-md-inline"></i> Question</th>
70
+                    <th data-priority="2"><i class="fas fa-fw fa-link d-none d-md-inline"></i> Code</th>
71
+                    <th data-priority="2"><i class="fas fa-fw fa-list d-none d-md-inline"></i> Answers</th>
72
+                    <th data-priority="1"><i class="fas fa-fw fa-reply-all d-none d-md-inline"></i> Responses</th>
73
+            </tfoot>
74
+        </table>
75
+    </div>
74 76
 </div>