mirror of
https://github.com/humhub/humhub.git
synced 2025-01-17 14:18:27 +01:00
parent
73efe55356
commit
3528cf3156
@ -21,6 +21,8 @@ HumHub Changelog (DEVELOP)
|
||||
- Enh #6077: Always display content tabs
|
||||
- Enh #5263: Allow members of groups other than system admin to view all content (groups that can manage users for profile content and groups that can manage spaces for space content)
|
||||
- Enh #6102: Also allow Messages module to inject new message count into page title
|
||||
- Enh #5904: Make Dynamic Post Font Size Optional
|
||||
- Enh #6109: Added enabled Pretty URL as self test
|
||||
- Enh #6109: Added enabled Pretty URL as self test
|
||||
- Enh #6119: Added UserInfoWidget for User Notification Settings
|
||||
- Enh #6116: Scheduled content publishing
|
||||
|
@ -26,6 +26,12 @@ class Module extends ContentContainerModule
|
||||
*/
|
||||
public $controllerNamespace = 'humhub\modules\post\controllers';
|
||||
|
||||
/**
|
||||
* @since 1.14
|
||||
* @var bool Automatically increase font size for short posts.
|
||||
*/
|
||||
public bool $enableDynamicFontSize = false;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
|
@ -6,14 +6,16 @@ humhub.module('post', function(module, require, $) {
|
||||
Post.prototype.init = function() {
|
||||
var that = this;
|
||||
|
||||
this.$.find('[data-ui-richtext]').on('afterRender', function() {
|
||||
var $rtContent = $(this).children();
|
||||
var $first = $rtContent.first();
|
||||
if (this.data('dynamic-font-size')) {
|
||||
this.$.find('[data-ui-richtext]').on('afterRender', function () {
|
||||
var $rtContent = $(this).children();
|
||||
var $first = $rtContent.first();
|
||||
|
||||
if($rtContent.length === 1 && $first.is('p') && $first.text().length < 150 && !$first.find('br').length) {
|
||||
that.$.addClass('post-short-text');
|
||||
}
|
||||
})
|
||||
if ($rtContent.length === 1 && $first.is('p') && $first.text().length < 150 && !$first.find('br').length) {
|
||||
that.$.addClass('post-short-text');
|
||||
}
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
module.export({
|
||||
|
@ -9,6 +9,9 @@
|
||||
namespace humhub\modules\post\widgets;
|
||||
|
||||
use humhub\modules\content\widgets\stream\WallStreamEntryWidget;
|
||||
use humhub\modules\post\models\Post;
|
||||
use humhub\modules\post\Module;
|
||||
use Yii;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
@ -42,10 +45,14 @@ class WallEntry extends WallStreamEntryWidget
|
||||
*/
|
||||
protected function renderContent()
|
||||
{
|
||||
/** @var Module $module */
|
||||
$module = Yii::$app->getModule('post');
|
||||
|
||||
return $this->render('wallEntry', [
|
||||
'post' => $this->model,
|
||||
'justEdited' => $this->renderOptions->isJustEdited(), // compatibility for themed legacy views
|
||||
'renderOptions' => $this->renderOptions
|
||||
'renderOptions' => $this->renderOptions,
|
||||
'enableDynamicFontSize' => $module->enableDynamicFontSize
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,19 @@
|
||||
<?php
|
||||
|
||||
use humhub\modules\content\widgets\richtext\RichText;
|
||||
use humhub\modules\content\widgets\stream\WallStreamEntryOptions;
|
||||
use humhub\modules\post\models\Post;
|
||||
|
||||
/* @var $post Post */
|
||||
/* @var $renderOptions WallStreamEntryOptions */
|
||||
/* @var $enableDynamicFontSize bool */
|
||||
|
||||
$isDetailView = $renderOptions->isViewContext(WallStreamEntryOptions::VIEW_CONTEXT_DETAIL);
|
||||
|
||||
?>
|
||||
<div data-ui-widget="post.Post" <?php if(!$isDetailView) : ?>data-state="collapsed"<?php endif; ?> data-ui-init id="post-content-<?= $post->id ?>">
|
||||
<div data-ui-markdown <?php if(!$isDetailView) : ?>data-ui-show-more<?php endif; ?>>
|
||||
<div data-ui-widget="post.Post" <?php if (!$isDetailView) : ?>data-state="collapsed"<?php endif; ?>
|
||||
data-dynamic-font-size="<?= intval($enableDynamicFontSize) ?>" data-ui-init id="post-content-<?= $post->id ?>">
|
||||
<div data-ui-markdown <?php if (!$isDetailView) : ?>data-ui-show-more<?php endif; ?>>
|
||||
<?= RichText::output($post->message, ['record' => $post]) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user