Added tag sorting here and there

- Title attribute in post thumbnail
- Page title in post view
- Footer in featured post
This commit is contained in:
Marcin Kurczewski 2013-12-14 16:55:07 +01:00
parent 1c6b10f966
commit 95961fe7d5
4 changed files with 20 additions and 9 deletions

View file

@ -483,7 +483,7 @@ class PostController
$this->context->stylesheets []= 'post-view.css';
$this->context->stylesheets []= 'comment-small.css';
$this->context->scripts []= 'post-view.js';
$this->context->subTitle = 'showing @' . $post->id . ' – ' . join(', ', array_map(function($x) { return $x['name']; }, $post->sharedTag));
$this->context->subTitle = 'showing ' . TextHelper::reprPost($post) . ' – ' . TextHelper::reprTags($post->sharedTag);
$this->context->favorite = $favorite;
$this->context->score = $score;
$this->context->flagged = $flagged;

View file

@ -197,6 +197,15 @@ class TextHelper
return '#' . $tag->name;
}
public static function reprTags($tags)
{
$x = [];
foreach ($tags as $tag)
$x []= self::reprTag($tag);
natcasesort($x);
return join(', ', $x);
}
public static function encrypt($text)
{
$salt = \Chibi\Registry::getConfig()->main->salt;

View file

@ -16,13 +16,15 @@
<div class="left">
Tags:&nbsp;
<ul class="tags">
<?php foreach ($this->context->featuredPost->sharedTag as $tag): ?>
<li>
<a href="<?php echo \Chibi\UrlHelper::route('post', 'list', ['query' => $tag->name]) ?>">
<?php echo $tag->name ?>
</a>
</li>
<?php endforeach ?>
<?php $tags = $this->context->featuredPost->sharedTag ?>
<?php uasort($tags, function($a, $b) { return strnatcasecmp($a->name, $b->name); }) ?>
<?php foreach ($tags as $tag): ?>
<li>
<a href="<?php echo \Chibi\UrlHelper::route('post', 'list', ['query' => $tag->name]) ?>">
<?php echo $tag->name ?>
</a>
</li>
<?php endforeach ?>
</ul>
</div>

View file

@ -15,7 +15,7 @@
<?php endif ?>
<?php if ($this->context->user->hasEnabledPostTagTitles()): ?>
<a title="<?php echo join(', ', array_map(['TextHelper', 'reprTag'], $this->context->post->sharedTag)) ?>" class="link" href="<?php echo \Chibi\UrlHelper::route('post', 'view', ['id' => $this->context->post->id]) ?>">
<a title="<?php echo TextHelper::reprTags($this->context->post->sharedTag) ?>" class="link" href="<?php echo \Chibi\UrlHelper::route('post', 'view', ['id' => $this->context->post->id]) ?>">
<?php else: ?>
<a class="link" href="<?php echo \Chibi\UrlHelper::route('post', 'view', ['id' => $this->context->post->id]) ?>">
<?php endif ?>