fix #19: add option to keep external sites in the top menu
This commit is contained in:
parent
7864e16ef3
commit
c52079e882
|
@ -15,10 +15,6 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#appmenu, #appmenu + nav {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
#side-menu {
|
#side-menu {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
|
|
@ -64,6 +64,7 @@ class CssController extends Controller
|
||||||
],
|
],
|
||||||
'display-logo' => (bool) $this->config->getAppValue('side_menu', 'display-logo', 1),
|
'display-logo' => (bool) $this->config->getAppValue('side_menu', 'display-logo', 1),
|
||||||
'opener-only' => (bool) $this->config->getAppValue('side_menu', 'opener-only', 0),
|
'opener-only' => (bool) $this->config->getAppValue('side_menu', 'opener-only', 0),
|
||||||
|
'external-sites-in-top-menu' => (bool) $this->config->getAppValue('side_menu', 'external-sites-in-top-menu', 0),
|
||||||
'size-icon' => $this->config->getAppValue('side_menu', 'size-icon', 'normal'),
|
'size-icon' => $this->config->getAppValue('side_menu', 'size-icon', 'normal'),
|
||||||
'size-text' => $this->config->getAppValue('side_menu', 'size-text', 'normal'),
|
'size-text' => $this->config->getAppValue('side_menu', 'size-text', 'normal'),
|
||||||
];
|
];
|
||||||
|
|
|
@ -54,6 +54,7 @@ class JsController extends Controller
|
||||||
$parameters = [
|
$parameters = [
|
||||||
'opener-position' => $this->config->getAppValue('side_menu', 'opener-position', 'before'),
|
'opener-position' => $this->config->getAppValue('side_menu', 'opener-position', 'before'),
|
||||||
'opener-hover' => (bool) $this->config->getAppValue('side_menu', 'opener-hover', '0'),
|
'opener-hover' => (bool) $this->config->getAppValue('side_menu', 'opener-hover', '0'),
|
||||||
|
'external-sites-in-top-menu' => (bool) $this->config->getAppValue('side_menu', 'external-sites-in-top-menu', 0),
|
||||||
'force-light-icon' => (bool) $this->config->getAppValue('side_menu', 'force-light-icon', '0'),
|
'force-light-icon' => (bool) $this->config->getAppValue('side_menu', 'force-light-icon', '0'),
|
||||||
'hide-when-no-apps' => (bool) $this->config->getAppValue('side_menu', 'hide-when-no-apps', '0'),
|
'hide-when-no-apps' => (bool) $this->config->getAppValue('side_menu', 'hide-when-no-apps', '0'),
|
||||||
];
|
];
|
||||||
|
|
|
@ -65,6 +65,7 @@ class Admin implements ISettings
|
||||||
'hide-when-no-apps' => $this->config->getAppValue('side_menu', 'hide-when-no-apps', '0'),
|
'hide-when-no-apps' => $this->config->getAppValue('side_menu', 'hide-when-no-apps', '0'),
|
||||||
'size-icon' => $this->config->getAppValue('side_menu', 'size-icon', 'normal'),
|
'size-icon' => $this->config->getAppValue('side_menu', 'size-icon', 'normal'),
|
||||||
'size-text' => $this->config->getAppValue('side_menu', 'size-text', 'normal'),
|
'size-text' => $this->config->getAppValue('side_menu', 'size-text', 'normal'),
|
||||||
|
'external-sites-in-top-menu' => $this->config->getAppValue('side_menu', 'external-sites-in-top-menu', '0'),
|
||||||
];
|
];
|
||||||
|
|
||||||
return new TemplateResponse('side_menu', 'settings/admin-form', $parameters, '');
|
return new TemplateResponse('side_menu', 'settings/admin-form', $parameters, '');
|
||||||
|
|
|
@ -53,6 +53,10 @@ export default {
|
||||||
for (let element of links) {
|
for (let element of links) {
|
||||||
let href = element.getAttribute('href')
|
let href = element.getAttribute('href')
|
||||||
|
|
||||||
|
if (this.ignoreExternalSites && element.parentNode.getAttribute('data-id').indexOf('external_index') !== -1) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (href !== '#') {
|
if (href !== '#') {
|
||||||
let svg = element.querySelector('svg').outerHTML
|
let svg = element.querySelector('svg').outerHTML
|
||||||
|
|
||||||
|
@ -99,6 +103,7 @@ export default {
|
||||||
this.retrieveApps()
|
this.retrieveApps()
|
||||||
this.retrieveLogo()
|
this.retrieveLogo()
|
||||||
this.forceLightIcon = document.querySelector('#side-menu-container').getAttribute('data-forcelighticon') == 1;
|
this.forceLightIcon = document.querySelector('#side-menu-container').getAttribute('data-forcelighticon') == 1;
|
||||||
|
this.ignoreExternalSites = document.querySelector('#side-menu-container').getAttribute('data-externalsitesintopmenu') == 1;
|
||||||
|
|
||||||
const menu = document.querySelector('#appmenu')
|
const menu = document.querySelector('#appmenu')
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ const elements = [
|
||||||
'side-menu-size-icon',
|
'side-menu-size-icon',
|
||||||
'side-menu-size-text',
|
'side-menu-size-text',
|
||||||
'side-menu-cache',
|
'side-menu-cache',
|
||||||
|
'side-menu-external-sites-in-top-menu',
|
||||||
];
|
];
|
||||||
|
|
||||||
const selector = '#side-menu-message';
|
const selector = '#side-menu-message';
|
||||||
|
|
|
@ -8,6 +8,16 @@
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<?php if ($_['external-sites-in-top-menu'] === false): ?>
|
||||||
|
#appmenu {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
#appmenu + nav {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
<?php if ($_['opener-only'] === true): ?>
|
<?php if ($_['opener-only'] === true): ?>
|
||||||
#nextcloud {
|
#nextcloud {
|
||||||
display: none;
|
display: none;
|
||||||
|
|
|
@ -9,6 +9,30 @@
|
||||||
sideMenuContainer.attr('data-forcelighticon', '1')
|
sideMenuContainer.attr('data-forcelighticon', '1')
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if ($_['external-sites-in-top-menu']): ?>
|
||||||
|
sideMenuContainer.attr('data-externalsitesintopmenu', '1')
|
||||||
|
|
||||||
|
var externalSitesInTopMenu = function() {
|
||||||
|
var items = $('#appmenu').find('li')
|
||||||
|
|
||||||
|
items.each(function(i, item) {
|
||||||
|
var dataId = item.getAttribute('data-id')
|
||||||
|
|
||||||
|
if (dataId === null || dataId.indexOf('external_index') === -1) {
|
||||||
|
item.style.display = 'none'
|
||||||
|
item.classList.remove('hidden')
|
||||||
|
} else {
|
||||||
|
item.style.display = 'flex'
|
||||||
|
item.classList.add('hidden')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
$(window).resize(externalSitesInTopMenu);
|
||||||
|
|
||||||
|
setInterval(externalSitesInTopMenu, 500);
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
body.on('side-menu.apps', function(e, apps) {
|
body.on('side-menu.apps', function(e, apps) {
|
||||||
<?php if ($_['hide-when-no-apps']): ?>
|
<?php if ($_['hide-when-no-apps']): ?>
|
||||||
sideMenu = $('#side-menu')
|
sideMenu = $('#side-menu')
|
||||||
|
|
|
@ -248,6 +248,23 @@ $choicesSizes = [
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label for="side-menu-external-sites-in-top-menu" class="settings-hint">
|
||||||
|
<?php p($l->t('Do not move external sites in the side menu')); ?>
|
||||||
|
<small><span class="warning">Experimental</span></small>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<select id="side-menu-external-sites-in-top-menu" name="external-sites-in-top-menu">
|
||||||
|
<?php foreach ($choicesYesNo as $label => $value): ?>
|
||||||
|
<option value="<?php echo $value ?>" <?php if ($value === $_['external-sites-in-top-menu']): ?>selected<?php endif; ?>>
|
||||||
|
<?php echo $l->t($label); ?>
|
||||||
|
</option>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="section">
|
<div class="section">
|
||||||
|
|
Loading…
Reference in New Issue