diff --git a/appinfo/routes.php b/appinfo/routes.php
index 6646968513..a51d67e3b2 100644
--- a/appinfo/routes.php
+++ b/appinfo/routes.php
@@ -51,6 +51,7 @@
],
],
['name' => 'settings#generateIframeToken', 'url' => 'settings/generateToken/{type}', 'verb' => 'GET'],
+ ['name' => 'settings#setOverviewGridView', 'url' => 'settings/overview/grid_view', 'verb' => 'PUT'],
// Direct Editing: Webview
['name' => 'directView#show', 'url' => '/direct/{token}', 'verb' => 'GET'],
diff --git a/lib/Controller/OverviewController.php b/lib/Controller/OverviewController.php
index a6d1e14708..3da2eac761 100644
--- a/lib/Controller/OverviewController.php
+++ b/lib/Controller/OverviewController.php
@@ -15,6 +15,7 @@
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Services\IInitialState;
use OCP\EventDispatcher\IEventDispatcher;
+use OCP\IConfig;
use OCP\IPreview;
use OCP\IRequest;
use OCP\Util;
@@ -27,6 +28,8 @@ public function __construct(
private IEventDispatcher $eventDispatcher,
private IInitialState $initialState,
private IPreview $preview,
+ private IConfig $config,
+ private ?string $userId,
) {
parent::__construct($appName, $request);
}
@@ -40,6 +43,10 @@ public function index(): TemplateResponse {
Util::addScript('richdocuments', 'richdocuments-overview');
$this->initialState->provideInitialState('previewEnabled', $this->preview->isMimeSupported('application/vnd.oasis.opendocument.text'));
+ $this->initialState->provideInitialState('overview_config', [
+ 'overview_grid_view' => $this->userId !== null
+ && $this->config->getUserValue($this->userId, 'richdocuments', 'overview_grid_view', '0') === '1',
+ ]);
// Viewer is pre-installed in production but may not be available in other environments
if (class_exists(LoadViewer::class)) {
diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php
index d633f192ae..e822d33c54 100644
--- a/lib/Controller/SettingsController.php
+++ b/lib/Controller/SettingsController.php
@@ -320,6 +320,15 @@ public function setPersonalSettings($templateFolder,
return new JSONResponse($response);
}
+ #[NoAdminRequired]
+ public function setOverviewGridView(bool $value): JSONResponse {
+ if ($this->userId === null) {
+ return new JSONResponse([], Http::STATUS_UNAUTHORIZED);
+ }
+ $this->config->setUserValue($this->userId, 'richdocuments', 'overview_grid_view', $value ? '1' : '0');
+ return new JSONResponse(['message' => 'ok']);
+ }
+
/**
* @NoAdminRequired
* @PublicPage
diff --git a/src/components/FileCard.vue b/src/components/FileCard.vue
index 32ee2a608f..86a856d9d6 100644
--- a/src/components/FileCard.vue
+++ b/src/components/FileCard.vue
@@ -4,7 +4,7 @@
-->
-
-
+