Changes to infobar in post thumbnails

This commit is contained in:
Marcin Kurczewski 2013-11-16 22:02:32 +01:00
parent 6582b395d2
commit 4e64431a96
3 changed files with 29 additions and 6 deletions

View file

@ -84,7 +84,6 @@
.post .info-bar {
display: none;
height: 20px;
border-top: 1px solid firebrick;
background: rgba(255, 128, 128, 0.75);
position: absolute;
@ -92,14 +91,17 @@
left: 1px; /* border */
right: 1px; /* border */
bottom: 1px; /* border */
text-align: center;
}
.post .link:focus .info-bar,
.post .link:hover .info-bar {
display: block;
}
.post .icon-score {
background-position: -85px -1px;
}
.post .icon-comments {
margin-left: 3px;
background-position: -64px -1px;
}
.post .icon-favs {
@ -120,3 +122,6 @@
margin-right: 0.5em;
display: inline-block;
}
.post .link span.inactive {
display: none;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 612 B

After

Width:  |  Height:  |  Size: 766 B

View file

@ -14,9 +14,27 @@
<?php endif ?>
<a class="link" href="<?php echo \Chibi\UrlHelper::route('post', 'view', ['id' => $this->context->post->id]) ?>">
<img class="thumb" src="<?php echo \Chibi\UrlHelper::route('post', 'thumb', ['name' => $this->context->post->name]) ?>" alt="@<?php echo $this->context->post->id ?>"/>
<div class="info-bar">
<i class="icon-comments"></i> <span><?php echo $this->context->post->countOwn('comment') ?></span>
<i class="icon-favs"></i> <span><?php echo $this->context->post->countOwn('favoritee') ?></span>
</div>
<?php
$x =
[
'score' => $this->context->post->score,
'comments' => $this->context->post->countOwn('comment'),
'favs' => $this->context->post->countOwn('favoritee'),
];
?>
<?php if (!empty($x)): ?>
<div class="info-bar">
<?php foreach ($x as $key => $val): ?>
<?php if ($val == 0): ?>
<span class="inactive">
<?php else: ?>
<span>
<?php endif ?>
<i class="icon-<?php echo $key ?>"></i>
&nbsp;<?php echo $val ?>
</span>
<?php endforeach ?>
</div>
<?php endif ?>
</a>
</div>