Move directory widgets (#5177)

* Move directory widgets

* Update CHANGELOG_DEV.md

* Fix code comment
This commit is contained in:
Yuriy Bakhtin 2021-07-20 11:50:17 +03:00 committed by GitHub
parent 8043eb3e81
commit 5617d02a62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 28 additions and 27 deletions

View File

@ -3,6 +3,7 @@
- Fix #5174: Tour module crashes with enabled tags field
- Fix #5176: Closing the action confirmation modal window on top close icon
- Fix #5177: Move directory widgets
1.9.0-beta.2 (July 14, 2021)

View File

@ -3,8 +3,8 @@
use humhub\libs\Html;
use humhub\modules\dashboard\widgets\DashboardContent;
use humhub\modules\dashboard\widgets\Sidebar;
use humhub\modules\directory\widgets\NewMembers;
use humhub\modules\directory\widgets\NewSpaces;
use humhub\modules\space\widgets\NewSpaces;
use humhub\modules\user\widgets\NewMembers;
use humhub\widgets\FooterMenu;
?>

View File

@ -1,6 +1,6 @@
<?php
namespace humhub\modules\directory\widgets;
namespace humhub\modules\space\widgets;
use humhub\modules\space\models\Space;
use humhub\modules\space\models\Membership;
@ -8,7 +8,7 @@ use humhub\modules\space\models\Membership;
/**
* Shows newly created spaces as sidebar widget
*
* @package humhub.modules_core.directory.widgets
* @package humhub.modules_core.space.widgets
* @since 0.11
* @author Luke
*/
@ -22,11 +22,8 @@ class NewSpaces extends \yii\base\Widget
*/
public function run()
{
$query = Space::find();
/**
* Show private spaces only if user is member
*/
@ -47,5 +44,3 @@ class NewSpaces extends \yii\base\Widget
}
}
?>

View File

@ -1,19 +1,25 @@
<?php
use humhub\modules\space\models\Space;
use humhub\modules\space\widgets\Image;
use humhub\widgets\PanelMenu;
use yii\helpers\Html;
/* @var $newSpaces Space[] */
/* @var $showMoreButton boolean */
?>
<div class="panel panel-default spaces" id="new-spaces-panel">
<!-- Display panel menu widget -->
<?php echo humhub\widgets\PanelMenu::widget(['id' => 'new-spaces-panel']); ?>
<?= PanelMenu::widget(['id' => 'new-spaces-panel']); ?>
<div class="panel-heading">
<?php echo Yii::t('DirectoryModule.base', '<strong>New</strong> spaces'); ?>
<?= Yii::t('SpaceModule.base', '<strong>New</strong> spaces'); ?>
</div>
<div class="panel-body">
<?php foreach ($newSpaces as $space) : ?>
<?= \humhub\modules\space\widgets\Image::widget([
<?= Image::widget([
'space' => $space,
'showTooltip' => true,
'width' => 40,
@ -27,7 +33,7 @@ use yii\helpers\Html;
<?php if ($showMoreButton): ?>
<br/>
<br/>
<?php echo Html::a(Yii::t('DirectoryModule.base', 'See all'), ['/directory/directory/spaces'], ['class' => 'btn btn-xl btn-primary']); ?>
<?= Html::a(Yii::t('SpaceModule.base', 'See all'), ['/space/spaces'], ['class' => 'btn btn-xl btn-primary']); ?>
<?php endif; ?>
</div>
</div>

View File

@ -6,7 +6,7 @@
* @license https://www.humhub.com/licences
*/
namespace humhub\modules\directory\widgets;
namespace humhub\modules\user\widgets;
use Yii;
use humhub\modules\user\models\User;
@ -51,15 +51,13 @@ class NewMembers extends \yii\base\Widget
*/
public function run()
{
$newUsers = User::find()->orderBy('created_at DESC')->visible();
$newUsers = User::find()->orderBy('created_at DESC')->visible()->limit(10);
return $this->render('newMembers', [
'newUsers' => $newUsers,
'newUsers' => $newUsers->all(),
'showMoreButton' => $this->showMoreButton,
'showInviteButton' => $this->showInviteButton
]);
}
}
?>

View File

@ -1,11 +1,12 @@
<?php
use humhub\modules\user\models\User;
use humhub\widgets\Button;
use humhub\widgets\ModalButton;
use humhub\widgets\PanelMenu;
use humhub\modules\user\widgets\Image;
/* @var $newUsers \yii\db\ActiveQuery */
/* @var $newUsers User[] */
/* @var $showInviteButton boolean */
/* @var $showMoreButton boolean */
?>
@ -13,10 +14,10 @@ use humhub\modules\user\widgets\Image;
<?= PanelMenu::widget(['id' => 'new-people-panel']) ?>
<div class="panel-heading">
<?= Yii::t('DirectoryModule.base', '<strong>New</strong> people') ?>
<?= Yii::t('UserModule.base', '<strong>New</strong> people') ?>
</div>
<div class="panel-body">
<?php foreach ($newUsers->limit(10)->all() as $user) : ?>
<?php foreach ($newUsers as $user) : ?>
<?= Image::widget(['user' => $user, 'width' => 40, 'showTooltip' => true]) ?>
<?php endforeach; ?>
@ -25,12 +26,12 @@ use humhub\modules\user\widgets\Image;
<?php endif; ?>
<?php if ($showInviteButton): ?>
<?= ModalButton::primary(Yii::t('DirectoryModule.base', 'Send invite'))
<?= ModalButton::primary(Yii::t('UserModule.base', 'Send invite'))
->load(['/user/invite'])->icon('invite')->sm() ?>
<?php endif; ?>
<?php if ($showMoreButton): ?>
<?= Button::primary(Yii::t('DirectoryModule.base', 'See all'))
->link(['/directory/directory/members'])->icon('list-ul')->sm() ?>
<?= Button::primary(Yii::t('UserModule.base', 'See all'))
->link(['/user/people'])->icon('list-ul')->sm() ?>
<?php endif; ?>
</div>