mirror of
https://github.com/humhub/humhub.git
synced 2025-01-17 22:28:51 +01:00
Fix: Topic overview missing for user profiles
This commit is contained in:
parent
add2b64617
commit
d567c995c0
@ -7,6 +7,7 @@ HumHub Change Log (DEVELOP)
|
||||
- Fix #3790: "Create post" permission visible in profile permissions settings for guest user group
|
||||
- Fix: `AdminMenu:reset()` fails on console requests using user switch
|
||||
- Fix: Default `ContentContainerController::subLayout` can't be overwritten directly or within controller `init`
|
||||
- Fix: Topic overview missing for user profiles
|
||||
|
||||
|
||||
1.4.0-beta.2
|
||||
|
@ -11,6 +11,9 @@ namespace humhub\modules\topic;
|
||||
use humhub\modules\content\components\ContentActiveRecord;
|
||||
use humhub\modules\topic\models\Topic;
|
||||
use humhub\modules\topic\widgets\ContentTopicButton;
|
||||
use humhub\modules\ui\menu\MenuLink;
|
||||
use humhub\modules\user\events\UserEvent;
|
||||
use humhub\modules\user\widgets\AccountMenu;
|
||||
use Yii;
|
||||
use yii\base\BaseObject;
|
||||
|
||||
@ -26,6 +29,9 @@ class Events extends BaseObject
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $event
|
||||
*/
|
||||
public static function onSpaceSettingMenuInit($event)
|
||||
{
|
||||
$space = $event->sender->space;
|
||||
@ -34,9 +40,30 @@ class Events extends BaseObject
|
||||
$event->sender->addItem([
|
||||
'label' => Yii::t('TopicModule.base', 'Topics'),
|
||||
'url' => $space->createUrl('/topic/manage'),
|
||||
'isActive' => (Yii::$app->controller->module && Yii::$app->controller->module->id == 'topic' && Yii::$app->controller->id == 'manage'),
|
||||
'isActive' => MenuLink::isActiveState('topic', 'manage'),
|
||||
'sortOrder' => 250
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $event UserEvent
|
||||
*/
|
||||
public static function onProfileSettingMenuInit($event)
|
||||
{
|
||||
if(Yii::$app->user->isGuest) {
|
||||
return;
|
||||
}
|
||||
|
||||
$event->sender->addItem([
|
||||
'label' => Yii::t('TopicModule.base', 'Topics'),
|
||||
'url' => Yii::$app->user->identity->createUrl('/topic/manage'),
|
||||
'isActive' => MenuLink::isActiveState('topic', 'manage'),
|
||||
'sortOrder' => 250
|
||||
]);
|
||||
|
||||
if(MenuLink::isActiveState('topic', 'manage')) {
|
||||
AccountMenu::markAsActive('account-settings-settings');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
use humhub\modules\content\widgets\WallEntryControls;
|
||||
use humhub\modules\space\widgets\HeaderControlsMenu;
|
||||
use humhub\modules\user\widgets\AccountSettingsMenu;
|
||||
use humhub\modules\topic\Events;
|
||||
use humhub\modules\space\modules\manage\widgets\DefaultMenu;
|
||||
|
||||
@ -19,5 +19,6 @@ return [
|
||||
'events' => [
|
||||
['class' => WallEntryControls::class, 'event' => WallEntryControls::EVENT_INIT, 'callback' => [Events::class, 'onWallEntryControlsInit']],
|
||||
['class' => DefaultMenu::class, 'event' => DefaultMenu::EVENT_INIT, 'callback' => [Events::class, 'onSpaceSettingMenuInit']],
|
||||
['class' => AccountSettingsMenu::class, 'event' => AccountSettingsMenu::EVENT_INIT, 'callback' => [Events::class, 'onProfileSettingMenuInit']],
|
||||
],
|
||||
];
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
namespace humhub\modules\topic\controllers;
|
||||
|
||||
use humhub\modules\user\models\User;
|
||||
use humhub\widgets\ModalClose;
|
||||
use humhub\modules\content\components\ContentContainerController;
|
||||
use humhub\modules\topic\models\Topic;
|
||||
@ -21,11 +22,21 @@ class ManageController extends ContentContainerController
|
||||
public function getAccessRules()
|
||||
{
|
||||
return [
|
||||
['login'],
|
||||
['permission' => ManageTopics::class],
|
||||
['json' => ['delete']]
|
||||
];
|
||||
}
|
||||
|
||||
public function init()
|
||||
{
|
||||
parent::init();
|
||||
|
||||
if($this->contentContainer instanceof User) {
|
||||
$this->subLayout = "@humhub/modules/user/views/account/_layout";
|
||||
}
|
||||
}
|
||||
|
||||
public function actionIndex()
|
||||
{
|
||||
$model = new Topic($this->contentContainer);
|
||||
|
@ -6,13 +6,15 @@
|
||||
*
|
||||
*/
|
||||
|
||||
use humhub\modules\space\models\Space;
|
||||
use humhub\modules\space\modules\manage\widgets\DefaultMenu;
|
||||
use humhub\widgets\Button;
|
||||
use humhub\widgets\GridView;
|
||||
use humhub\widgets\ModalButton;
|
||||
use yii\bootstrap\ActiveForm;
|
||||
use humhub\modules\user\models\User;
|
||||
use humhub\modules\user\widgets\AccountSettingsMenu;
|
||||
use yii\helpers\Html;
|
||||
use yii\helpers\Url;
|
||||
|
||||
/* @var $this \humhub\components\View */
|
||||
/* @var $dataProvider \yii\data\ActiveDataProvider */
|
||||
@ -21,10 +23,16 @@ use yii\helpers\Url;
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><?= Yii::t('TopicModule.base', '<strong>Topic</strong> Overview'); ?></div>
|
||||
|
||||
<?= DefaultMenu::widget(['space' => $contentContainer]); ?>
|
||||
<?php if($contentContainer instanceof Space) :?>
|
||||
<?= DefaultMenu::widget(['space' => $contentContainer]); ?>
|
||||
<?php elseif ($contentContainer instanceof User) : ?>
|
||||
<?= AccountSettingsMenu::widget()?>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="panel-body">
|
||||
|
||||
|
@ -31,6 +31,7 @@ class AccountMenu extends LeftNavigation
|
||||
|
||||
$this->addEntry(new MenuLink([
|
||||
'label' => Yii::t('UserModule.account', 'Profile'),
|
||||
'id' => 'account-settings-profile',
|
||||
'icon' => 'user',
|
||||
'url' => ['/user/account/edit'],
|
||||
'sortOrder' => 100,
|
||||
@ -39,6 +40,7 @@ class AccountMenu extends LeftNavigation
|
||||
|
||||
$this->addEntry(new MenuLink([
|
||||
'label' => Yii::t('UserModule.account', 'E-Mail Summaries'),
|
||||
'id' => 'account-settings-emailsummary',
|
||||
'icon' => 'envelope',
|
||||
'url' => ['/activity/user'],
|
||||
'sortOrder' => 105,
|
||||
@ -47,6 +49,7 @@ class AccountMenu extends LeftNavigation
|
||||
|
||||
$this->addEntry(new MenuLink([
|
||||
'label' => Yii::t('UserModule.account', 'Notifications'),
|
||||
'id' => 'account-settings-notifications',
|
||||
'icon' => 'bell',
|
||||
'url' => ['/notification/user'],
|
||||
'sortOrder' => 106,
|
||||
@ -55,6 +58,7 @@ class AccountMenu extends LeftNavigation
|
||||
|
||||
$this->addEntry(new MenuLink([
|
||||
'label' => Yii::t('UserModule.account', 'Settings'),
|
||||
'id' => 'account-settings-settings',
|
||||
'icon' => 'wrench',
|
||||
'url' => ['/user/account/edit-settings'],
|
||||
'sortOrder' => 110,
|
||||
@ -63,6 +67,7 @@ class AccountMenu extends LeftNavigation
|
||||
|
||||
$this->addEntry(new MenuLink([
|
||||
'label' => Yii::t('UserModule.account', 'Security'),
|
||||
'id' => 'account-settings-security',
|
||||
'icon' => 'lock',
|
||||
'url' => ['/user/account/security'],
|
||||
'sortOrder' => 115,
|
||||
@ -71,6 +76,7 @@ class AccountMenu extends LeftNavigation
|
||||
|
||||
$this->addEntry(new MenuLink([
|
||||
'label' => Yii::t('UserModule.account', 'Modules'),
|
||||
'id' => 'account-settings-modules',
|
||||
'icon' => 'rocket',
|
||||
'url' => ['/user/account/edit-modules'],
|
||||
'sortOrder' => 120,
|
||||
|
Loading…
x
Reference in New Issue
Block a user