From d9dcd59ae1ea258f57fe4a92eaea6f4ba63f54c8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Julius=20H=C3=A4rtl?= Date: Wed, 5 Aug 2020 07:51:24 +0200 Subject: [PATCH] Load sidebar on dashboard MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- apps/dashboard/lib/Controller/DashboardController.php | 10 ++++++---- apps/dashboard/src/main.js | 5 ++++- apps/dashboard/templates/index.php | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/apps/dashboard/lib/Controller/DashboardController.php b/apps/dashboard/lib/Controller/DashboardController.php index 07cfaf071e2..d7f9453cb4e 100644 --- a/apps/dashboard/lib/Controller/DashboardController.php +++ b/apps/dashboard/lib/Controller/DashboardController.php @@ -27,6 +27,7 @@ declare(strict_types=1); namespace OCA\Dashboard\Controller; use OCA\Dashboard\AppInfo\Application; +use OCA\Files\Event\LoadSidebar; use OCA\Viewer\Event\LoadViewer; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\JSONResponse; @@ -76,6 +77,11 @@ class DashboardController extends Controller { * @return TemplateResponse */ public function index(): TemplateResponse { + $this->eventDispatcher->dispatchTyped(new LoadSidebar()); + if (class_exists(LoadViewer::class)) { + $this->eventDispatcher->dispatchTyped(new LoadViewer()); + } + $this->eventDispatcher->dispatchTyped(new RegisterWidgetEvent($this->dashboardManager)); $userLayout = explode(',', $this->config->getUserValue($this->userId, 'dashboard', 'layout', 'recommendations,spreed,mail,calendar')); @@ -92,10 +98,6 @@ class DashboardController extends Controller { $this->inititalStateService->provideInitialState('dashboard', 'firstRun', $this->config->getUserValue($this->userId, 'dashboard', 'firstRun', '1') === '1'); $this->config->setUserValue($this->userId, 'dashboard', 'firstRun', '0'); - if (class_exists(LoadViewer::class)) { - $this->eventDispatcher->dispatchTyped(new LoadViewer()); - } - return new TemplateResponse('dashboard', 'index'); } diff --git a/apps/dashboard/src/main.js b/apps/dashboard/src/main.js index 74d7cb69d4d..049582e489a 100644 --- a/apps/dashboard/src/main.js +++ b/apps/dashboard/src/main.js @@ -3,8 +3,11 @@ import App from './App.vue' import { translate as t } from '@nextcloud/l10n' Vue.prototype.t = t +// FIXME workaround to make the sidebar work +Object.assign(window.OCA.Files, { App: { fileList: { filesClient: OC.Files.getClient() } } }, window.OCA.Files) + const Dashboard = Vue.extend(App) -const Instance = new Dashboard({}).$mount('#app') +const Instance = new Dashboard({}).$mount('#app-content-vue') window.OCA.Dashboard = { register: (app, callback) => Instance.register(app, callback), diff --git a/apps/dashboard/templates/index.php b/apps/dashboard/templates/index.php index bca9fa30494..e4056ce06e2 100644 --- a/apps/dashboard/templates/index.php +++ b/apps/dashboard/templates/index.php @@ -1,4 +1,4 @@ -
+
-- 2.39.5