Merge branch 'develop' of github.com:humhub/humhub into develop

This commit is contained in:
Lucas Bartholemy 2024-07-05 22:34:50 +02:00
commit 5db85e9fef
14 changed files with 160 additions and 89 deletions

View File

@ -1,10 +1,12 @@
HumHub Changelog
================
1.17.0 (TBA)
------------
- Enh #7070: Add GitHub action for PHP CS Fixer
- Enh #7073: Add a link to notification settings on top dropdown list
- Fix #7100: Enable all file handlers on RichText editor toolbar
1.16.2 (Unreleased)
---------------------

View File

@ -2,7 +2,9 @@
namespace humhub\modules\content\widgets\richtext;
use humhub\modules\file\widgets\UploadInput;
use humhub\modules\file\handler\FileHandlerCollection;
use humhub\modules\file\widgets\FileHandlerButtonDropdown;
use humhub\modules\file\widgets\UploadButton;
/**
* Rich text editor implementation for the ProsemirrorRichText.
@ -57,9 +59,16 @@ class ProsemirrorRichTextEditor extends AbstractRichTextEditor
*/
public function prepend()
{
return UploadInput::widget([
'id' => $this->getId(true) . '-file-upload',
'hideInStream' => true,
return FileHandlerButtonDropdown::widget([
'primaryButton' => UploadButton::widget([
'id' => $this->getId(true) . '-file-upload',
'hideInStream' => true,
]),
'handlers' => FileHandlerCollection::getByType([
FileHandlerCollection::TYPE_IMPORT,
FileHandlerCollection::TYPE_CREATE,
]),
'cssClass' => 'btn-group hidden',
]);
}
}

View File

@ -341,8 +341,8 @@ humhub.module('notification', function (module, require, $) {
handleFilterChanges();
if ($('#notification_overview_list').length) {
OverviewWidget.instance('#notification_overview_list');
if (!$('#notification_overview_list li.new').length) {
$('#notification_overview_markseen').hide();
if ($('#notification_overview_list li.new').length) {
$('#notification_overview_markseen').show();
}
}
};

View File

@ -21,7 +21,7 @@ class WebTargetRenderTest extends HumHubDbTestCase
$target = Yii::$app->notification->getTarget(WebTarget::class);
$renderer = $target->getRenderer();
$result = $renderer->render($notification);
$this->assertStringContainsString('New', $result);
$this->assertStringContainsString('<span class="badge-new"></span>', $result);
$this->assertStringContainsString('<h1>TestedMailViewNotificationHTML</h1>', $result);
}
@ -34,7 +34,7 @@ class WebTargetRenderTest extends HumHubDbTestCase
$target = Yii::$app->notification->getTarget(WebTarget::class);
$renderer = $target->getRenderer();
$result = $renderer->render($notification);
$this->assertStringContainsString('New', $result);
$this->assertStringContainsString('<span class="badge-new"></span>', $result);
$this->assertStringContainsString('<div>Special:<h1>TestedMailViewNotificationHTML</h1></div>', $result);
}
}

View File

@ -2,52 +2,55 @@
use humhub\modules\notification\models\Notification;
use humhub\modules\space\models\Space;
use humhub\modules\space\widgets\Image as SpaceImage;
use humhub\modules\user\models\User;
use humhub\modules\user\widgets\Image as UserImage;
use humhub\widgets\TimeAgo;
use yii\helpers\Html;
/** @var \humhub\modules\user\models\User $originator */
/** @var User $originator */
/** @var Space $space */
/** @var Notification $record */
/** @var bool $isNew */
/** @var string $content */
/** @var string $url */
/** @var string $relativeUrl */
?>
<li class="<?php if ($isNew): ?>new<?php endif; ?>"
<li <?php if ($isNew): ?>class="new"<?php endif; ?>
data-notification-id="<?= $record->id ?>"
data-notification-group="<?= !empty($record->baseModel->getGroupkey()) ? Html::encode(get_class($record->baseModel)) . ':' . Html::encode($record->baseModel->getGroupKey()) : '' ?>">
<a href="<?= isset($relativeUrl) ? $relativeUrl : $url; ?>">
data-notification-group="<?= !empty($record->baseModel->getGroupkey())
? Html::encode(get_class($record->baseModel) . ':' . $record->baseModel->getGroupKey())
: '' ?>">
<a href="<?= $relativeUrl ?? $url ?>">
<div class="media">
<!-- show user image -->
<?php if ($originator): ?>
<img class="media-object img-rounded pull-left"
data-src="holder.js/32x32" alt="32x32"
style="width: 32px; height: 32px;"
src="<?php echo $originator->getProfileImage()->getUrl(); ?>"/>
<div class="media-left">
<?php if ($originator) : ?>
<?= UserImage::widget([
'user' => $originator,
'width' => 32,
'link' => false,
'hideOnlineStatus' => true,
]) ?>
<?php endif; ?>
<!-- show space image -->
<?php if ($space): ?>
<img class="media-object img-rounded img-space pull-left"
data-src="holder.js/20x20" alt="20x20"
style="width: 20px; height: 20px;"
src="<?= $space->getProfileImage()->getUrl(); ?>">
<?php if ($space instanceof Space) : ?>
<?= SpaceImage::widget([
'space' => $space,
'width' => 20,
'link' => false,
'htmlOptions' => ['class' => 'img-space'],
]) ?>
<?php endif; ?>
</div>
<div class="media-body">
<?= $content ?>
<br>
<?= TimeAgo::widget(['timestamp' => $record->created_at]) ?>
</div>
<div class="media-right align-center">
<?php if ($isNew) : ?>
<span class="badge-new"></span>
<?php endif; ?>
<!-- show content -->
<div class="media-body">
<?= $content; ?>
<br> <?= TimeAgo::widget(['timestamp' => $record->created_at]); ?>
<?php if ($isNew): ?>
<span class="label label-danger"><?= Yii::t('NotificationModule.base', 'New'); ?></span>
<?php endif; ?>
</div>
</div>
</a>
</li>

View File

@ -1,11 +1,11 @@
<?php
use humhub\modules\notification\models\forms\FilterForm;
use humhub\widgets\Button;
use yii\bootstrap\ActiveForm;
use yii\helpers\Url;
/* @var $overview string */
/* @var $filterForm */
/* @var $filterForm FilterForm */
?>
<div class="container">
<div class="row">
@ -13,11 +13,20 @@ use yii\helpers\Url;
<div class="panel panel-default">
<div class="panel-heading">
<?= Yii::t('NotificationModule.base', '<strong>Notification</strong> Overview'); ?>
<a id="notification_overview_markseen" href="#" data-action-click="notification.markAsSeen"
data-action-url="<?= Url::to(['/notification/list/mark-as-seen']); ?>"
class="pull-right heading-link">
<b><?= Yii::t('NotificationModule.base', 'Mark all as seen'); ?></b>
</a>
<div class="pull-right">
<?= Button::defaultType()
->icon('check')
->action('notification.markAsSeen', ['/notification/list/mark-as-seen'])
->id('notification_overview_markseen')
->style('display:none')
->sm()
->tooltip(Yii::t('NotificationModule.base', 'Mark all as seen')) ?>
<?= Button::defaultType()
->icon('cog')
->link(['/notification/user'])
->sm()
->tooltip(Yii::t('NotificationModule.base', 'Notification Settings')) ?>
</div>
</div>
<div class="panel-body">
<?= $overview ?>

View File

@ -46,7 +46,7 @@ use yii\helpers\Html;
<li>
<div class="dropdown-footer">
<a class="btn btn-default col-md-12" href="<?= Url::to(['/notification/overview']) ?>">
<?= Yii::t('NotificationModule.base', 'Show all') ?>
<?= Yii::t('NotificationModule.base', 'Show all notifications') ?>
</a>
</div>
</li>

View File

@ -24,3 +24,11 @@
background-color: @background3;
line-height: 1;
}
.badge-new {
display: inline-block;
width: 14px;
height: 14px;
border-radius: 50%;
background: @info;
}

View File

@ -10,6 +10,7 @@
display: inline-block;
width: 14px;
}
@media (max-width: 400px) {
white-space: normal !important;
}
@ -18,14 +19,15 @@
white-space: normal;
}
}
}
a:hover,
a:visited,
a:hover,
a:focus {
background: none;
cursor: pointer;
&:not(.btn) {
&:hover,
&:visited,
&:hover,
&:focus {
background: none;
cursor: pointer;
}
}
}
}

View File

@ -129,6 +129,10 @@
.content .files a {
color: @text-color-highlight;
}
.align-center {
align-content: center;
}
}
.content span {

View File

@ -8,6 +8,35 @@
top: 25px;
left: 25px;
}
.media {
display: flex;
.media-left {
margin-right: 16px;
}
.media-right {
min-width: 24px;
}
}
li {
border-left: none;
background: none;
&:hover {
border-left: none;
background-color: @background-color-secondary;
}
&.new {
time {
color: @info;
}
}
&:not(.new) {
.media-body {
*&, strong {
color: @text-color-secondary;
}
}
}
}
}
@media (max-width: 767px) {

View File

@ -176,14 +176,6 @@
.btn {
width: 100%;
font-size: 12px;
color: @text-color-soft !important;
background: @background-color-secondary;
border-radius: 4px;
&:hover, &:active, &:focus {
background: @background3;
box-shadow: none;
}
}
}
}

View File

@ -181,37 +181,32 @@
i.declined {
color: #d9534f;
}
}
li .media {
position: relative;
}
.media {
position: relative;
display: flex;
.img-space {
position: absolute;
top: 14px;
left: 14px;
}
}
li .media .img-space {
position: absolute;
top: 14px;
left: 14px;
&:not(.new) {
> a .media-body {
*&, strong {
color: @text-color-secondary;
}
}
}
}
}
}
.dropdown-footer {
margin: 10px 20px 15px;
.btn.btn-default {
border: 1px solid @default;
box-shadow: none;
margin: 24px 16px 19px;
.btn {
width: 100%;
&:hover {
border-color: @background3;
background: @background3;
}
&:active {
border-color: @text-color-secondary;
background: white;
}
}
}
@ -243,13 +238,23 @@
}
li {
padding: 4px;
padding: 8px;
margin: 0 16px 5px;
color: @text-color-highlight;
border-radius: 4px;
border: none;
&.new {
border: none;
background: none;
&:hover {
background-color: @background-color-secondary;
}
time {
color: @info;
}
}
time {
font-size: 10px;
}
i.accepted {
@ -270,6 +275,14 @@
padding: 0.1em 0.5em;
}
}
.media-left {
margin-right: 16px;
}
.media-right {
padding-left: 8px;
min-width: 24px;
}
}
.account .user-title {

File diff suppressed because one or more lines are too long