From 5682d302c72ae42dfa16b068ad70fe312ed1ff9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6=20=28skjnldsv=29?= Date: Tue, 6 Nov 2018 09:06:24 +0100 Subject: [PATCH 1/3] Add grid toggle for every files view MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- apps/files/css/files.scss | 7 +++++++ apps/files/js/filelist.js | 5 +++-- apps/files/lib/Controller/ViewController.php | 2 ++ apps/files/list.php | 5 +++-- apps/files/recentlist.php | 8 ++++++++ apps/files/simplelist.php | 8 ++++++++ apps/files/templates/index.php | 8 ++++++++ apps/files/templates/list.php | 8 -------- apps/files/templates/recentlist.php | 2 +- apps/files/templates/simplelist.php | 2 +- apps/files_external/list.php | 8 ++++++++ apps/files_external/templates/list.php | 2 +- apps/files_sharing/css/public.scss | 1 + apps/files_sharing/lib/Controller/ShareController.php | 2 ++ apps/files_sharing/list.php | 8 ++++++++ apps/files_sharing/templates/list.php | 2 +- apps/files_sharing/templates/public.php | 7 +++++++ apps/files_trashbin/list.php | 8 ++++++++ apps/files_trashbin/templates/index.php | 2 +- 19 files changed, 78 insertions(+), 17 deletions(-) diff --git a/apps/files/css/files.scss b/apps/files/css/files.scss index d6f9bd6131ebd..bc99790f5005a 100644 --- a/apps/files/css/files.scss +++ b/apps/files/css/files.scss @@ -55,6 +55,10 @@ position: relative; width: 100%; min-width: 250px; + // hide table if emptycontent is not hidden + #emptycontent:not(.hidden) ~ & { + display: none; + } } /* fit app list view heights */ @@ -982,6 +986,9 @@ table.dragshadow td.size { margin: 0; padding: 22px; opacity: .5; + position: fixed; + right: 0; + z-index: 100; &:hover, &:focus, diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 9459a266ce9d7..b61b4ef8569de 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -331,9 +331,10 @@ this.$el.find('thead th .columntitle').click(_.bind(this._onClickHeader, this)); - // Toggle for grid view - this.$showGridView = $('input#showgridview'); + // Toggle for grid view, only register once + this.$showGridView = $('input#showgridview:not(.registered)'); this.$showGridView.on('change', _.bind(this._onGridviewChange, this)); + this.$showGridView.addClass('registered'); $('#view-toggle').tooltip({placement: 'bottom', trigger: 'hover'}); this._onResize = _.debounce(_.bind(this._onResize, this), 250); diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php index d91d3b9db4c53..3932b2b0a8e0c 100644 --- a/apps/files/lib/Controller/ViewController.php +++ b/apps/files/lib/Controller/ViewController.php @@ -257,6 +257,8 @@ public function index($dir = '', $view = '', $fileid = null, $fileNotFound = fal $params['allowShareWithLink'] = $this->config->getAppValue('core', 'shareapi_allow_links', 'yes'); $params['defaultFileSorting'] = $this->config->getUserValue($user, 'files', 'file_sorting', 'name'); $params['defaultFileSortingDirection'] = $this->config->getUserValue($user, 'files', 'file_sorting_direction', 'asc'); + $params['showgridview'] = $this->config->getUserValue($user, 'files', 'show_grid', true); + $params['isIE'] = \OCP\Util::isIE(); $showHidden = (bool) $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'show_hidden', false); $params['showHiddenFiles'] = $showHidden ? 1 : 0; $params['fileNotFound'] = $fileNotFound ? 1 : 0; diff --git a/apps/files/list.php b/apps/files/list.php index 23b94d9be20c6..7a5159cf38796 100644 --- a/apps/files/list.php +++ b/apps/files/list.php @@ -25,14 +25,15 @@ $userSession = \OC::$server->getUserSession(); // TODO: move this to the generated config.js $publicUploadEnabled = $config->getAppValue('core', 'shareapi_allow_public_upload', 'yes'); + $showgridview = $config->getUserValue($userSession->getUser()->getUID(), 'files', 'show_grid', true); $isIE = \OCP\Util::isIE(); // renders the controls and table headers template $tmpl = new OCP\Template('files', 'list', ''); -$tmpl->assign('publicUploadEnabled', $publicUploadEnabled); + // gridview not available for ie $tmpl->assign('showgridview', $showgridview && !$isIE); -$tmpl->assign('isIE', $isIE); +$tmpl->assign('publicUploadEnabled', $publicUploadEnabled); $tmpl->printPage(); diff --git a/apps/files/recentlist.php b/apps/files/recentlist.php index 91a9bce06b564..c17f9d598bfb8 100644 --- a/apps/files/recentlist.php +++ b/apps/files/recentlist.php @@ -23,7 +23,15 @@ */ // Check if we are a user OCP\User::checkLoggedIn(); +$config = \OC::$server->getConfig(); +$userSession = \OC::$server->getUserSession(); + +$showgridview = $config->getUserValue($userSession->getUser()->getUID(), 'files', 'show_grid', true); +$isIE = \OCP\Util::isIE(); $tmpl = new OCP\Template('files', 'recentlist', ''); +// gridview not available for ie +$tmpl->assign('showgridview', $showgridview && !$isIE); + $tmpl->printPage(); diff --git a/apps/files/simplelist.php b/apps/files/simplelist.php index 1d61b397050d3..9515ec623634b 100644 --- a/apps/files/simplelist.php +++ b/apps/files/simplelist.php @@ -22,8 +22,16 @@ */ // TODO: move to handlebars +$config = \OC::$server->getConfig(); +$userSession = \OC::$server->getUserSession(); + +$showgridview = $config->getUserValue($userSession->getUser()->getUID(), 'files', 'show_grid', true); +$isIE = \OCP\Util::isIE(); // renders the controls and table headers template $tmpl = new OCP\Template('files', 'simplelist', ''); + +// gridview not available for ie +$tmpl->assign('showgridview', $showgridview && !$isIE); $tmpl->printPage(); diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php index b49684643bb52..69ad73f108139 100644 --- a/apps/files/templates/index.php +++ b/apps/files/templates/index.php @@ -1,6 +1,14 @@ printPage(); ?>
+ + + checked="checked" /> + + + - diff --git a/apps/files/templates/recentlist.php b/apps/files/templates/recentlist.php index 4c269c20256d9..360b5c95ee40f 100644 --- a/apps/files/templates/recentlist.php +++ b/apps/files/templates/recentlist.php @@ -11,7 +11,7 @@

-
+