Load sidebar on dashboard

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2020-08-05 07:51:24 +02:00
parent 018be662f4
commit d9dcd59ae1
No known key found for this signature in database
GPG key ID: 4C614C6ED2CDE6DF
3 changed files with 11 additions and 6 deletions

View file

@ -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');
}

View file

@ -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),

View file

@ -1,4 +1,4 @@
<?php
\OCP\Util::addScript('dashboard', 'dashboard');
?>
<div id="app"></div>
<div id="app-content-vue"></div>