From 95961fe7d5241d97a00a959f001450776e929134 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Sat, 14 Dec 2013 16:55:07 +0100 Subject: [PATCH] Added tag sorting here and there - Title attribute in post thumbnail - Page title in post view - Footer in featured post --- src/Controllers/PostController.php | 2 +- src/Helpers/TextHelper.php | 9 +++++++++ src/Views/index-index.phtml | 16 +++++++++------- src/Views/post-small.phtml | 2 +- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/Controllers/PostController.php b/src/Controllers/PostController.php index 4d039508..da947ebb 100644 --- a/src/Controllers/PostController.php +++ b/src/Controllers/PostController.php @@ -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; diff --git a/src/Helpers/TextHelper.php b/src/Helpers/TextHelper.php index 4e51235c..ac9d1606 100644 --- a/src/Helpers/TextHelper.php +++ b/src/Helpers/TextHelper.php @@ -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; diff --git a/src/Views/index-index.phtml b/src/Views/index-index.phtml index 6424533e..3d377885 100644 --- a/src/Views/index-index.phtml +++ b/src/Views/index-index.phtml @@ -16,13 +16,15 @@
Tags: 
diff --git a/src/Views/post-small.phtml b/src/Views/post-small.phtml index 8d103db4..059f63ad 100644 --- a/src/Views/post-small.phtml +++ b/src/Views/post-small.phtml @@ -15,7 +15,7 @@ context->user->hasEnabledPostTagTitles()): ?> - +