Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| af69d64e87 | |||
| f4ec00c9f7 | |||
| 8b20b11ce2 | |||
| e597ed95a3 | |||
| bf3493bb03 | |||
| fe665d58a9 | |||
| 407073dd98 | |||
| f85b5de28d | |||
| ee5be2cf21 | |||
| 91195d0160 | |||
| 29e0526844 | |||
| 8d2818150c | |||
| 299abe5e96 |
@@ -23,7 +23,9 @@ $ unzip -d side_menu /path/to/side_menu_vX.Y.Z.zip
|
|||||||
Upgrade
|
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.
|
Copy the archive to your Nextcloud server.
|
||||||
|
|
||||||
@@ -38,3 +40,13 @@ $ 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.
|
||||||
|
|
||||||
|
Build javascripts using `webpack --config ./webpack.js` (add `-w` to build them in real time).
|
||||||
|
|
||||||
|
Then commit and create a pull request.
|
||||||
|
|||||||
+2
-1
@@ -36,7 +36,8 @@ Util::addHeader(
|
|||||||
[
|
[
|
||||||
'href' => $stylesheet,
|
'href' => $stylesheet,
|
||||||
'rel' => 'stylesheet'
|
'rel' => 'stylesheet'
|
||||||
], ''
|
],
|
||||||
|
''
|
||||||
);
|
);
|
||||||
|
|
||||||
Util::addScript('side_menu', 'main');
|
Util::addScript('side_menu', 'main');
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
<description>Move the top menu to the left side.</description>
|
<description>Move the top menu to the left side.</description>
|
||||||
<licence>agpl</licence>
|
<licence>agpl</licence>
|
||||||
<author mail="dev+sidemenu@deblan.fr" homepage="https://www.deblan.io/">Simon Vieille</author>
|
<author mail="dev+sidemenu@deblan.fr" homepage="https://www.deblan.io/">Simon Vieille</author>
|
||||||
<version>1.1.3</version>
|
<version>1.2.4</version>
|
||||||
<namespace>SideMenu</namespace>
|
<namespace>SideMenu</namespace>
|
||||||
<category>customization</category>
|
<category>customization</category>
|
||||||
<website>https://gitnet.fr/deblan/side_menu</website>
|
<website>https://gitnet.fr/deblan/side_menu</website>
|
||||||
|
|||||||
+1
-1
@@ -19,6 +19,6 @@
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
'routes' => [
|
'routes' => [
|
||||||
['name' => 'Css#stylesheet', 'url' => '/css/stylesheet', 'verb' => 'GET'],
|
['name' => 'Css#stylesheet', 'url' => '/css/stylesheet.css', 'verb' => 'GET'],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
+2
-2
@@ -33,7 +33,7 @@
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
#side-menu.is-active {
|
#side-menu.open {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.side-menu-app a:hover, .side-menu-app.is-active a {
|
.side-menu-app a:hover, .side-menu-app.active a {
|
||||||
background: var(--side-menu-current-app-background-color, #444);
|
background: var(--side-menu-current-app-background-color, #444);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
namespace OCA\SideMenu\Controller;
|
namespace OCA\SideMenu\Controller;
|
||||||
|
|
||||||
use OCP\AppFramework\Controller;
|
use OCP\AppFramework\Controller;
|
||||||
use OCP\AppFramework\Http\DataDownloadResponse;
|
use OCP\AppFramework\Http\TemplateResponse;
|
||||||
use OCP\AppFramework\Http\Response;
|
use OCP\AppFramework\Http\Response;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
@@ -38,6 +38,7 @@ class CssController extends Controller
|
|||||||
public function __construct($appName, IRequest $request, IConfig $config)
|
public function __construct($appName, IRequest $request, IConfig $config)
|
||||||
{
|
{
|
||||||
parent::__construct($appName, $request);
|
parent::__construct($appName, $request);
|
||||||
|
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,25 +51,24 @@ class CssController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function stylesheet()
|
public function stylesheet()
|
||||||
{
|
{
|
||||||
|
$requestUri = $this->request->server['REQUEST_URI'];
|
||||||
|
$assetsRoot = str_replace('/index.php', '', $requestUri);
|
||||||
|
$assetsRoot = preg_replace('#apps/side_menu/.*#s', 'apps/side_menu', $assetsRoot);
|
||||||
|
|
||||||
$parameters = [
|
$parameters = [
|
||||||
'--side-menu-background-color' => $this->config->getAppValue('side_menu', 'background-color', '#333333'),
|
'vars' => [
|
||||||
'--side-menu-current-app-background-color' => $this->config->getAppValue('side_menu', 'current-app-background-color', '#444444'),
|
'background-color' => $this->config->getAppValue('side_menu', 'background-color', '#333333'),
|
||||||
'--side-menu-text-color' => $this->config->getAppValue('side_menu', 'text-color', '#FFFFFF'),
|
'current-app-background-color' => $this->config->getAppValue('side_menu', 'current-app-background-color', '#444444'),
|
||||||
'--side-menu-opener' => $this->config->getAppValue('side_menu', 'opener', 'side-menu-opener'),
|
'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),
|
||||||
|
'assetsRoot' => $assetsRoot,
|
||||||
];
|
];
|
||||||
|
|
||||||
$css = '';
|
$response = new TemplateResponse('side_menu', 'css/stylesheet', $parameters, 'blank');
|
||||||
|
$response->addHeader('Content-Type', 'text/css');
|
||||||
|
|
||||||
foreach ($parameters as $key => $value) {
|
return $response;
|
||||||
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');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,8 @@ class Admin implements ISettings
|
|||||||
/** @var IConfig */
|
/** @var IConfig */
|
||||||
private $config;
|
private $config;
|
||||||
|
|
||||||
public function __construct(IL10N $l, ILogger $logger, IConfig $config) {
|
public function __construct(IL10N $l, ILogger $logger, IConfig $config)
|
||||||
|
{
|
||||||
$this->l = $l;
|
$this->l = $l;
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
@@ -52,6 +53,7 @@ class Admin implements ISettings
|
|||||||
'text-color' => $this->config->getAppValue('side_menu', 'text-color', '#FFFFFF'),
|
'text-color' => $this->config->getAppValue('side_menu', 'text-color', '#FFFFFF'),
|
||||||
'cache' => $this->config->getAppValue('side_menu', 'cache', '0'),
|
'cache' => $this->config->getAppValue('side_menu', 'cache', '0'),
|
||||||
'opener' => $this->config->getAppValue('side_menu', 'opener', 'side-menu-opener'),
|
'opener' => $this->config->getAppValue('side_menu', 'opener', 'side-menu-opener'),
|
||||||
|
'display-logo' => $this->config->getAppValue('side_menu', 'display-logo', '1'),
|
||||||
];
|
];
|
||||||
|
|
||||||
return new TemplateResponse('side_menu', 'settings/admin-form', $parameters, '');
|
return new TemplateResponse('side_menu', 'settings/admin-form', $parameters, '');
|
||||||
|
|||||||
@@ -79,6 +79,6 @@ class Section implements IIconSection
|
|||||||
*/
|
*/
|
||||||
public function getIcon()
|
public function getIcon()
|
||||||
{
|
{
|
||||||
return $this->url->imagePath('theming', 'app-dark.svg');
|
return $this->url->imagePath('theming', 'app-dark.svg');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-5
@@ -18,13 +18,12 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import SideMenu from './SideMenu.vue'
|
import SideMenu from './SideMenu.vue'
|
||||||
|
|
||||||
Vue.prototype.t = t
|
// Vue.prototype.t = t
|
||||||
Vue.prototype.OC = OC
|
// Vue.prototype.OC = OC
|
||||||
Vue.prototype.OC = OCP
|
// Vue.prototype.OC = OCP
|
||||||
|
|
||||||
const View = Vue.extend(SideMenu)
|
const View = Vue.extend(SideMenu)
|
||||||
const sideMenu = new View({
|
const sideMenu = new View({})
|
||||||
})
|
|
||||||
|
|
||||||
const mountSideMenuComponent = () => {
|
const mountSideMenuComponent = () => {
|
||||||
const sideMenuContainer = document.querySelector('#side-menu')
|
const sideMenuContainer = document.querySelector('#side-menu')
|
||||||
|
|||||||
+13
-8
@@ -25,7 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul class="side-menu-apps-list">
|
<ul class="side-menu-apps-list">
|
||||||
<li v-for="app in apps" v-bind:class="{'side-menu-app': true, 'is-active': app.active}">
|
<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">
|
||||||
<span class="side-menu-app-icon" v-html="app.icon"></span>
|
<span class="side-menu-app-icon" v-html="app.icon"></span>
|
||||||
|
|
||||||
@@ -37,9 +37,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import axios from '@nextcloud/axios'
|
|
||||||
import { generateUrl } from '@nextcloud/router'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'SideMenu',
|
name: 'SideMenu',
|
||||||
data() {
|
data() {
|
||||||
@@ -67,10 +64,18 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
retrieveLogo() {
|
retrieveLogo() {
|
||||||
this.logo = window.getComputedStyle(document.querySelector('#nextcloud .logo'), null)
|
const ncLogo = document.querySelector('#nextcloud .logo')
|
||||||
.getPropertyValue('background-image')
|
|
||||||
.replace('url("', '')
|
if (ncLogo) {
|
||||||
.replace('")', '')
|
const url = window.getComputedStyle(ncLogo, null)
|
||||||
|
.getPropertyValue('background-image')
|
||||||
|
.replace('url("', '')
|
||||||
|
.replace('")', '')
|
||||||
|
|
||||||
|
if (url && url !== 'none') {
|
||||||
|
this.logo = url
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
|||||||
+6
-5
@@ -20,6 +20,7 @@ const elements = [
|
|||||||
'side-menu-current-app-background-color',
|
'side-menu-current-app-background-color',
|
||||||
'side-menu-text-color',
|
'side-menu-text-color',
|
||||||
'side-menu-opener',
|
'side-menu-opener',
|
||||||
|
'side-menu-display-logo',
|
||||||
'side-menu-cache',
|
'side-menu-cache',
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -42,7 +43,7 @@ const saveSettings = (key) => {
|
|||||||
t('side_menu', (key + 1) + '/' + size)
|
t('side_menu', (key + 1) + '/' + size)
|
||||||
)
|
)
|
||||||
|
|
||||||
if (key < size -1) {
|
if (key < size - 1) {
|
||||||
saveSettings(++key)
|
saveSettings(++key)
|
||||||
} else {
|
} else {
|
||||||
OC.msg.finishedSuccess(selector, t('side_menu', 'Saved'))
|
OC.msg.finishedSuccess(selector, t('side_menu', 'Saved'))
|
||||||
@@ -55,10 +56,10 @@ const saveSettings = (key) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(() => {
|
$(document).ready(() => {
|
||||||
$('#side-menu-save').on('click', (event) => {
|
$('#side-menu-save').on('click', (event) => {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
OC.msg.startSaving(selector)
|
OC.msg.startSaving(selector)
|
||||||
|
|
||||||
saveSettings(0)
|
saveSettings(0)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
+5
-2
@@ -15,13 +15,16 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const sideMenuContainer = $('<div id="side-menu">')
|
const sideMenuContainer = $('<div id="side-menu-container">')
|
||||||
const sideMenuOpener = $('<button class="side-menu-opener"></button>')
|
const sideMenuOpener = $('<button class="side-menu-opener"></button>')
|
||||||
|
const sideMenu = $('<div id="side-menu">')
|
||||||
|
|
||||||
|
sideMenuContainer.append(sideMenu);
|
||||||
|
|
||||||
$('body').append(sideMenuContainer);
|
$('body').append(sideMenuContainer);
|
||||||
|
|
||||||
sideMenuOpener.insertBefore('#nextcloud');
|
sideMenuOpener.insertBefore('#nextcloud');
|
||||||
|
|
||||||
$('body').on('click', '.side-menu-opener', () => {
|
$('body').on('click', '.side-menu-opener', () => {
|
||||||
$('#side-menu').toggleClass('is-active');
|
$('#side-menu').toggleClass('open');
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
:root {
|
||||||
|
<?php foreach ($_['vars'] as $key => $value): ?>
|
||||||
|
<?php if ($key === 'opener'): ?>
|
||||||
|
--side-menu-<?php echo $key ?>: url('<?php echo $_['assetsRoot'] ?>/img/<?php echo $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;
|
||||||
|
}
|
||||||
|
<?php endif; ?>
|
||||||
@@ -86,6 +86,29 @@ style('side_menu', 'admin');
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label for="side-menu-opener" class="settings-hint">
|
||||||
|
<?php p($l->t('Display the logo')); ?>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$choices = [
|
||||||
|
'Yes' => '1',
|
||||||
|
'No' => '0',
|
||||||
|
];
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<select id="side-menu-display-logo" name="display-logo">
|
||||||
|
<?php foreach ($choices 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>
|
||||||
|
|
||||||
<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']); ?>">
|
||||||
|
|
||||||
<button id="side-menu-save" class="btn btn-primary"><?php p($l->t('Save')); ?></button>
|
<button id="side-menu-save" class="btn btn-primary"><?php p($l->t('Save')); ?></button>
|
||||||
|
|||||||
Reference in New Issue
Block a user