From c683fa3b0f7ed1b509f4e295d4bda00cb6e1d714 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Mon, 25 Nov 2013 12:07:50 +0100 Subject: [PATCH] User settings: added opt-in tags in post thumbs --- data/config.ini | 1 + src/Controllers/UserController.php | 1 + src/Models/Model_User.php | 14 ++++++++++++++ src/Views/post-small.phtml | 7 ++++++- src/Views/user-settings.phtml | 10 ++++++++++ 5 files changed, 32 insertions(+), 1 deletion(-) diff --git a/data/config.ini b/data/config.ini index 4306e13e..f49432a5 100644 --- a/data/config.ini +++ b/data/config.ini @@ -31,6 +31,7 @@ thumbWidth=150 thumbHeight=150 thumbStyle=outside endlessScrollingDefault=1 +showPostTagTitlesDefault=0 maxSearchTokens=4 maxRelatedPosts=50 diff --git a/src/Controllers/UserController.php b/src/Controllers/UserController.php index 45104fa9..6a26ecad 100644 --- a/src/Controllers/UserController.php +++ b/src/Controllers/UserController.php @@ -293,6 +293,7 @@ class UserController $user->enableSafety($safety, in_array($safety, $suppliedSafety)); $user->enableEndlessScrolling(InputHelper::get('endless-scrolling')); + $user->enablePostTagTitles(InputHelper::get('post-tag-titles')); Model_User::save($user); if ($user->id == $this->context->user->id) diff --git a/src/Models/Model_User.php b/src/Models/Model_User.php index 37940aa9..6a925a26 100644 --- a/src/Models/Model_User.php +++ b/src/Models/Model_User.php @@ -3,6 +3,7 @@ class Model_User extends AbstractModel { const SETTING_SAFETY = 1; const SETTING_ENDLESS_SCROLLING = 2; + const SETTING_POST_TAG_TITLES = 3; @@ -206,6 +207,19 @@ class Model_User extends AbstractModel $this->setSetting(self::SETTING_SAFETY, $new); } + public function hasEnabledPostTagTitles() + { + $ret = $this->getSetting(self::SETTING_POST_TAG_TITLES); + if ($ret === null) + $ret = \Chibi\Registry::getConfig()->browsing->showPostTagTitlesDefault; + return $ret; + } + + public function enablePostTagTitles($enabled) + { + $this->setSetting(self::SETTING_POST_TAG_TITLES, $enabled ? 1 : 0); + } + public function hasEnabledEndlessScrolling() { $ret = $this->getSetting(self::SETTING_ENDLESS_SCROLLING); diff --git a/src/Views/post-small.phtml b/src/Views/post-small.phtml index f6532aea..ebc00209 100644 --- a/src/Views/post-small.phtml +++ b/src/Views/post-small.phtml @@ -13,7 +13,12 @@ - + + context->user->hasEnabledPostTagTitles()): ?> + + + + @<?php echo $this->context->post->id ?> + + renderFile('message') ?>