Compare commits

...

8 Commits

Author SHA1 Message Date
Simon Vieille 8368562ed0 release v1.6.2 2020-05-14 13:28:39 +02:00
Simon Vieille 9a8f5517b6 add a cache for the top menu update (#19) 2020-05-13 12:25:11 +02:00
Simon Vieille bddd8e9c0c release v1.6.1 2020-05-12 19:48:44 +02:00
Simon Vieille 03dbe8eeed fix issue #19: add a hack to show external sites in the top menu with navigation 2020-05-12 19:45:46 +02:00
Simon Vieille 321e5b1178 add title on links 2020-05-12 09:25:43 +02:00
Simon Vieille 594b818515 release v1.6.0 2020-05-11 22:57:55 +02:00
Simon Vieille 7ac19c7bec add personal settings page to enabled (or not) the side menu 2020-05-11 22:51:27 +02:00
Simon Vieille 375ed7d2f1 indentation 2020-05-09 16:37:17 +02:00
18 changed files with 598 additions and 128 deletions
+10 -2
View File
@@ -20,8 +20,7 @@ $ cd /path/to/nextcloud/apps
$ unzip -d side_menu /path/to/side_menu_vX.Y.Z.zip
```
Upgrade
-------
### Upgrade
Side menu can be upgraded from the app store.
@@ -35,6 +34,9 @@ $ rm -frv side_menu
$ unzip -d side_menu /path/to/side_menu_vX.Y.Z.zip
```
Preview
-------
![](https://upload.deblan.org/u/2020-03/5e81b219.jpg)
![](https://upload.deblan.org/u/2020-03/5e7fab2b.jpg)
@@ -43,6 +45,12 @@ $ unzip -d side_menu /path/to/side_menu_vX.Y.Z.zip
![](https://upload.deblan.org/u/2020-05/5eb6b78a.png)
Configuration
-------------
Administrators can edit many settings using the administration page.
Users can disable the menu using the page of personal settings.
How to contribute?
------------------
+39 -30
View File
@@ -21,42 +21,51 @@ namespace OCA\SideMenu\Appinfo;
use OC\Security\CSP\ContentSecurityPolicy;
use OCP\Util;
use OCP\IUserSession;
$config = \OC::$server->getConfig();
$cspnm = \OC::$server->getContentSecurityPolicyNonceManager();
$user = \OC::$server[IUserSession::class]->getUser();
$enabled = true;
Util::addScript('side_menu', 'sideMenu');
Util::addStyle('side_menu', 'sideMenu');
if ($user !== null) {
$enabled = (bool) $config->getUserValue($user->getUid(), 'side_menu', 'enabled', '1');
}
$stylesheet = \OC::$server->getURLGenerator()->linkToRoute(
'side_menu.Css.stylesheet',
[
'v' => $config->getAppValue('side_menu', 'cache', '0'),
]
);
if ($enabled) {
Util::addScript('side_menu', 'sideMenu');
Util::addStyle('side_menu', 'sideMenu');
$script = \OC::$server->getURLGenerator()->linkToRoute(
'side_menu.Js.script',
[
'v' => $config->getAppValue('side_menu', 'cache', '0'),
]
);
$stylesheet = \OC::$server->getURLGenerator()->linkToRoute(
'side_menu.Css.stylesheet',
[
'v' => $config->getAppValue('side_menu', 'cache', '0'),
]
);
Util::addHeader(
'link',
[
'href' => $stylesheet,
'rel' => 'stylesheet'
],
''
);
$script = \OC::$server->getURLGenerator()->linkToRoute(
'side_menu.Js.script',
[
'v' => $config->getAppValue('side_menu', 'cache', '0'),
]
);
Util::addHeader(
'script',
[
'src' => $script,
'nonce' => $cspnm->getNonce(),
],
''
);
Util::addHeader(
'link',
[
'href' => $stylesheet,
'rel' => 'stylesheet'
],
''
);
Util::addHeader(
'script',
[
'src' => $script,
'nonce' => $cspnm->getNonce(),
],
''
);
}
+4 -2
View File
@@ -13,7 +13,7 @@ You can report a bug or request a feature by opening an issue.
]]></description>
<licence>agpl</licence>
<author mail="contact@deblan.fr" homepage="https://www.deblan.io/">Simon Vieille</author>
<version>1.5.0</version>
<version>1.6.2</version>
<namespace>SideMenu</namespace>
<category>customization</category>
<website>https://gitnet.fr/deblan/side_menu</website>
@@ -28,6 +28,8 @@ You can report a bug or request a feature by opening an issue.
</dependencies>
<settings>
<admin>OCA\SideMenu\Settings\Admin</admin>
<admin-section>OCA\SideMenu\Settings\Section</admin-section>
<admin-section>OCA\SideMenu\Settings\AdminSection</admin-section>
<personal>OCA\SideMenu\Settings\Personal</personal>
<personal-section>OCA\SideMenu\Settings\PersonalSection</personal-section>
</settings>
</info>
+1
View File
@@ -21,5 +21,6 @@ return [
'routes' => [
['name' => 'Css#stylesheet', 'url' => '/css/stylesheet', 'verb' => 'GET'],
['name' => 'Js#script', 'url' => '/js/script', 'verb' => 'GET'],
['name' => 'PersonalSetting#valueSet', 'url' => '/personalSetting/valueSet', 'verb' => 'POST'],
],
];
+3 -1
View File
@@ -27,7 +27,9 @@ use OCP\IRequest;
class CssController extends Controller
{
/** @var \OCP\IConfig */
/**
* @var \OCP\IConfig
*/
protected $config;
/**
+3 -1
View File
@@ -27,7 +27,9 @@ use OCP\IRequest;
class JsController extends Controller
{
/** @var \OCP\IConfig */
/**
* @var \OCP\IConfig
*/
protected $config;
/**
@@ -0,0 +1,72 @@
<?php
/**
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace OCA\SideMenu\Controller;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Http\Response;
use OCP\IConfig;
use OCP\IRequest;
use OCP\IUserSession;
class PersonalSettingController extends Controller
{
/**
* @var \OCP\IConfig
*/
protected $config;
/**
* @var IUserSession
*/
private $userSession;
public function __construct($appName, IRequest $request, IConfig $config, IUserSession $userSession)
{
parent::__construct($appName, $request);
$this->config = $config;
$this->userSession = $userSession;
}
/**
* @NoAdminRequired
*
* @return Response
*/
public function valueSet($name, $value)
{
$doSave = false;
$user = $this->userSession->getUser();
if ($name === 'enabled') {
$doSave = true;
if (!in_array($value, ['0', '1'])) {
$value = '1';
}
}
if ($doSave) {
$this->config->setUserValue($user->getUid(), 'side_menu', 'enabled', $value);
}
return [];
}
}
+9 -3
View File
@@ -26,13 +26,19 @@ use OCP\IConfig;
class Admin implements ISettings
{
/** @var IL10N */
/**
* @var IL10N
*/
private $l;
/** @var ILogger */
/**
* @var ILogger
*/
private $logger;
/** @var IConfig */
/**
* @var IConfig
*/
private $config;
public function __construct(IL10N $l, ILogger $logger, IConfig $config)
@@ -22,12 +22,16 @@ use OCP\IL10N;
use OCP\IURLGenerator;
use OCP\Settings\IIconSection;
class Section implements IIconSection
class AdminSection implements IIconSection
{
/** @var IL10N */
/**
* @var IL10N
*/
private $l;
/** @var IURLGenerator */
/**
* @var IURLGenerator
*/
private $url;
/**
+91
View File
@@ -0,0 +1,91 @@
<?php
/**
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace OCA\SideMenu\Settings;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IL10N;
use OCP\ILogger;
use OCP\Settings\ISettings;
use OCP\IConfig;
use OCP\IUserSession;
class Personal implements ISettings
{
/**
* @var IL10N
*/
private $l;
/**
* @var ILogger
*/
private $logger;
/**
* @var IConfig
*/
private $config;
/**
* @var IUserSession
*/
private $userSession;
public function __construct(IL10N $l, ILogger $logger, IConfig $config, IUserSession $userSession)
{
$this->l = $l;
$this->logger = $logger;
$this->config = $config;
$this->userSession = $userSession;
}
/**
* @return TemplateResponse
*/
public function getForm()
{
$user = $this->userSession->getUser();
$parameters = [
'enabled' => $this->config->getUserValue($user->getUid(), 'side_menu', 'enabled', '1'),
];
return new TemplateResponse('side_menu', 'settings/personal-form', $parameters, '');
}
/**
* @return string the section ID, e.g. 'sharing'
*/
public function getSection()
{
return 'side_menu';
}
/**
* @return int whether the form should be rather on the top or bottom of
* the admin section. The forms are arranged in ascending order of the
* priority values. It is required to return a value between 0 and 100.
*
* E.g.: 70
*/
public function getPriority()
{
return 70;
}
}
+88
View File
@@ -0,0 +1,88 @@
<?php
/**
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace OCA\SideMenu\Settings;
use OCP\IL10N;
use OCP\IURLGenerator;
use OCP\Settings\IIconSection;
class PersonalSection implements IIconSection
{
/**
* @var IL10N
*/
private $l;
/**
* @var IURLGenerator
*/
private $url;
/**
* @param IURLGenerator $url
* @param IL10N $l
*/
public function __construct(IURLGenerator $url, IL10N $l)
{
$this->url = $url;
$this->l = $l;
}
/**
* returns the ID of the section. It is supposed to be a lower case string,
* e.g. 'ldap'
*
* @returns string
*/
public function getID()
{
return 'side_menu';
}
/**
* returns the translated name as it should be displayed, e.g. 'LDAP / AD
* integration'. Use the L10N service to translate it.
*
* @return string
*/
public function getName()
{
return $this->l->t('Side menu');
}
/**
* @return int whether the form should be rather on the top or bottom of
* the settings navigation. The sections are arranged in ascending order of
* the priority values. It is required to return a value between 0 and 99.
*
* E.g.: 70
*/
public function getPriority()
{
return 70;
}
/**
* {@inheritdoc}
*/
public function getIcon()
{
return $this->url->imagePath('theming', 'app-dark.svg');
}
}
+1
View File
@@ -13,6 +13,7 @@
"dependencies": {
"@nextcloud/axios": "^1.3.2",
"@nextcloud/vue": "^1.4.0",
"trim": "0.0.1",
"vue": "^2.6.11"
},
"browserslist": [
+30 -20
View File
@@ -26,7 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<ul class="side-menu-apps-list">
<li v-for="app in apps" v-bind:class="{'side-menu-app': true, 'active': app.active}">
<a v-bind:href="app.href">
<a v-bind:href="app.href" v-bind:title="app.name">
<span class="side-menu-app-icon" v-html="app.icon"></span>
<span class="side-menu-app-text" v-html="app.name"></span>
</a>
@@ -36,53 +36,63 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</template>
<script>
import trim from 'trim'
export default {
name: 'SideMenu',
data() {
return {
apps: [],
logo: null,
forceLightIcon: false,
forceLightIcon: false,
}
},
methods: {
retrieveApps() {
this.apps = []
this.apps = []
const links = document.querySelectorAll('#appmenu a')
for (let element of links) {
let href = element.getAttribute('href')
var parent = element.parentNode
if (this.ignoreExternalSites && element.parentNode.getAttribute('data-id').indexOf('external_index') !== -1) {
continue;
}
if (!parent) {
continue
}
var dataId = parent.getAttribute('data-id')
dataId = dataId !== null ? dataId : ''
if (this.ignoreExternalSites && dataId.indexOf('external_index') !== -1) {
continue
}
if (href !== '#') {
let svg = element.querySelector('svg').outerHTML
svg = svg
.replace(/(height|width)="20"/, '')
.replace('id="invertMenuMain', 'id="invertSideMenu')
.replace('url(#invertMenuMain', 'url(#invertSideMenu')
.replace(/(height|width)="20"/, '')
.replace('id="invertMenuMain', 'id="invertSideMenu')
.replace('url(#invertMenuMain', 'url(#invertSideMenu')
if (this.forceLightIcon) {
svg = svg.replace(/filter="url[^"]+"/, '')
}
if (this.forceLightIcon) {
svg = svg.replace(/filter="url[^"]+"/, '')
}
this.apps.push({
href: href,
name: element.querySelector('span').innerHTML,
name: trim(element.querySelector('span').innerHTML),
icon: svg,
active: element.classList.contains('active')
});
}
}
(function(apps) {
window.setTimeout(function() {
jQuery('body').trigger('side-menu.apps', [apps])
}, 1000)
})(this.apps)
(function(apps) {
window.setTimeout(function() {
jQuery('body').trigger('side-menu.apps', [apps])
}, 1000)
})(this.apps)
},
retrieveLogo() {
const ncLogo = document.querySelector('#nextcloud .logo')
@@ -102,8 +112,8 @@ export default {
mounted() {
this.retrieveApps()
this.retrieveLogo()
this.forceLightIcon = document.querySelector('#side-menu-container').getAttribute('data-forcelighticon') == 1;
this.ignoreExternalSites = document.querySelector('#side-menu-container').getAttribute('data-externalsitesintopmenu') == 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')
+25 -22
View File
@@ -15,37 +15,32 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
const elements = [
'side-menu-background-color',
'side-menu-background-color-to',
'side-menu-current-app-background-color',
'side-menu-text-color',
'side-menu-force-light-icon',
'side-menu-opener',
'side-menu-opener-position',
'side-menu-opener-hover',
'side-menu-opener-only',
'side-menu-display-logo',
'side-menu-hide-when-no-apps',
'side-menu-size-icon',
'side-menu-size-text',
'side-menu-cache',
'side-menu-external-sites-in-top-menu',
];
let elements = []
const selector = '#side-menu-message';
const userConfig = (name, value, callbacks) => {
const url = OC.generateUrl('/apps/side_menu/personalSetting/valueSet')
$.post(url, {name: name, value: value}, callbacks.success)
.fail(callbacks.error)
}
const appConfig = (name, value, callbacks) => {
OCP.AppConfig.setValue('side_menu', name, value, callbacks)
}
const saveSettings = (key) => {
const element = elements[key]
const name = $('#' + element).attr('name')
let value = $('#' + element).val()
const element = elements.get(key)
const name = $(element).attr('name')
let value = $(element).val()
const size = elements.length
if (element === 'side-menu-cache') {
value++
}
OCP.AppConfig.setValue('side_menu', name, value, {
const callbacks = {
success: () => {
OC.msg.finishedSuccess(
selector,
@@ -61,10 +56,18 @@ const saveSettings = (key) => {
error: () => {
OC.msg.finishedError(selector, t('side_menu', 'Error while saving "' + element + '"'))
}
});
}
if ($(element).is('[data-personal]')) {
userConfig(name, value, callbacks)
} else {
appConfig(name, value, callbacks)
}
}
$(document).ready(() => {
elements = $('.side-menu-setting')
$('#side-menu-save').on('click', (event) => {
event.preventDefault()
OC.msg.startSaving(selector)
+8 -9
View File
@@ -12,11 +12,15 @@
#appmenu {
display: none;
}
<?php endif; ?>
#appmenu + nav {
display: none;
}
#appmenu + nav {
display: none;
}
<?php else: ?>
.app-hidden {
opacity: 0;
}
<?php endif; ?>
<?php if ($_['opener-only'] === true): ?>
#nextcloud {
@@ -42,11 +46,6 @@
visibility: hidden;
}
#side-menu.hide-opener .side-menu-apps-list {
/* height: calc(100vh);
top: 0; */
}
<?php if ($_['size-text'] === 'hidden'): ?>
#side-menu, .side-menu-apps-list {
<?php if ($_['size-icon'] === 'big'): ?>
+120 -24
View File
@@ -9,30 +9,6 @@
sideMenuContainer.attr('data-forcelighticon', '1')
<?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) {
<?php if ($_['hide-when-no-apps']): ?>
sideMenu = $('#side-menu')
@@ -93,4 +69,124 @@
<?php else: ?>
sideMenuOpener.insertAfter('#nextcloud')
<?php endif; ?>
<?php if ($_['external-sites-in-top-menu']): ?>
sideMenuContainer.attr('data-externalsitesintopmenu', '1')
var menuCache = null
var updateTopMenu = function() {
var breakpointMobileWidth = 1024
var menu = $('#appmenu')
var apps = menu.find('li')
var minAppsDesktop = 8
var usePercentualAppMenuLimit = 0.9
var isMobile = $(window).width() < breakpointMobileWidth
var lastShownApp = null
var appShown = []
var moreApps = $('#more-apps')
var navigation = $('#navigation')
var navigationApps = $('#apps ul')
var appCount = null
var currentMenuCache = menu.html() + menu.next().html()
if (currentMenuCache === menuCache) {
return
}
navigationApps.html('')
apps.each(function(i, app) {
var dataId = app.getAttribute('data-id')
if (dataId === null) {
return
}
if (dataId.indexOf('external_index') === -1) {
app.classList.add('hidden')
app.classList.add('app-hidden')
} else {
app.classList.remove('hidden')
app.classList.add('app-external-site')
appShown.push(app)
navigationApps.append(app.outerHTML)
}
})
var rightHeaderWidth = $('.header-right').outerWidth()
var headerWidth = $('header').outerWidth()
var availableWidth = headerWidth - $('#nextcloud').outerWidth() - $('#header .side-menu-opener').outerWidth() - (rightHeaderWidth > 210 ? rightHeaderWidth : 210)
if (!isMobile) {
availableWidth = availableWidth * usePercentualAppMenuLimit
}
if (isMobile && appCount > minAppsDesktop) {
appCount = minAppsDesktop
} else if (!isMobile && appCount < minAppsDesktop) {
appCount = minAppsDesktop
} else {
appCount = Math.floor(availableWidth / $('#appmenu li').width())
}
if (appCount === 0) {
menu.addClass('hidden')
}
menu.removeClass('hidden')
menu.css('opacity', 1)
if (appShown.length - 1 - appCount >= 1) {
appCount--
}
moreApps.find('a').removeClass('active')
var k = 0
var notInHeader = 0
var name
$(appShown).each(function(i, app) {
app = $(app)
name = app.data('id')
if (k < appCount && appCount > 0) {
app.removeClass('hidden')
lastShownApp = app
$('#apps li[data-id=' + name + '].app-external-site').addClass('in-header')
} else {
app.addClass('hidden')
notInHeader++
$('#apps li[data-id=' + name + '].app-external-site').removeClass('in-header')
if (appCount > 0 && app.children('a').hasClass('active')) {
lastShownApp.addClass('hidden')
app.removeClass('hidden')
notInHeader++
$('#apps li[data-id=' + name + '].app-external-site')
.removeClass('in-header')
.addClass('in-header')
}
}
k++
})
if (notInHeader === 0) {
moreApps.hide()
navigation.hide()
} else {
moreApps.show()
}
menuCache = menu.html() + menu.next().html()
}
setInterval(updateTopMenu, 50)
<?php endif; ?>
})();
+15 -11
View File
@@ -49,11 +49,13 @@ $choicesSizes = [
id="side-menu-background-color"
name="background-color"
type="color"
class="side-menu-setting"
value="<?php print_unescaped($_['background-color']); ?>">
<input
id="side-menu-background-color-to"
name="background-color-to"
type="color"
class="side-menu-setting"
value="<?php print_unescaped($_['background-color-to']); ?>">
</div>
@@ -67,6 +69,7 @@ $choicesSizes = [
id="side-menu-current-app-background-color"
name="current-app-background-color"
type="color"
class="side-menu-setting"
value="<?php print_unescaped($_['current-app-background-color']); ?>">
</div>
@@ -80,6 +83,7 @@ $choicesSizes = [
id="side-menu-text-color"
name="text-color"
type="color"
class="side-menu-setting"
value="<?php print_unescaped($_['text-color']); ?>">
</div>
@@ -90,7 +94,7 @@ $choicesSizes = [
</div>
<div>
<select id="side-menu-force-light-icon" name="force-light-icon">
<select id="side-menu-force-light-icon" name="force-light-icon" class="side-menu-setting">
<?php foreach ($choicesYesNo as $label => $value): ?>
<option value="<?php echo $value ?>" <?php if ($value === $_['force-light-icon']): ?>selected<?php endif; ?>>
<?php echo $l->t($label); ?>
@@ -123,7 +127,7 @@ $choicesSizes = [
</div>
<div>
<select id="side-menu-opener" name="opener">
<select id="side-menu-opener" name="opener" class="side-menu-setting">
<?php foreach ($choices as $label => $value): ?>
<option value="<?php echo $value ?>" <?php if ($value === $_['opener']): ?>selected<?php endif; ?>>
<?php echo $l->t($label); ?>
@@ -146,7 +150,7 @@ $choicesSizes = [
</div>
<div>
<select id="side-menu-opener-position" name="opener-position">
<select id="side-menu-opener-position" name="opener-position" class="side-menu-setting">
<?php foreach ($choices as $label => $value): ?>
<option value="<?php echo $value ?>" <?php if ($value === $_['opener-position']): ?>selected<?php endif; ?>>
<?php echo $l->t($label); ?>
@@ -162,7 +166,7 @@ $choicesSizes = [
</div>
<div>
<select id="side-menu-opener-only" name="opener-only">
<select id="side-menu-opener-only" name="opener-only" class="side-menu-setting">
<?php foreach ($choicesYesNo as $label => $value): ?>
<option value="<?php echo $value ?>" <?php if ($value === $_['opener-only']): ?>selected<?php endif; ?>>
<?php echo $l->t($label); ?>
@@ -178,7 +182,7 @@ $choicesSizes = [
</div>
<div>
<select id="side-menu-hide-when-no-apps" name="hide-when-no-apps">
<select id="side-menu-hide-when-no-apps" name="hide-when-no-apps" class="side-menu-setting">
<?php foreach ($choicesYesNo as $label => $value): ?>
<option value="<?php echo $value ?>" <?php if ($value === $_['hide-when-no-apps']): ?>selected<?php endif; ?>>
<?php echo $l->t($label); ?>
@@ -200,7 +204,7 @@ $choicesSizes = [
</div>
<div>
<select id="side-menu-opener-hover" name="opener-hover">
<select id="side-menu-opener-hover" name="opener-hover" class="side-menu-setting">
<?php foreach ($choicesYesNo as $label => $value): ?>
<option value="<?php echo $value ?>" <?php if ($value === $_['opener-hover']): ?>selected<?php endif; ?>>
<?php echo $l->t($label); ?>
@@ -216,7 +220,7 @@ $choicesSizes = [
</div>
<div>
<select id="side-menu-display-logo" name="display-logo">
<select id="side-menu-display-logo" name="display-logo" class="side-menu-setting">
<?php foreach ($choicesYesNo as $label => $value): ?>
<option value="<?php echo $value ?>" <?php if ($value === $_['display-logo']): ?>selected<?php endif; ?>>
<?php echo $l->t($label); ?>
@@ -232,7 +236,7 @@ $choicesSizes = [
</div>
<div>
<select id="side-menu-size-icon" name="size-icon">
<select id="side-menu-size-icon" name="size-icon" class="side-menu-setting">
<?php foreach ($choicesSizes as $label => $value): ?>
<option value="<?php echo $value ?>" <?php if ($value === $_['size-icon']): ?>selected<?php endif; ?>>
<?php echo $l->t($label); ?> icon
@@ -240,7 +244,7 @@ $choicesSizes = [
<?php endforeach; ?>
</select>
<select id="side-menu-size-text" name="size-text">
<select id="side-menu-size-text" name="size-text" class="side-menu-setting">
<?php foreach ($choicesSizes as $label => $value): ?>
<option value="<?php echo $value ?>" <?php if ($value === $_['size-text']): ?>selected<?php endif; ?>>
<?php echo $l->t($label); ?> text
@@ -257,7 +261,7 @@ $choicesSizes = [
</div>
<div>
<select id="side-menu-external-sites-in-top-menu" name="external-sites-in-top-menu">
<select id="side-menu-external-sites-in-top-menu" name="external-sites-in-top-menu" class="side-menu-setting">
<?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); ?>
@@ -268,7 +272,7 @@ $choicesSizes = [
</div>
<div class="section">
<input type="hidden" id="side-menu-cache" name="cache" value="<?php print_unescaped($_['cache']); ?>">
<input type="hidden" id="side-menu-cache" name="cache" value="<?php print_unescaped($_['cache']); ?>" class="side-menu-setting">
<button id="side-menu-save" class="btn btn-primary"><?php p($l->t('Save')); ?></button>
+72
View File
@@ -0,0 +1,72 @@
<?php
/**
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
script('side_menu', 'admin');
style('side_menu', 'admin');
style('side_menu', 'support');
$choicesYesNo = [
'No' => '0',
'Yes' => '1',
];
?>
<div id="side-menu-section">
<div class="section">
<h2>
<?php p($l->t('Menu')); ?>
</h2>
<div>
<label for="side-menu-enabled" class="settings-hint">
<?php p($l->t('Enable the side menu')); ?>
</label>
</div>
<div>
<select id="side-menu-enabled" name="enabled" class="side-menu-setting" data-personal>
<?php foreach ($choicesYesNo as $label => $value): ?>
<option value="<?php echo $value ?>" <?php if ($value === $_['enabled']): ?>selected<?php endif; ?>>
<?php echo $l->t($label); ?>
</option>
<?php endforeach; ?>
</select>
</div>
</div>
<div class="section">
<button id="side-menu-save" class="btn btn-primary"><?php p($l->t('Save')); ?></button>
<span id="side-menu-message" class="msg"></span>
<div style="height: 30px"></div>
<div>
<span for="side-menu-opener" class="settings-hint">
<?php p($l->t('You like this app and you want to support me?')); ?>
<a style="margin-left: 10px" target="_blank" href="https://www.buymeacoffee.com/deblan">
<button>
<?php p($l->t('Buy me a coffe ☕')); ?>
</button>
</a>
</span>
</div>
</div>
</div>