]> 91.132.146.200 Git - insipid.git/commitdiff
new home layout
authorBanana <mail@bananas-playground.net>
Tue, 21 Nov 2023 11:29:44 +0000 (12:29 +0100)
committerBanana <mail@bananas-playground.net>
Tue, 21 Nov 2023 11:29:44 +0000 (12:29 +0100)
ChangeLog
webroot/asset/css/style.css
webroot/lib/link.class.php
webroot/lib/management.class.php
webroot/view/home.inc.php
webroot/view/home.php

index 2f6126371bed68b8da42270cbacefbd3bcc49d9a..e6819ea35ac3da8c63d9d3f2176477085814b0ad 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
 version 2.x.x - Griffin Chapel ()
     + Better logging
+    + New home screen layout
 
 version 2.8.2 - Dragon Chapel (2023-09-14)
 
index b8e872d7b62dd895dd349a5515bc465c871edcb0..38b7cf7f8fbc659f93a6cb8d15c496d355aba308 100644 (file)
@@ -26,6 +26,10 @@ h4 a {
        border-top: 1px solid #cccccc;
 }
 
+.ddTags:not(:last-child) {
+       margin-bottom: inherit;
+}
+
 /* overwrites */
 .section {
        padding-top: 1.5rem;
index e15e17ed7e1099e2a9119f78a335b1aeb9fc258b..8b8a0fd0d55c3ea97169883658bc687d883be453 100644 (file)
@@ -125,6 +125,8 @@ class Link {
 
                     # add stuff
                     $this->_image();
+                    $this->_tags();
+                    $this->_categories();
                 }
             } catch (Exception $e) {
                 Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
@@ -147,6 +149,8 @@ class Link {
             && isset($data['title']) && isset($data['hash']) && isset($data['description']) && isset($data['image'])) {
             $this->_data = $data;
             $this->_image();
+            $this->_tags();
+            $this->_categories();
         }
 
         return $this->_data;
index 315638b789f1e78599924f71ad89a0ed82039a11..25ed19705d6aa9f1027b467b2f4aa1b9173501dc 100644 (file)
@@ -231,7 +231,7 @@ class Management {
     public function latestLinks(string $limit="5"): array {
         $ret = array();
 
-        $queryStr = "SELECT `title`, `link` FROM `".DB_PREFIX."_link` AS t";
+        $queryStr = "SELECT `hash` FROM `".DB_PREFIX."_link` AS t";
         $queryStr .= " WHERE ".$this->_decideLinkTypeForQuery();
         $queryStr .= " ORDER BY `created` DESC";
         if(!empty($limit)) {
@@ -243,7 +243,11 @@ class Management {
         try {
             $query = $this->DB->query($queryStr);
             if(!empty($query) && $query->num_rows > 0) {
-                $ret = $query->fetch_all(MYSQLI_ASSOC);
+                while($result = $query->fetch_assoc()) {
+                    $linkObj = new Link($this->DB);
+                    $ret[] = $linkObj->loadShortInfo($result['hash']);
+
+                }
             }
         } catch (Exception $e) {
             Summoner::sysLog("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage());
@@ -699,7 +703,6 @@ class Management {
         return $ret;
     }
 
-
     /**
      * amount of tags
      *
index fddd3a0b1862272031538b3145d61df4a6b5025c..6c98c23e20775cbe090cde3db90bfd55722898ce 100644 (file)
@@ -186,5 +186,4 @@ if($showAddForm === true) {
     $existingCategories = $Management->categories();
     $existingTags = $Management->tags();
 }
-$latestLinks = $Management->latestLinks(20);
-$orderedCategories = $Management->categoriesByDateAdded();
+$latestLinks = $Management->latestLinks(50);
index c3dc13cc9a862a4fce1b413c009aa20a6541aa1d..5c830c621338835000a349db6a2cdedfa8b2413e 100644 (file)
                        <div class="content">
                                <h4><a href="index.php?p=overview&m=all"><?php echo $T->t('home.last.added'); ?></a></h4>
 <?php if(!empty($latestLinks)) { ?>
-                               <div class="tags">
+                               <dl>
 <?php foreach ($latestLinks as $ll) { ?>
-                                       <a class="tag is-link" href="<?php echo $ll['link']; ?>" target="_blank"><?php echo $ll['title']; ?></a>
+                                       <dt>
+                        <a href="<?php echo $ll['link']; ?>" target="_blank"><?php echo $ll['title']; ?></a>
+                        <a href="index.php?p=linkinfo&id=<?php echo $ll['hash']; ?>"><i class="ion-md-information-circle-outline"></i></a>
+                    </dt>
+                    <dd class="tags ddTags">
+                    <?php foreach ($ll['tags'] as $tid=>$tname) {
+                        echo '<a href="index.php?p=overview&m=tag&id='.$tid.'" class="tag is-white" title="'.$T->t('view.tag').'">'.$tname.'</a>';
+                    } ?>
+                    <?php foreach ($ll['categories'] as $cid=>$cname) {
+                        echo '<a href="index.php?p=overview&m=category&id='.$cid.'" class="tag is-white" title="'.$T->t('view.category').'">'.$cname.'</a>';
+                    } ?>
+                    </dd>
 <?php } ?>
-                               </div>
-<?php } ?>
-                       </div>
-               </div>
-       </div>
-</section>
-
-
-<section class="section">
-       <div class="columns is-multiline">
-<?php
-       if(!empty($orderedCategories)) {
-               foreach ($orderedCategories as $k=>$v) {
-                       $links = $Management->linksByCategory($v['id']);
-?>
-               <div class="column is-one-quarter">
-                       <div class="content">
-                               <h4><a href="?p=overview&m=category&id=<?php echo urlencode($v['id']); ?>"><?php echo $v['name']; ?></a></h4>
-                               <ul>
-<?php foreach ($links['results'] as $link) { ?>
-                                       <li><a class="" href="<?php echo $link['link']; ?>" target="_blank"><?php echo $link['title']; ?></a></li>
+                               </dl>
 <?php } ?>
-                               </ul>
                        </div>
                </div>
-<?php
-               }
-       }
-?>
        </div>
 </section>