From ed6d5c6e7a86d4e548a46f456f0314f1fbbe1c61 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 17 Mar 2011 14:19:03 -0700 Subject: [PATCH] Initial inline listing of favoriters --- lib/threadednoticelist.php | 44 ++++++++++++++++++++++++++++++++------ theme/neo/css/display.css | 3 ++- 2 files changed, 40 insertions(+), 7 deletions(-) diff --git a/lib/threadednoticelist.php b/lib/threadednoticelist.php index 28e6aa5aa8..87e2a7e39a 100644 --- a/lib/threadednoticelist.php +++ b/lib/threadednoticelist.php @@ -181,10 +181,10 @@ class ThreadedNoticeListItem extends NoticeListItem $notices[] = clone($notice); // *grumble* inefficient as hell } + $this->out->elementStart('ul', 'notices threaded-replies xoxo'); + $item = new ThreadedNoticeListFavesItem($this->notice, $this->out); + $hasFaves = $item->show(); if ($notices) { - $this->out->elementStart('ul', 'notices threaded-replies xoxo'); - $item = new ThreadedNoticeListFavesItem($this->notice, $this->out); - $hasFaves = $item->show(); if ($moreCutoff) { $item = new ThreadedNoticeListMoreItem($moreCutoff, $this->out); $item->show(); @@ -193,14 +193,16 @@ class ThreadedNoticeListItem extends NoticeListItem $item = new ThreadedNoticeListSubItem($notice, $this->out); $item->show(); } + } + if ($notices || $hasFaves) { // @fixme do a proper can-post check that's consistent // with the JS side if (common_current_user()) { $item = new ThreadedNoticeListReplyItem($this->notice, $this->out); $item->show(); } - $this->out->elementEnd('ul'); } + $this->out->elementEnd('ul'); } parent::showEnd(); @@ -229,6 +231,13 @@ class ThreadedNoticeListSubItem extends NoticeListItem { // } + + function showEnd() + { + $item = new ThreadedNoticeListInlineFavesItem($this->notice, $this->out); + $hasFaves = $item->show(); + parent::showEnd(); + } } /** @@ -368,15 +377,25 @@ class ThreadedNoticeListFavesItem extends NoticeListItem } $out = sprintf($msg, $this->magicList($links)); - $this->out->elementStart('li', array('class' => 'notice-faves')); + $this->showStart(); $this->out->raw($out); - $this->out->elementEnd('li'); + $this->showEnd(); return $count; } else { return 0; } } + function showStart() + { + $this->out->elementStart('li', array('class' => 'notice-data notice-faves')); + } + + function showEnd() + { + $this->out->elementEnd('li'); + } + function magicList($items) { if (count($items) == 0) { @@ -391,3 +410,16 @@ class ThreadedNoticeListFavesItem extends NoticeListItem } } } + +class ThreadedNoticeListInlineFavesItem extends ThreadedNoticeListFavesItem +{ + function showStart() + { + $this->out->elementStart('div', array('class' => 'entry-content notice-faves')); + } + + function showEnd() + { + $this->out->elementEnd('div'); + } +} diff --git a/theme/neo/css/display.css b/theme/neo/css/display.css index 643a1f29dd..ee3c13624f 100644 --- a/theme/neo/css/display.css +++ b/theme/neo/css/display.css @@ -577,7 +577,8 @@ div.entry-content a.response:after { font-size: 1em; } -#content .notice .threaded-replies .notice { +#content .notice .threaded-replies .notice, +#content .notice .threaded-replies .notice-data { width: 440px; min-height: 1px; padding-bottom: 14px;