Render also the cog icon when there is more than 1 home

This commit is contained in:
Yonas Habteab 2022-06-08 16:14:54 +02:00
parent 23de575782
commit 3be596641f
3 changed files with 12 additions and 6 deletions

View File

@ -48,8 +48,6 @@ class DashboardsController extends CompatController
$pane = $this->getParam('pane');
$this->dashboard->load(DashboardHome::DEFAULT_HOME, $pane);
$this->createTabs();
$activeHome = $this->dashboard->getActiveHome();
if (! $activeHome || ! $activeHome->hasEntries()) {
$this->addTitleTab(t('Welcome'));
@ -64,6 +62,8 @@ class DashboardsController extends CompatController
$this->dashboard->addHtml($welcomeForm);
}
$this->createTabs();
$this->addContent($this->dashboard);
}
@ -472,9 +472,15 @@ class DashboardsController extends CompatController
{
$tabs = $this->dashboard->getTabs();
$activeHome = $this->dashboard->getActiveHome();
if ($activeHome && ($activeHome->getName() !== DashboardHome::DEFAULT_HOME || $activeHome->hasEntries())) {
if ($activeHome
&& (
! $activeHome->isDefaultHome()
|| $activeHome->hasEntries()
|| count($this->dashboard->getEntries()) > 1
)
) {
$params = [];
if ($activeHome->getName() !== DashboardHome::DEFAULT_HOME) {
if (! $activeHome->isDefaultHome()) {
$params['home'] = $activeHome->getName();
}

View File

@ -144,7 +144,7 @@ trait DashboardManager
$home = $home instanceof DashboardHome ? $home : $this->getEntry($home);
$home->removeEntries();
if ($home->getName() !== DashboardHome::DEFAULT_HOME) {
if (! $home->isDefaultHome()) {
DBUtils::getConn()->delete(DashboardHome::TABLE, ['id = ?' => $home->getUuid()]);
} elseif (! $home->isDisabled()) {
DBUtils::getConn()->update(DashboardHome::TABLE, ['disabled' => DBUtils::bool2BoolEnum(true)], [

View File

@ -114,7 +114,7 @@ class Dashboard extends BaseHtmlElement implements DashboardEntry
public function getTabs()
{
$activeHome = $this->getActiveHome();
if ($activeHome && $activeHome->getName() !== DashboardHome::DEFAULT_HOME) {
if ($activeHome && ! $activeHome->isDefaultHome()) {
$url = Url::fromPath(self::BASE_ROUTE . '/home')->getUrlWithout(['home', $this->tabParam]);
$url->addParams(['home' => $activeHome->getName()]);
} else {