Add grid toggle for every files view
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
parent
54a30a4b81
commit
5682d302c7
19 changed files with 78 additions and 17 deletions
|
@ -55,6 +55,10 @@
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-width: 250px;
|
min-width: 250px;
|
||||||
|
// hide table if emptycontent is not hidden
|
||||||
|
#emptycontent:not(.hidden) ~ & {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* fit app list view heights */
|
/* fit app list view heights */
|
||||||
|
@ -982,6 +986,9 @@ table.dragshadow td.size {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 22px;
|
padding: 22px;
|
||||||
opacity: .5;
|
opacity: .5;
|
||||||
|
position: fixed;
|
||||||
|
right: 0;
|
||||||
|
z-index: 100;
|
||||||
|
|
||||||
&:hover,
|
&:hover,
|
||||||
&:focus,
|
&:focus,
|
||||||
|
|
|
@ -331,9 +331,10 @@
|
||||||
|
|
||||||
this.$el.find('thead th .columntitle').click(_.bind(this._onClickHeader, this));
|
this.$el.find('thead th .columntitle').click(_.bind(this._onClickHeader, this));
|
||||||
|
|
||||||
// Toggle for grid view
|
// Toggle for grid view, only register once
|
||||||
this.$showGridView = $('input#showgridview');
|
this.$showGridView = $('input#showgridview:not(.registered)');
|
||||||
this.$showGridView.on('change', _.bind(this._onGridviewChange, this));
|
this.$showGridView.on('change', _.bind(this._onGridviewChange, this));
|
||||||
|
this.$showGridView.addClass('registered');
|
||||||
$('#view-toggle').tooltip({placement: 'bottom', trigger: 'hover'});
|
$('#view-toggle').tooltip({placement: 'bottom', trigger: 'hover'});
|
||||||
|
|
||||||
this._onResize = _.debounce(_.bind(this._onResize, this), 250);
|
this._onResize = _.debounce(_.bind(this._onResize, this), 250);
|
||||||
|
|
|
@ -257,6 +257,8 @@ class ViewController extends Controller {
|
||||||
$params['allowShareWithLink'] = $this->config->getAppValue('core', 'shareapi_allow_links', 'yes');
|
$params['allowShareWithLink'] = $this->config->getAppValue('core', 'shareapi_allow_links', 'yes');
|
||||||
$params['defaultFileSorting'] = $this->config->getUserValue($user, 'files', 'file_sorting', 'name');
|
$params['defaultFileSorting'] = $this->config->getUserValue($user, 'files', 'file_sorting', 'name');
|
||||||
$params['defaultFileSortingDirection'] = $this->config->getUserValue($user, 'files', 'file_sorting_direction', 'asc');
|
$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);
|
$showHidden = (bool) $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'show_hidden', false);
|
||||||
$params['showHiddenFiles'] = $showHidden ? 1 : 0;
|
$params['showHiddenFiles'] = $showHidden ? 1 : 0;
|
||||||
$params['fileNotFound'] = $fileNotFound ? 1 : 0;
|
$params['fileNotFound'] = $fileNotFound ? 1 : 0;
|
||||||
|
|
|
@ -25,14 +25,15 @@ $config = \OC::$server->getConfig();
|
||||||
$userSession = \OC::$server->getUserSession();
|
$userSession = \OC::$server->getUserSession();
|
||||||
// TODO: move this to the generated config.js
|
// TODO: move this to the generated config.js
|
||||||
$publicUploadEnabled = $config->getAppValue('core', 'shareapi_allow_public_upload', 'yes');
|
$publicUploadEnabled = $config->getAppValue('core', 'shareapi_allow_public_upload', 'yes');
|
||||||
|
|
||||||
$showgridview = $config->getUserValue($userSession->getUser()->getUID(), 'files', 'show_grid', true);
|
$showgridview = $config->getUserValue($userSession->getUser()->getUID(), 'files', 'show_grid', true);
|
||||||
$isIE = \OCP\Util::isIE();
|
$isIE = \OCP\Util::isIE();
|
||||||
|
|
||||||
// renders the controls and table headers template
|
// renders the controls and table headers template
|
||||||
$tmpl = new OCP\Template('files', 'list', '');
|
$tmpl = new OCP\Template('files', 'list', '');
|
||||||
$tmpl->assign('publicUploadEnabled', $publicUploadEnabled);
|
|
||||||
// gridview not available for ie
|
// gridview not available for ie
|
||||||
$tmpl->assign('showgridview', $showgridview && !$isIE);
|
$tmpl->assign('showgridview', $showgridview && !$isIE);
|
||||||
$tmpl->assign('isIE', $isIE);
|
$tmpl->assign('publicUploadEnabled', $publicUploadEnabled);
|
||||||
$tmpl->printPage();
|
$tmpl->printPage();
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,15 @@
|
||||||
*/
|
*/
|
||||||
// Check if we are a user
|
// Check if we are a user
|
||||||
OCP\User::checkLoggedIn();
|
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', '');
|
$tmpl = new OCP\Template('files', 'recentlist', '');
|
||||||
|
|
||||||
|
// gridview not available for ie
|
||||||
|
$tmpl->assign('showgridview', $showgridview && !$isIE);
|
||||||
|
|
||||||
$tmpl->printPage();
|
$tmpl->printPage();
|
||||||
|
|
|
@ -22,8 +22,16 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// TODO: move to handlebars
|
// 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
|
// renders the controls and table headers template
|
||||||
$tmpl = new OCP\Template('files', 'simplelist', '');
|
$tmpl = new OCP\Template('files', 'simplelist', '');
|
||||||
|
|
||||||
|
// gridview not available for ie
|
||||||
|
$tmpl->assign('showgridview', $showgridview && !$isIE);
|
||||||
$tmpl->printPage();
|
$tmpl->printPage();
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,14 @@
|
||||||
<?php /** @var $l \OCP\IL10N */ ?>
|
<?php /** @var $l \OCP\IL10N */ ?>
|
||||||
<?php $_['appNavigation']->printPage(); ?>
|
<?php $_['appNavigation']->printPage(); ?>
|
||||||
<div id="app-content">
|
<div id="app-content">
|
||||||
|
|
||||||
|
<?php if (!$_['isIE']) { ?>
|
||||||
|
<input type="checkbox" class="hidden-visually" id="showgridview"
|
||||||
|
<?php if($_['showgridview']) { ?>checked="checked" <?php } ?>/>
|
||||||
|
<label id="view-toggle" for="showgridview" class="button <?php p($_['showgridview'] ? 'icon-toggle-filelist' : 'icon-toggle-pictures') ?>"
|
||||||
|
title="<?php p($l->t('Toggle grid view'))?>"></label>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
<?php foreach ($_['appContents'] as $content) { ?>
|
<?php foreach ($_['appContents'] as $content) { ?>
|
||||||
<div id="app-content-<?php p($content['id']) ?>" class="hidden viewcontainer">
|
<div id="app-content-<?php p($content['id']) ?>" class="hidden viewcontainer">
|
||||||
<?php print_unescaped($content['content']) ?>
|
<?php print_unescaped($content['content']) ?>
|
||||||
|
|
|
@ -24,13 +24,6 @@
|
||||||
<?php endif;?>
|
<?php endif;?>
|
||||||
<input type="hidden" class="max_human_file_size"
|
<input type="hidden" class="max_human_file_size"
|
||||||
value="(max <?php isset($_['uploadMaxHumanFilesize']) ? p($_['uploadMaxHumanFilesize']) : ''; ?>)">
|
value="(max <?php isset($_['uploadMaxHumanFilesize']) ? p($_['uploadMaxHumanFilesize']) : ''; ?>)">
|
||||||
<!-- IF NOT IE, SHOW GRIDVIEW -->
|
|
||||||
<?php if (!$_['isIE']) { ?>
|
|
||||||
<input type="checkbox" class="hidden-visually" id="showgridview"
|
|
||||||
<?php if($_['showgridview']) { ?>checked="checked" <?php } ?>/>
|
|
||||||
<label id="view-toggle" for="showgridview" class="button <?php p($_['showgridview'] ? 'icon-toggle-filelist' : 'icon-toggle-pictures') ?>"
|
|
||||||
title="<?php p($l->t('Toggle grid view'))?>"></label>
|
|
||||||
<?php } ?>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="emptycontent" class="hidden">
|
<div id="emptycontent" class="hidden">
|
||||||
|
@ -44,7 +37,6 @@
|
||||||
<h2><?php p($l->t('No entries found in this folder')); ?></h2>
|
<h2><?php p($l->t('No entries found in this folder')); ?></h2>
|
||||||
<p></p>
|
<p></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<table id="filestable" class="list-container <?php p($_['showgridview'] ? 'view-grid' : '') ?>" data-allow-public-upload="<?php p($_['publicUploadEnabled'])?>" data-preview-x="250" data-preview-y="250">
|
<table id="filestable" class="list-container <?php p($_['showgridview'] ? 'view-grid' : '') ?>" data-allow-public-upload="<?php p($_['publicUploadEnabled'])?>" data-preview-x="250" data-preview-y="250">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<p></p>
|
<p></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<table id="filestable" class="list-container view-grid">
|
<table id="filestable" class="list-container <?php p($_['showgridview'] ? 'view-grid' : '') ?>">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th id='headerName' class="hidden column-name">
|
<th id='headerName' class="hidden column-name">
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<h2><?php p($l->t('No entries found in this folder')); ?></h2>
|
<h2><?php p($l->t('No entries found in this folder')); ?></h2>
|
||||||
<p></p>
|
<p></p>
|
||||||
</div>
|
</div>
|
||||||
<table id="filestable" class="list-container view-grid">
|
<table id="filestable" class="list-container <?php p($_['showgridview'] ? 'view-grid' : '') ?>">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th id='headerName' class="hidden column-name">
|
<th id='headerName' class="hidden column-name">
|
||||||
|
|
|
@ -22,9 +22,17 @@
|
||||||
*/
|
*/
|
||||||
// Check if we are a user
|
// Check if we are a user
|
||||||
OCP\User::checkLoggedIn();
|
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_external', 'list', '');
|
$tmpl = new OCP\Template('files_external', 'list', '');
|
||||||
|
|
||||||
|
// gridview not available for ie
|
||||||
|
$tmpl->assign('showgridview', $showgridview && !$isIE);
|
||||||
|
|
||||||
/* Load Status Manager */
|
/* Load Status Manager */
|
||||||
\OCP\Util::addStyle('files_external', 'external');
|
\OCP\Util::addStyle('files_external', 'external');
|
||||||
\OCP\Util::addScript('files_external', 'statusmanager');
|
\OCP\Util::addScript('files_external', 'statusmanager');
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
<input type="hidden" name="dir" value="" id="dir">
|
<input type="hidden" name="dir" value="" id="dir">
|
||||||
|
|
||||||
<table id="filestable" class="list-container view-grid">
|
<table id="filestable" class="list-container <?php p($_['showgridview'] ? 'view-grid' : '') ?>">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th id='headerName' class="hidden column-name">
|
<th id='headerName' class="hidden column-name">
|
||||||
|
|
|
@ -169,6 +169,7 @@ thead {
|
||||||
position: relative;
|
position: relative;
|
||||||
font-weight: 300;
|
font-weight: 300;
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
|
line-height: 11px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
|
@ -367,6 +367,8 @@ class ShareController extends AuthPublicShareController {
|
||||||
$shareTmpl['folder'] = $folder->fetchPage();
|
$shareTmpl['folder'] = $folder->fetchPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$shareTmpl['showgridview'] = true;
|
||||||
|
|
||||||
$shareTmpl['hideFileList'] = $hideFileList;
|
$shareTmpl['hideFileList'] = $hideFileList;
|
||||||
$shareTmpl['shareOwner'] = $this->userManager->get($share->getShareOwner())->getDisplayName();
|
$shareTmpl['shareOwner'] = $this->userManager->get($share->getShareOwner())->getDisplayName();
|
||||||
$shareTmpl['downloadURL'] = $this->urlGenerator->linkToRouteAbsolute('files_sharing.sharecontroller.downloadShare', ['token' => $this->getToken()]);
|
$shareTmpl['downloadURL'] = $this->urlGenerator->linkToRouteAbsolute('files_sharing.sharecontroller.downloadShare', ['token' => $this->getToken()]);
|
||||||
|
|
|
@ -21,9 +21,17 @@
|
||||||
*/
|
*/
|
||||||
// Check if we are a user
|
// Check if we are a user
|
||||||
OCP\User::checkLoggedIn();
|
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_sharing', 'list', '');
|
$tmpl = new OCP\Template('files_sharing', 'list', '');
|
||||||
|
|
||||||
|
// gridview not available for ie
|
||||||
|
$tmpl->assign('showgridview', $showgridview && !$isIE);
|
||||||
|
|
||||||
OCP\Util::addScript('files_sharing', 'app');
|
OCP\Util::addScript('files_sharing', 'app');
|
||||||
OCP\Util::addScript('files_sharing', 'sharedfilelist');
|
OCP\Util::addScript('files_sharing', 'sharedfilelist');
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<h2><?php p($l->t('No entries found in this folder')); ?></h2>
|
<h2><?php p($l->t('No entries found in this folder')); ?></h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<table id="filestable" class="list-container view-grid">
|
<table id="filestable" class="list-container <?php p($_['showgridview'] ? 'view-grid' : '') ?>">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th id='headerName' class="hidden column-name">
|
<th id='headerName' class="hidden column-name">
|
||||||
|
|
|
@ -45,6 +45,13 @@ $maxUploadFilesize = min($upload_max_filesize, $post_max_size);
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if (!$_['isIE']) { ?>
|
||||||
|
<input type="checkbox" class="hidden-visually" id="showgridview"
|
||||||
|
<?php if($_['showgridview']) { ?>checked="checked" <?php } ?>/>
|
||||||
|
<label id="view-toggle" for="showgridview" class="button <?php p($_['showgridview'] ? 'icon-toggle-filelist' : 'icon-toggle-pictures') ?>"
|
||||||
|
title="<?php p($l->t('Toggle grid view'))?>"></label>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
<?php if (!isset($_['hideFileList']) || (isset($_['hideFileList']) && $_['hideFileList'] === false)) { ?>
|
<?php if (!isset($_['hideFileList']) || (isset($_['hideFileList']) && $_['hideFileList'] === false)) { ?>
|
||||||
<div id="files-public-content">
|
<div id="files-public-content">
|
||||||
<div id="preview">
|
<div id="preview">
|
||||||
|
|
|
@ -24,8 +24,16 @@
|
||||||
// Check if we are a user
|
// Check if we are a user
|
||||||
OCP\User::checkLoggedIn();
|
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_trashbin', 'index', '');
|
$tmpl = new OCP\Template('files_trashbin', 'index', '');
|
||||||
|
|
||||||
|
// gridview not available for ie
|
||||||
|
$tmpl->assign('showgridview', $showgridview && !$isIE);
|
||||||
OCP\Util::addStyle('files_trashbin', 'trash');
|
OCP\Util::addStyle('files_trashbin', 'trash');
|
||||||
OCP\Util::addScript('files_trashbin', 'app');
|
OCP\Util::addScript('files_trashbin', 'app');
|
||||||
OCP\Util::addScript('files_trashbin', 'filelist');
|
OCP\Util::addScript('files_trashbin', 'filelist');
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
<p></p>
|
<p></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<table id="filestable" class="list-container view-grid">
|
<table id="filestable" class="list-container <?php p($_['showgridview'] ? 'view-grid' : '') ?>">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th id="headerSelection" class="hidden column-selection">
|
<th id="headerSelection" class="hidden column-selection">
|
||||||
|
|
Loading…
Reference in a new issue