]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
don't show some bookmark elements if empty
authorEvan Prodromou <evan@status.net>
Fri, 31 Dec 2010 00:21:22 +0000 (16:21 -0800)
committerEvan Prodromou <evan@status.net>
Fri, 31 Dec 2010 00:21:22 +0000 (16:21 -0800)
plugins/Bookmark/BookmarkPlugin.php
plugins/Bookmark/bookmark.css

index 99f25c64b89c41bf668600f99a67ec7a704c71f7..e6590bce34965500b05ea579d50295ca7915ab64 100644 (file)
@@ -263,13 +263,15 @@ class BookmarkPlugin extends Plugin
                               $att->noticeCount());
             }
 
-            $out->elementStart('ul', array('class' => 'bookmark_tags'));
-            
             // Replies look like "for:" tags
 
             $replies = $nli->notice->getReplies();
+            $tags = $nli->notice->getTags();
+
+            if (!empty($replies) || !empty($tags)) {
 
-            if (!empty($replies)) {
+                $out->elementStart('ul', array('class' => 'bookmark_tags'));
+            
                 foreach ($replies as $reply) {
                     $other = Profile::staticGet('id', $reply);
                     $out->elementStart('li');
@@ -280,45 +282,59 @@ class BookmarkPlugin extends Plugin
                     $out->elementEnd('li');
                     $out->text(' ');
                 }
-            }
 
-            $tags = $nli->notice->getTags();
+                foreach ($tags as $tag) {
+                    $out->elementStart('li');
+                    $out->element('a', 
+                                  array('rel' => 'tag',
+                                        'href' => Notice_tag::url($tag)),
+                                  $tag);
+                    $out->elementEnd('li');
+                    $out->text(' ');
+                }
 
-            foreach ($tags as $tag) {
-                $out->elementStart('li');
-                $out->element('a', 
-                              array('rel' => 'tag',
-                                    'href' => Notice_tag::url($tag)),
-                              $tag);
-                $out->elementEnd('li');
-                $out->text(' ');
+                $out->elementEnd('ul');
             }
 
-            $out->elementEnd('ul');
-
-            $out->element('p',
-                          array('class' => 'bookmark_description'),
-                          $nb->description);
+            if (!empty($nb->description)) {
+                $out->element('p',
+                              array('class' => 'bookmark_description'),
+                              $nb->description);
+            }
 
             if (common_config('attachments', 'show_thumbs')) {
-                $al = new InlineAttachmentList($notice, $out);
-                $al->show();
+                $haveThumbs = false;
+                foreach ($atts as $check) {
+                    $thumbnail = File_thumbnail::staticGet('file_id', $check->id);
+                    if (!empty($thumbnail)) {
+                        $haveThumbs = true;
+                        break;
+                    }
+                }
+                if ($haveThumbs) {
+                    $al = new InlineAttachmentList($notice, $out);
+                    $al->show();
+                }
             }
 
-            $out->elementStart('p', array('style' => 'float: left'));
+            $out->elementStart('p', array('class' => 'bookmark_info'));
 
             $avatar = $profile->getAvatar(AVATAR_MINI_SIZE);
 
-            $out->element('img', array('src' => ($avatar) ?
-                                       $avatar->displayUrl() :
-                                       Avatar::defaultImage(AVATAR_MINI_SIZE),
-                                       'class' => 'avatar photo bookmark_avatar',
-                                       'width' => AVATAR_MINI_SIZE,
-                                       'height' => AVATAR_MINI_SIZE,
-                                       'alt' => $profile->getBestName()));
+            $out->element('img', 
+                          array('src' => ($avatar) ?
+                                $avatar->displayUrl() :
+                                Avatar::defaultImage(AVATAR_MINI_SIZE),
+                                'class' => 'avatar photo bookmark_avatar',
+                                'width' => AVATAR_MINI_SIZE,
+                                'height' => AVATAR_MINI_SIZE,
+                                'alt' => $profile->getBestName()));
+
             $out->raw('&nbsp;');
-            $out->element('a', array('href' => $profile->profileurl,
-                                     'title' => $profile->getBestName()),
+
+            $out->element('a', 
+                          array('href' => $profile->profileurl,
+                                'title' => $profile->getBestName()),
                           $profile->nickname);
 
             $nli->showNoticeLink();
@@ -758,4 +774,3 @@ class BookmarkPlugin extends Plugin
                 $activity->objects[0]->type == ActivityObject::BOOKMARK);
     }
 }
-
index b86e749fd97e1bd6c5df8ea0ab32ad529c51fb54..22e7f99ce4e76b776fbd085f717c065f938055aa 100644 (file)
@@ -2,3 +2,4 @@
 .bookmark_mentions li { display: inline; }
 .bookmark_avatar { float: left }
 .bookmark_notice_count { float: right }
+.bookmark_info { float: left }