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:
parent
1c6b10f966
commit
95961fe7d5
4 changed files with 20 additions and 9 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -16,7 +16,9 @@
|
|||
<div class="left">
|
||||
Tags:
|
||||
<ul class="tags">
|
||||
<?php foreach ($this->context->featuredPost->sharedTag as $tag): ?>
|
||||
<?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 ?>
|
||||
|
|
|
@ -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 ?>
|
||||
|
|
Loading…
Reference in a new issue