From f090a752f039833fbabf56b540b8834e6f13df6f Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Sun, 28 Sep 2014 11:33:25 +0200 Subject: [PATCH] Added favorite count to post list --- TODO | 1 - public_html/css/post-list.css | 18 ++++++++++++++++++ public_html/templates/post-list-item.tpl | 13 +++++++++++++ src/Controllers/ViewProxies/PostViewProxy.php | 1 + 4 files changed, 32 insertions(+), 1 deletion(-) diff --git a/TODO b/TODO index 202fae28..7578087e 100644 --- a/TODO +++ b/TODO @@ -21,7 +21,6 @@ everything related to posts: - post listing - better thumbnail loading - - fav count - score - comment count - regard safety settings diff --git a/public_html/css/post-list.css b/public_html/css/post-list.css index 612150ec..c62146aa 100644 --- a/public_html/css/post-list.css +++ b/public_html/css/post-list.css @@ -40,6 +40,24 @@ opacity: .9; } +#post-list .posts li a .info { + display: none; + position: absolute; + bottom: 0; + left: 0; + right: 0; + background: #5da; + color: black; +} +#post-list .posts li a .info li { + display: inline-block; + margin: 0.1em 0.5em; +} +#post-list .posts li a:focus .info, +#post-list .posts li a:hover .info { + display: block; +} + #post-list .posts li:not(.post-type-image) a:before { display: block; content: ''; diff --git a/public_html/templates/post-list-item.tpl b/public_html/templates/post-list-item.tpl index 48d405c5..d31a2e99 100644 --- a/public_html/templates/post-list-item.tpl +++ b/public_html/templates/post-list-item.tpl @@ -4,5 +4,18 @@ href="#/post/<%= post.id %>"> <%= post.idMarkdown %> + + <% if (post.favoriteCount) { %> +
+ +
+ <% } %> diff --git a/src/Controllers/ViewProxies/PostViewProxy.php b/src/Controllers/ViewProxies/PostViewProxy.php index 1123d934..0b0e094d 100644 --- a/src/Controllers/ViewProxies/PostViewProxy.php +++ b/src/Controllers/ViewProxies/PostViewProxy.php @@ -39,6 +39,7 @@ class PostViewProxy extends AbstractViewProxy $result->featureCount = $post->getFeatureCount(); $result->lastFeatureTime = $post->getLastFeatureTime(); $result->originalFileSize = $post->getOriginalFileSize(); + $result->favoriteCount = $post->getFavoriteCount(); if (!empty($config[self::FETCH_TAGS])) $result->tags = $this->tagViewProxy->fromArray($post->getTags());