User settings: added opt-in tags in post thumbs
This commit is contained in:
parent
505fe1bac3
commit
c683fa3b0f
5 changed files with 32 additions and 1 deletions
|
@ -31,6 +31,7 @@ thumbWidth=150
|
|||
thumbHeight=150
|
||||
thumbStyle=outside
|
||||
endlessScrollingDefault=1
|
||||
showPostTagTitlesDefault=0
|
||||
maxSearchTokens=4
|
||||
maxRelatedPosts=50
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -13,7 +13,12 @@
|
|||
<?php echo in_array('tagged', $classNames) ? 'Tagged' : 'Untagged' ?>
|
||||
</a>
|
||||
<?php endif ?>
|
||||
<a class="link" href="<?php echo \Chibi\UrlHelper::route('post', 'view', ['id' => $this->context->post->id]) ?>">
|
||||
|
||||
<?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]) ?>">
|
||||
<?php else: ?>
|
||||
<a class="link" href="<?php echo \Chibi\UrlHelper::route('post', 'view', ['id' => $this->context->post->id]) ?>">
|
||||
<?php endif ?>
|
||||
<img class="thumb" src="<?php echo \Chibi\UrlHelper::route('post', 'thumb', ['name' => $this->context->post->name]) ?>" alt="@<?php echo $this->context->post->id ?>"/>
|
||||
<?php
|
||||
$x =
|
||||
|
|
|
@ -21,6 +21,16 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="post-tag-titles">
|
||||
<label class="left" for="post-tag-titles">Tags in thumbs:</label>
|
||||
<div class="input-wrapper">
|
||||
<label>
|
||||
<input type="checkbox" id="post-tag-titles" name="post-tag-titles" <?php if ($this->context->transport->user->hasEnabledPostTagTitles()) echo ' checked="checked"' ?>/>
|
||||
Enabled
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="submit" value="1"/>
|
||||
|
||||
<?php $this->renderFile('message') ?>
|
||||
|
|
Loading…
Reference in a new issue