From 26ca7a0e2f86cb76726073f2d73fd5cb8a1e09d9 Mon Sep 17 00:00:00 2001 From: "John Molakvoæ (skjnldsv)" Date: Tue, 23 Oct 2018 10:38:00 +0200 Subject: Add filepicker toggle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- apps/files/appinfo/routes.php | 5 +++++ apps/files/lib/Controller/ApiController.php | 11 +++++++++++ 2 files changed, 16 insertions(+) (limited to 'apps/files') diff --git a/apps/files/appinfo/routes.php b/apps/files/appinfo/routes.php index 61bc1d99a5d..ef648bf2850 100644 --- a/apps/files/appinfo/routes.php +++ b/apps/files/appinfo/routes.php @@ -66,6 +66,11 @@ $application->registerRoutes( 'url' => '/api/v1/showgridview', 'verb' => 'POST' ], + [ + 'name' => 'API#getGridView', + 'url' => '/api/v1/showgridview', + 'verb' => 'GET' + ], [ 'name' => 'view#index', 'url' => '/', diff --git a/apps/files/lib/Controller/ApiController.php b/apps/files/lib/Controller/ApiController.php index 3c1eb6e43fb..e70f34bd1a4 100644 --- a/apps/files/lib/Controller/ApiController.php +++ b/apps/files/lib/Controller/ApiController.php @@ -38,6 +38,7 @@ use OCP\Files\NotFoundException; use OCP\IConfig; use OCP\IRequest; use OCP\AppFramework\Http\DataResponse; +use OCP\AppFramework\Http\JSONResponse; use OCP\AppFramework\Http\FileDisplayResponse; use OCP\AppFramework\Http\Response; use OCA\Files\Service\TagService; @@ -279,6 +280,16 @@ class ApiController extends Controller { return new Response(); } + /** + * Get default settings for the grid view + * + * @NoAdminRequired + */ + public function getGridView() { + $status = $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'show_grid', '1') === '1'; + return new JSONResponse(['gridview' => $status]); + } + /** * Toggle default for showing/hiding xxx folder * -- cgit v1.2.3