Compare commits
28 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d0c072bee5 | |||
| 95f7eb5980 | |||
| 18314b260f | |||
| e3c159b4d6 | |||
| a48611edf4 | |||
| 5dde7ca850 | |||
| db2f7becae | |||
| 1715ae5d52 | |||
| 847fa23345 | |||
| 0495046d02 | |||
| 0474ef55e8 | |||
| 7c9653943a | |||
| 457bfc282b | |||
| 84c78538f0 | |||
| f0d17a61bd | |||
| fdbeaf6677 | |||
| 9d18b33715 | |||
| bfb2b5d819 | |||
| a6e789c859 | |||
| 0cceb03213 | |||
| 91db830ea7 | |||
| af69d64e87 | |||
| f4ec00c9f7 | |||
| 8b20b11ce2 | |||
| e597ed95a3 | |||
| bf3493bb03 | |||
| fe665d58a9 | |||
| 407073dd98 |
@@ -0,0 +1,33 @@
|
||||
## Feature
|
||||
|
||||
### Description
|
||||
|
||||
...
|
||||
|
||||
### Benefits
|
||||
|
||||
...
|
||||
|
||||
---
|
||||
|
||||
## Issue
|
||||
|
||||
### Environment
|
||||
|
||||
* Side menu version: ...
|
||||
* PHP version: ...
|
||||
* Web server (Nginx, Apache2): ...
|
||||
|
||||
### Steps to reproduce
|
||||
|
||||
* ...
|
||||
* ...
|
||||
* ...
|
||||
|
||||
### Observed Results
|
||||
|
||||
...
|
||||
|
||||
### Expected Results
|
||||
|
||||
...
|
||||
@@ -1,8 +1,8 @@
|
||||
🤙 Nextcloud app / Side menu 🎨
|
||||
===============================
|
||||
|
||||
|
||||
This application moves the top menu of Nextcloud to the left side.
|
||||
Side menu allows you to modify the position of the main menu by creating a panel on the left of the interface.
|
||||
This application is rather suitable for instances that activate a lot of applications.
|
||||
|
||||
Comptatible with AppOrder.
|
||||
|
||||
@@ -23,7 +23,9 @@ $ unzip -d side_menu /path/to/side_menu_vX.Y.Z.zip
|
||||
Upgrade
|
||||
-------
|
||||
|
||||
Go to https://gitnet.fr/deblan/side_menu/releases and download the last release (side_menu_vX.Y.Z.zip).
|
||||
Side menu can be upgraded from the app store.
|
||||
|
||||
If you want to install it from source: go to https://gitnet.fr/deblan/side_menu/releases and download the last release (side_menu_vX.Y.Z.zip).
|
||||
|
||||
Copy the archive to your Nextcloud server.
|
||||
|
||||
@@ -37,13 +39,20 @@ $ unzip -d side_menu /path/to/side_menu_vX.Y.Z.zip
|
||||
|
||||

|
||||
|
||||

|
||||

|
||||
|
||||
|
||||
How to contribute?
|
||||
------------------
|
||||
|
||||
Fork the repository, go to `apps/`, clone your repository and run `npm install` inside.
|
||||
You can report a bug or request a feature by opening an issue: https://gitnet.fr/deblan/side_menu/issues
|
||||
|
||||
If you are a developer:
|
||||
|
||||
* fork the repository
|
||||
* install an instance of Nextcloud
|
||||
* go to `apps/` and clone your repository
|
||||
* go to `apps/side_menu` and run `npm install`
|
||||
|
||||
Build javascripts using `webpack --config ./webpack.js` (add `-w` to build them in real time).
|
||||
|
||||
|
||||
+22
-11
@@ -24,6 +24,11 @@ use OCP\Util;
|
||||
|
||||
$config = \OC::$server->getConfig();
|
||||
$cspnm = \OC::$server->getContentSecurityPolicyNonceManager();
|
||||
|
||||
|
||||
Util::addScript('side_menu', 'sideMenu');
|
||||
Util::addStyle('side_menu', 'sideMenu');
|
||||
|
||||
$stylesheet = \OC::$server->getURLGenerator()->linkToRoute(
|
||||
'side_menu.Css.stylesheet',
|
||||
[
|
||||
@@ -31,21 +36,27 @@ $stylesheet = \OC::$server->getURLGenerator()->linkToRoute(
|
||||
]
|
||||
);
|
||||
|
||||
$script = \OC::$server->getURLGenerator()->linkToRoute(
|
||||
'side_menu.Js.script',
|
||||
[
|
||||
'v' => $config->getAppValue('side_menu', 'cache', '0'),
|
||||
]
|
||||
);
|
||||
|
||||
Util::addHeader(
|
||||
'link',
|
||||
[
|
||||
'href' => $stylesheet,
|
||||
'rel' => 'stylesheet'
|
||||
], ''
|
||||
],
|
||||
''
|
||||
);
|
||||
|
||||
Util::addScript('side_menu', 'main');
|
||||
Util::addScript('side_menu', 'sideMenu');
|
||||
Util::addStyle('side_menu', 'sideMenu');
|
||||
// whitelist the URL to allow loading JS from this external domain
|
||||
// $CSPManager = \OC::$server->getContentSecurityPolicyManager();
|
||||
// $policy = new ContentSecurityPolicy();
|
||||
// $policy->addAllowedScriptDomain($url);
|
||||
// $policy->addAllowedImageDomain($url);
|
||||
// $policy->addAllowedConnectDomain($url);
|
||||
// $CSPManager->addDefaultPolicy($policy);
|
||||
Util::addHeader(
|
||||
'script',
|
||||
[
|
||||
'src' => $script,
|
||||
'nonce' => $cspnm->getNonce(),
|
||||
],
|
||||
''
|
||||
);
|
||||
|
||||
+10
-3
@@ -3,10 +3,17 @@
|
||||
<id>side_menu</id>
|
||||
<name>Side menu</name>
|
||||
<summary>Move the top menu to the left side.</summary>
|
||||
<description>Move the top menu to the left side.</description>
|
||||
<description><![CDATA[Side menu allows you to modify the position of the main menu by creating a panel on the left of the interface.
|
||||
This application is rather suitable for instances that activate a lot of applications.
|
||||
|
||||
Comptatible with AppOrder.
|
||||
|
||||
You can report a bug or request a feature by opening an issue
|
||||
|
||||
]]></description>
|
||||
<licence>agpl</licence>
|
||||
<author mail="dev+sidemenu@deblan.fr" homepage="https://www.deblan.io/">Simon Vieille</author>
|
||||
<version>1.2.1</version>
|
||||
<version>1.3.3</version>
|
||||
<namespace>SideMenu</namespace>
|
||||
<category>customization</category>
|
||||
<website>https://gitnet.fr/deblan/side_menu</website>
|
||||
@@ -14,7 +21,7 @@
|
||||
<repository type="git">https://gitnet.fr/deblan/side_menu</repository>
|
||||
<screenshot>https://upload.deblan.org/u/2020-03/5e7fab2b.jpg</screenshot>
|
||||
<screenshot>https://upload.deblan.org/u/2020-03/5e81b219.jpg</screenshot>
|
||||
<screenshot>https://upload.deblan.org/u/2020-04/5e8ee1f7.jpg</screenshot>
|
||||
<screenshot>https://upload.deblan.org/u/2020-04/5ea42d1a.png</screenshot>
|
||||
<dependencies>
|
||||
<nextcloud min-version="18" max-version="18"/>
|
||||
</dependencies>
|
||||
|
||||
@@ -20,5 +20,6 @@
|
||||
return [
|
||||
'routes' => [
|
||||
['name' => 'Css#stylesheet', 'url' => '/css/stylesheet', 'verb' => 'GET'],
|
||||
['name' => 'Js#script', 'url' => '/js/script', 'verb' => 'GET'],
|
||||
],
|
||||
];
|
||||
|
||||
+11
-3
@@ -26,7 +26,7 @@
|
||||
height: 100vh;
|
||||
width: 100%;
|
||||
max-width: 250px;
|
||||
background: var(--side-menu-background-color, #333);
|
||||
background: linear-gradient(90deg, var(--side-menu-background-color, #333) 0%, var(--side-menu-background-color-to, #333) 100%);
|
||||
z-index: 3000;
|
||||
color: var(--side-menu-text-color, #fff);
|
||||
box-shadow: rgba(0, 0, 0, 0.22) 0px 25.6px 57.6px 0px, rgba(0, 0, 0, 0.18) 0px 4.8px 14.4px 0px;
|
||||
@@ -45,6 +45,10 @@
|
||||
border: 0;
|
||||
}
|
||||
|
||||
#side-menu.hide-opener .side-menu-opener {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.side-menu-apps-list {
|
||||
height: calc(100vh - 150px);
|
||||
z-index: 2200;
|
||||
@@ -59,13 +63,14 @@
|
||||
width: 20px;
|
||||
vertical-align: middle;
|
||||
margin-right: 10px;
|
||||
padding-top: 3px;
|
||||
}
|
||||
|
||||
.side-menu-app a {
|
||||
line-height: 30px;
|
||||
color: var(--side-menu-text-color, #fff);
|
||||
display: block;
|
||||
padding: 7px 0 7px 15px;
|
||||
padding: 7px 0 5px 15px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
@@ -89,8 +94,11 @@
|
||||
width: 100%;
|
||||
z-index: 2300;
|
||||
max-width: 250px;
|
||||
background: var(--side-menu-background-color, #333);
|
||||
position: fixed;
|
||||
padding-top: 2px;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
#side-menu.hide-opener .side-menu-logo {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
namespace OCA\SideMenu\Controller;
|
||||
|
||||
use OCP\AppFramework\Controller;
|
||||
use OCP\AppFramework\Http\DataDownloadResponse;
|
||||
use OCP\AppFramework\Http\TemplateResponse;
|
||||
use OCP\AppFramework\Http\Response;
|
||||
use OCP\IConfig;
|
||||
use OCP\IRequest;
|
||||
@@ -38,6 +38,7 @@ class CssController extends Controller
|
||||
public function __construct($appName, IRequest $request, IConfig $config)
|
||||
{
|
||||
parent::__construct($appName, $request);
|
||||
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
@@ -50,25 +51,25 @@ class CssController extends Controller
|
||||
*/
|
||||
public function stylesheet()
|
||||
{
|
||||
$backgroundColor = $this->config->getAppValue('side_menu', 'background-color', '#333333');
|
||||
$backgroundColorTo = $this->config->getAppValue('side_menu', 'background-color-to', $backgroundColor);
|
||||
|
||||
$parameters = [
|
||||
'--side-menu-background-color' => $this->config->getAppValue('side_menu', 'background-color', '#333333'),
|
||||
'--side-menu-current-app-background-color' => $this->config->getAppValue('side_menu', 'current-app-background-color', '#444444'),
|
||||
'--side-menu-text-color' => $this->config->getAppValue('side_menu', 'text-color', '#FFFFFF'),
|
||||
'--side-menu-opener' => $this->config->getAppValue('side_menu', 'opener', 'side-menu-opener'),
|
||||
'vars' => [
|
||||
'background-color' => $backgroundColor,
|
||||
'background-color-to' => $backgroundColorTo,
|
||||
'current-app-background-color' => $this->config->getAppValue('side_menu', 'current-app-background-color', '#444444'),
|
||||
'text-color' => $this->config->getAppValue('side_menu', 'text-color', '#FFFFFF'),
|
||||
'opener' => $this->config->getAppValue('side_menu', 'opener', 'side-menu-opener'),
|
||||
],
|
||||
'display-logo' => (bool) $this->config->getAppValue('side_menu', 'display-logo', 1),
|
||||
'size-icon' => $this->config->getAppValue('side_menu', 'size-icon', 'normal'),
|
||||
'size-text' => $this->config->getAppValue('side_menu', 'size-text', 'normal'),
|
||||
];
|
||||
|
||||
$css = '';
|
||||
$response = new TemplateResponse('side_menu', 'css/stylesheet', $parameters, 'blank');
|
||||
$response->addHeader('Content-Type', 'text/css');
|
||||
|
||||
foreach ($parameters as $key => $value) {
|
||||
if ($key === '--side-menu-opener') {
|
||||
$value = sprintf("url('../img/%s.svg')", $value);
|
||||
}
|
||||
|
||||
$css.= sprintf('%s: %s;', $key, $value);
|
||||
}
|
||||
|
||||
$css = sprintf(':root { %s }', $css);
|
||||
|
||||
return new DataDownloadResponse($css, 'stylesheet', 'text/css');
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
<?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;
|
||||
|
||||
class JsController extends Controller
|
||||
{
|
||||
|
||||
/** @var \OCP\IConfig */
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* @param string $appName
|
||||
* @param IRequest $request
|
||||
* @param IConfig $config
|
||||
*/
|
||||
public function __construct($appName, IRequest $request, IConfig $config)
|
||||
{
|
||||
parent::__construct($appName, $request);
|
||||
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @NoCSRFRequired
|
||||
* @PublicPage
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function script()
|
||||
{
|
||||
$parameters = [
|
||||
'opener-position' => $this->config->getAppValue('side_menu', 'opener-position', 'before'),
|
||||
'opener-hover' => (bool) $this->config->getAppValue('side_menu', 'opener-hover', '0'),
|
||||
];
|
||||
|
||||
$response = new TemplateResponse('side_menu', 'js/script', $parameters, 'blank');
|
||||
$response->addHeader('Content-Type', 'text/javascript');
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
+10
-1
@@ -47,12 +47,21 @@ class Admin implements ISettings
|
||||
*/
|
||||
public function getForm()
|
||||
{
|
||||
$backgroundColor = $this->config->getAppValue('side_menu', 'background-color', '#333333');
|
||||
$backgroundColorTo = $this->config->getAppValue('side_menu', 'background-color-to', $backgroundColor);
|
||||
|
||||
$parameters = [
|
||||
'background-color' => $this->config->getAppValue('side_menu', 'background-color', '#333333'),
|
||||
'background-color' => $backgroundColor,
|
||||
'background-color-to' => $backgroundColorTo,
|
||||
'current-app-background-color' => $this->config->getAppValue('side_menu', 'current-app-background-color', '#444444'),
|
||||
'text-color' => $this->config->getAppValue('side_menu', 'text-color', '#FFFFFF'),
|
||||
'cache' => $this->config->getAppValue('side_menu', 'cache', '0'),
|
||||
'opener' => $this->config->getAppValue('side_menu', 'opener', 'side-menu-opener'),
|
||||
'display-logo' => $this->config->getAppValue('side_menu', 'display-logo', '1'),
|
||||
'opener-position' => $this->config->getAppValue('side_menu', 'opener-position', 'before'),
|
||||
'opener-hover' => $this->config->getAppValue('side_menu', 'opener-hover', '0'),
|
||||
'size-icon' => $this->config->getAppValue('side_menu', 'size-icon', 'normal'),
|
||||
'size-text' => $this->config->getAppValue('side_menu', 'size-text', 'normal'),
|
||||
];
|
||||
|
||||
return new TemplateResponse('side_menu', 'settings/admin-form', $parameters, '');
|
||||
|
||||
@@ -30,6 +30,7 @@ const mountSideMenuComponent = () => {
|
||||
|
||||
if (sideMenuContainer) {
|
||||
sideMenu.$mount('#side-menu')
|
||||
$('body').trigger('side-menu.ready')
|
||||
} else {
|
||||
window.setTimeout(mountSideMenuComponent, 50)
|
||||
}
|
||||
|
||||
+11
-4
@@ -28,8 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
<li v-for="app in apps" v-bind:class="{'side-menu-app': true, 'active': app.active}">
|
||||
<a v-bind:href="app.href">
|
||||
<span class="side-menu-app-icon" v-html="app.icon"></span>
|
||||
|
||||
{{ app.name }}
|
||||
<span class="side-menu-app-text" v-html="app.name"></span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -54,10 +53,14 @@ export default {
|
||||
let href = element.getAttribute('href')
|
||||
|
||||
if (href !== '#') {
|
||||
let svg = element.querySelector('svg').outerHTML
|
||||
|
||||
svg = svg.replace(/(height|width)="20"/, '')
|
||||
|
||||
this.apps.push({
|
||||
href: href,
|
||||
name: element.querySelector('span').innerHTML,
|
||||
icon: element.querySelector('svg').outerHTML,
|
||||
icon: svg,
|
||||
active: element.classList.contains('active')
|
||||
});
|
||||
}
|
||||
@@ -67,10 +70,14 @@ export default {
|
||||
const ncLogo = document.querySelector('#nextcloud .logo')
|
||||
|
||||
if (ncLogo) {
|
||||
this.logo = window.getComputedStyle(ncLogo, null)
|
||||
const url = window.getComputedStyle(ncLogo, null)
|
||||
.getPropertyValue('background-image')
|
||||
.replace('url("', '')
|
||||
.replace('")', '')
|
||||
|
||||
if (url && url !== 'none') {
|
||||
this.logo = url
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@@ -17,9 +17,15 @@
|
||||
|
||||
const elements = [
|
||||
'side-menu-background-color',
|
||||
'side-menu-background-color-to',
|
||||
'side-menu-current-app-background-color',
|
||||
'side-menu-text-color',
|
||||
'side-menu-opener',
|
||||
'side-menu-opener-position',
|
||||
'side-menu-opener-hover',
|
||||
'side-menu-display-logo',
|
||||
'side-menu-size-icon',
|
||||
'side-menu-size-text',
|
||||
'side-menu-cache',
|
||||
];
|
||||
|
||||
|
||||
-30
@@ -1,30 +0,0 @@
|
||||
/**
|
||||
* @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/>.
|
||||
*/
|
||||
|
||||
const sideMenuContainer = $('<div id="side-menu-container">')
|
||||
const sideMenuOpener = $('<button class="side-menu-opener"></button>')
|
||||
const sideMenu = $('<div id="side-menu">')
|
||||
|
||||
sideMenuContainer.append(sideMenu);
|
||||
|
||||
$('body').append(sideMenuContainer);
|
||||
|
||||
sideMenuOpener.insertBefore('#nextcloud');
|
||||
|
||||
$('body').on('click', '.side-menu-opener', () => {
|
||||
$('#side-menu').toggleClass('open');
|
||||
})
|
||||
@@ -0,0 +1,86 @@
|
||||
:root {
|
||||
<?php foreach ($_['vars'] as $key => $value): ?>
|
||||
<?php if ($key === 'opener'): ?>
|
||||
--side-menu-<?php echo $key ?>: url('<?php print_unescaped(image_path('side_menu', $value.'.svg')); ?>');
|
||||
<?php else: ?>
|
||||
--side-menu-<?php echo $key ?>: <?php echo $value ?>;
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
}
|
||||
|
||||
<?php if ($_['display-logo'] === false): ?>
|
||||
.side-menu-logo {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.side-menu-header {
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
.side-menu-apps-list {
|
||||
height: calc(100vh - 60px);
|
||||
top: 60px;
|
||||
}
|
||||
|
||||
#side-menu.hide-opener .side-menu-header {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#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'): ?>
|
||||
width: 55px;
|
||||
<?php else: ?>
|
||||
width: 52px;
|
||||
<?php endif; ?>
|
||||
}
|
||||
|
||||
#side-menu .side-menu-opener {
|
||||
<?php if ($_['size-icon'] === 'big'): ?>
|
||||
margin-left: 6px;
|
||||
<?php else: ?>
|
||||
margin-left: 4px;
|
||||
<?php endif; ?>
|
||||
}
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($_['size-icon'] === 'hidden'): ?>
|
||||
.side-menu-app-icon {
|
||||
display: none;
|
||||
}
|
||||
<?php elseif ($_['size-icon'] === 'small'): ?>
|
||||
.side-menu-app-icon svg {
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
}
|
||||
<?php elseif ($_['size-icon'] === 'normal'): ?>
|
||||
.side-menu-app-icon svg {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
<?php elseif ($_['size-icon'] === 'big'): ?>
|
||||
.side-menu-app-icon svg {
|
||||
width: 23px;
|
||||
height: 23px;
|
||||
}
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($_['size-text'] === 'hidden'): ?>
|
||||
.side-menu-app-text {
|
||||
display: none;
|
||||
}
|
||||
<?php elseif ($_['size-text'] === 'small'): ?>
|
||||
.side-menu-app-text {
|
||||
font-size: 12px;
|
||||
}
|
||||
<?php elseif ($_['size-text'] === 'big'): ?>
|
||||
.side-menu-app-text {
|
||||
font-size: 16px;
|
||||
}
|
||||
<?php endif; ?>
|
||||
@@ -0,0 +1,57 @@
|
||||
(function() {
|
||||
var sideMenuContainer = $('<div id="side-menu-container">')
|
||||
var sideMenuOpener = $('<button class="side-menu-opener"></button>')
|
||||
var sideMenu = $('<div id="side-menu">')
|
||||
var body = $('body')
|
||||
|
||||
body.append(sideMenuContainer)
|
||||
|
||||
sideMenuContainer.append(sideMenu)
|
||||
|
||||
<?php if ($_['opener-position'] === 'before'): ?>
|
||||
sideMenuOpener.insertBefore('#nextcloud')
|
||||
<?php else: ?>
|
||||
sideMenuOpener.insertAfter('#nextcloud')
|
||||
<?php endif; ?>
|
||||
|
||||
var isTouchDevice = window.matchMedia("(pointer: coarse)").matches
|
||||
|
||||
body.on('side-menu.ready', function() {
|
||||
sideMenu = $('#side-menu')
|
||||
|
||||
var headerMenuOpener = $('#header .side-menu-opener')
|
||||
var sideMenuOpener = $('#side-menu .side-menu-opener')
|
||||
|
||||
<?php if ($_['opener-hover']): ?>
|
||||
var sideMenuMouseLeave = function() {
|
||||
sideMenu
|
||||
.removeClass('open')
|
||||
.off('mouseleave', sideMenuMouseLeave)
|
||||
}
|
||||
|
||||
var sideMenuMouseEnter = function() {
|
||||
sideMenu.on('mouseleave', sideMenuMouseLeave)
|
||||
}
|
||||
|
||||
var sideMenuOpenerMouseEnter = function() {
|
||||
sideMenu
|
||||
.addClass('open')
|
||||
.on('mouseenter', sideMenuMouseEnter)
|
||||
}
|
||||
|
||||
if (!isTouchDevice) {
|
||||
headerMenuOpener.on('mouseenter', sideMenuOpenerMouseEnter)
|
||||
|
||||
sideMenu.addClass('hide-opener')
|
||||
}
|
||||
<?php endif; ?>
|
||||
|
||||
headerMenuOpener.on('click', function() {
|
||||
sideMenu.addClass('open');
|
||||
})
|
||||
|
||||
sideMenuOpener.on('click', function() {
|
||||
sideMenu.removeClass('open');
|
||||
})
|
||||
})
|
||||
})();
|
||||
@@ -18,77 +18,205 @@
|
||||
|
||||
script('side_menu', 'admin');
|
||||
style('side_menu', 'admin');
|
||||
style('side_menu', 'support');
|
||||
|
||||
$choicesYesNo = [
|
||||
'No' => '0',
|
||||
'Yes' => '1',
|
||||
];
|
||||
|
||||
$choicesSizes = [
|
||||
'Hidden' => 'hidden',
|
||||
'Small' => 'small',
|
||||
'Normal' => 'normal',
|
||||
'Big' => 'big',
|
||||
];
|
||||
?>
|
||||
|
||||
<div id="side-menu-section" class="section">
|
||||
<h2 class="inlineblock"><?php p($l->t('Side menu settings')); ?></h2>
|
||||
<div id="side-menu-section">
|
||||
<div class="section">
|
||||
<h2>
|
||||
<?php p($l->t('Colors')); ?>
|
||||
</h2>
|
||||
|
||||
<div>
|
||||
<label for="side-menu-background-color" class="settings-hint">
|
||||
<?php p($l->t('Background color')); ?>
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
<input
|
||||
id="side-menu-background-color"
|
||||
name="background-color"
|
||||
type="color"
|
||||
value="<?php print_unescaped($_['background-color']); ?>">
|
||||
<div>
|
||||
<label for="side-menu-background-color" class="settings-hint">
|
||||
<?php p($l->t('Background color')); ?>
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
<input
|
||||
id="side-menu-background-color"
|
||||
name="background-color"
|
||||
type="color"
|
||||
value="<?php print_unescaped($_['background-color']); ?>">
|
||||
<input
|
||||
id="side-menu-background-color-to"
|
||||
name="background-color-to"
|
||||
type="color"
|
||||
value="<?php print_unescaped($_['background-color-to']); ?>">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="side-menu-current-app-background-color" class="settings-hint">
|
||||
<?php p($l->t('Background color of current app')); ?>
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
<input
|
||||
id="side-menu-current-app-background-color"
|
||||
name="current-app-background-color"
|
||||
type="color"
|
||||
value="<?php print_unescaped($_['current-app-background-color']); ?>">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="side-menu-text-color" class="settings-hint">
|
||||
<?php p($l->t('Text color')); ?>
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
<input
|
||||
id="side-menu-text-color"
|
||||
name="text-color"
|
||||
type="color"
|
||||
value="<?php print_unescaped($_['text-color']); ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="side-menu-current-app-background-color" class="settings-hint">
|
||||
<?php p($l->t('Background color of current app')); ?>
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
<input
|
||||
id="side-menu-current-app-background-color"
|
||||
name="current-app-background-color"
|
||||
type="color"
|
||||
value="<?php print_unescaped($_['current-app-background-color']); ?>">
|
||||
<div class="section">
|
||||
<h2>
|
||||
<?php p($l->t('Opener')); ?>
|
||||
</h2>
|
||||
|
||||
<?php
|
||||
$choices = [
|
||||
'Default' => 'side-menu-opener',
|
||||
'Hamburger' => 'side-menu-opener-hamburger',
|
||||
];
|
||||
?>
|
||||
|
||||
<div>
|
||||
<label for="side-menu-opener" class="settings-hint">
|
||||
<?php p($l->t('Icon')); ?>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<select id="side-menu-opener" name="opener">
|
||||
<?php foreach ($choices as $label => $value): ?>
|
||||
<option value="<?php echo $value ?>" <?php if ($value === $_['opener']): ?>selected<?php endif; ?>>
|
||||
<?php echo $l->t($label); ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$choices = [
|
||||
'Before the logo' => 'before',
|
||||
'After the logo' => 'after',
|
||||
];
|
||||
?>
|
||||
|
||||
<div>
|
||||
<label for="side-menu-opener-position" class="settings-hint">
|
||||
<?php p($l->t('Position')); ?>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<select id="side-menu-opener-position" name="opener-position">
|
||||
<?php foreach ($choices as $label => $value): ?>
|
||||
<option value="<?php echo $value ?>" <?php if ($value === $_['opener-position']): ?>selected<?php endif; ?>>
|
||||
<?php echo $l->t($label); ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="side-menu-text-color" class="settings-hint">
|
||||
<?php p($l->t('Text color')); ?>
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
<input
|
||||
id="side-menu-text-color"
|
||||
name="text-color"
|
||||
type="color"
|
||||
value="<?php print_unescaped($_['text-color']); ?>">
|
||||
<div class="section">
|
||||
<h2>
|
||||
<?php p($l->t('Panel')); ?>
|
||||
</h2>
|
||||
|
||||
<div>
|
||||
<label for="side-menu-opener" class="settings-hint">
|
||||
<?php p($l->t('Open the menu when the mouse is hover the opener (automatically disabled on touch screens)')); ?>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<select id="side-menu-opener-hover" name="opener-hover">
|
||||
<?php foreach ($choicesYesNo as $label => $value): ?>
|
||||
<option value="<?php echo $value ?>" <?php if ($value === $_['opener-hover']): ?>selected<?php endif; ?>>
|
||||
<?php echo $l->t($label); ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="side-menu-opener" class="settings-hint">
|
||||
<?php p($l->t('Display the logo')); ?>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<select id="side-menu-display-logo" name="display-logo">
|
||||
<?php foreach ($choicesYesNo as $label => $value): ?>
|
||||
<option value="<?php echo $value ?>" <?php if ($value === $_['display-logo']): ?>selected<?php endif; ?>>
|
||||
<?php echo $l->t($label); ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="settings-hint">
|
||||
<?php p($l->t('Icons and texts')); ?>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<select id="side-menu-size-icon" name="size-icon">
|
||||
<?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
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
|
||||
<select id="side-menu-size-text" name="size-text">
|
||||
<?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
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="side-menu-opener" class="settings-hint">
|
||||
<?php p($l->t('Opener icon')); ?>
|
||||
</label>
|
||||
<div class="section">
|
||||
<input type="hidden" id="side-menu-cache" name="cache" value="<?php print_unescaped($_['cache']); ?>">
|
||||
|
||||
<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>
|
||||
|
||||
<?php
|
||||
$choices = [
|
||||
'Default' => 'side-menu-opener',
|
||||
'Hamburger' => 'side-menu-opener-hamburger',
|
||||
];
|
||||
?>
|
||||
|
||||
<div>
|
||||
<select id="side-menu-opener" name="opener">
|
||||
<?php foreach ($choices as $label => $value): ?>
|
||||
<option value="<?php echo $value ?>" <?php if ($value === $_['opener']): ?>selected<?php endif; ?>>
|
||||
<?php echo $l->t($label); ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<input type="hidden" id="side-menu-cache" name="cache" value="<?php print_unescaped($_['cache']); ?>">
|
||||
|
||||
<button id="side-menu-save" class="btn btn-primary"><?php p($l->t('Save')); ?></button>
|
||||
|
||||
<span id="side-menu-message" class="msg"></span>
|
||||
</div>
|
||||
|
||||
@@ -4,7 +4,6 @@ const StyleLintPlugin = require('stylelint-webpack-plugin')
|
||||
|
||||
module.exports = {
|
||||
entry: {
|
||||
'main': path.join(__dirname, 'src', 'main.js'),
|
||||
'admin': path.join(__dirname, 'src', 'admin.js'),
|
||||
'sideMenu': path.join(__dirname, 'src', 'SideMenu.js'),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user