]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
use subclassing to change notice list output for single notice
authorEvan Prodromou <evan@status.net>
Mon, 8 Nov 2010 18:08:59 +0000 (13:08 -0500)
committerEvan Prodromou <evan@status.net>
Mon, 8 Nov 2010 18:08:59 +0000 (13:08 -0500)
actions/shownotice.php
lib/noticelist.php

index 7cc6c54243ac2e1e80493e210c173d2fb140e0c0..b7e61a13754ab6b0b912cf2f3afe5cddd738d631 100644 (file)
@@ -331,6 +331,32 @@ class SingleNoticeItem extends DoFollowListItem
         $this->showEnd();
     }
 
+    /**
+     * show the avatar of the notice's author
+     *
+     * We use the larger size for single notice page.
+     * 
+     * @return void
+     */
+
+    function showAvatar()
+    {
+       $avatar_size = AVATAR_PROFILE_SIZE;
+
+        $avatar = $this->profile->getAvatar($avatar_size);
+
+        $this->out->element('img', array('src' => ($avatar) ?
+                                         $avatar->displayUrl() :
+                                         Avatar::defaultImage($avatar_size),
+                                         'class' => 'avatar photo',
+                                         'width' => $avatar_size,
+                                         'height' => $avatar_size,
+                                         'alt' =>
+                                         ($this->profile->fullname) ?
+                                         $this->profile->fullname :
+                                         $this->profile->nickname));
+    }
+
     function showNoticeAttachments() {
         $al = new AttachmentList($this->notice, $this->out);
         $al->show();
index bdf2530b34dc3b40366f50d9adfcaf81da4d8df7..6f82c9269b1c5795a08b8f0469df4168168a096b 100644 (file)
@@ -327,11 +327,8 @@ class NoticeListItem extends Widget
 
     function showAvatar()
     {
-        if ('shownotice' === $this->out->trimmed('action')) {
-            $avatar_size = AVATAR_PROFILE_SIZE;
-        } else {
-            $avatar_size = AVATAR_STREAM_SIZE;
-        }
+       $avatar_size = AVATAR_STREAM_SIZE;
+
         $avatar = $this->profile->getAvatar($avatar_size);
 
         $this->out->element('img', array('src' => ($avatar) ?