Compare commits

..

8 Commits

Author SHA1 Message Date
Simon Vieille cc2ab04035 release v1.12.0 2020-09-12 16:44:05 +02:00
Simon Vieille 17a57f3685 Merge branch 'feature/issue30-tab' into develop 2020-09-12 16:40:43 +02:00
Simon Vieille d41ecbbd9a add translations 2020-09-12 16:35:30 +02:00
Simon Vieille b6c6fc2486 add target _blank 2020-09-12 16:32:10 +02:00
Simon Vieille 918c55da3e add options to select apps that must be opend on new tab (UI) 2020-09-12 16:10:48 +02:00
Simon Vieille 385c27c691 add documentation 2020-09-11 13:46:48 +02:00
Simon Vieille 54d702ba9f add documentation 2020-09-11 13:46:25 +02:00
Simon Vieille c816c40c19 fix typo 2020-09-11 13:39:41 +02:00
18 changed files with 127 additions and 33 deletions
+2
View File
@@ -12,6 +12,8 @@ Comptatible with AppOrder.
* [How to contribute?](#how-to-contribute)
* [Screenshots](https://gitnet.fr/deblan/side_menu/src/branch/master/screenshots/)
You like this app and you want to support me? [Buy me a coffe](https://www.buymeacoffee.com/deblan) ☕
Installation and upgrade
------------------------
+1 -1
View File
@@ -17,7 +17,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.11.0</version>
<version>1.12.0</version>
<namespace>SideMenu</namespace>
<category>customization</category>
<website>https://gitnet.fr/deblan/side_menu</website>
+4
View File
@@ -64,3 +64,7 @@
font-size: 11px;
font-weight: normal;
}
.side-menu-toggler {
cursor: pointer;
}
+6 -5
View File
@@ -54,7 +54,7 @@ class JsController extends Controller
{
$user = OC::$server[IUserSession::class]->getUser();
$topMenuApps = (array) json_decode($this->config->getAppValue('side_menu', 'top-menu-apps', '[]'), true);
$targetBlank = (bool) $this->config->getAppValue('side_menu', 'target-blank', '0');
$targetBlankApps = (array) json_decode($this->config->getAppValue('side_menu', 'target-blank-apps', '[]'), true);
if ($user) {
$userTopMenuApps = (array) json_decode($this->config->getUserValue($user->getUid(), 'side_menu', 'top-menu-apps', '[]'), true);
@@ -63,10 +63,11 @@ class JsController extends Controller
$topMenuApps = $userTopMenuApps;
}
$userTargetBlank = (int) $this->config->getUserValue($user->getUid(), 'side_menu', 'target-blank', '-1');
$userTargetBlankMode = (int) $this->config->getUserValue($user->getUid(), 'side_menu', 'target-blank-mode', '1');
$userTargetBlankApps = (array) json_decode($this->config->getUserValue($user->getUid(), 'side_menu', 'target-blank-apps', '[]'), true);
if ($userTargetBlank !== -1) {
$targetBlank = (bool) $userTargetBlank;
if ($userTargetBlankMode === 2) {
$targetBlankApps = $userTargetBlankApps;
}
}
@@ -81,7 +82,7 @@ class JsController extends Controller
'always-displayed' => (bool) $this->config->getAppValue('side_menu', 'always-displayed', '0'),
'big-menu' => (bool) $this->config->getAppValue('side_menu', 'big-menu', '0'),
'top-menu-apps' => $topMenuApps,
'target-blank' => $targetBlank,
'target-blank-apps' => $targetBlankApps,
];
$response = new TemplateResponse('side_menu', 'js/script', $parameters, 'blank');
+18 -3
View File
@@ -65,11 +65,26 @@ class PersonalSettingController extends Controller
}
}
if ('target-blank' === $name) {
if ('target-blank-mode' === $name) {
$doSave = true;
if (!in_array($value, ['-1', '0', '1'])) {
$value = '-1';
if (!in_array($value, ['1', '2'])) {
$value = '1';
}
}
if ('target-blank-apps' === $name) {
$doSave = true;
$data = json_decode($value, true);
if (!is_array($data)) {
$doSave = false;
} else {
foreach ($data as $v) {
if (!is_string($v)) {
$doSave = false;
}
}
}
}
+1 -1
View File
@@ -75,7 +75,6 @@ class Admin implements ISettings
'cache' => $this->config->getAppValue('side_menu', 'cache', '0'),
'opener' => $this->config->getAppValue('side_menu', 'opener', 'side-menu-opener'),
'always-displayed' => $this->config->getAppValue('side_menu', 'always-displayed', '0'),
'target-blank' => $this->config->getAppValue('side_menu', 'target-blank', '0'),
'big-menu' => $this->config->getAppValue('side_menu', 'big-menu', '0'),
'display-logo' => $this->config->getAppValue('side_menu', 'display-logo', '1'),
'opener-position' => $this->config->getAppValue('side_menu', 'opener-position', 'before'),
@@ -84,6 +83,7 @@ class Admin implements ISettings
'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-text' => $this->config->getAppValue('side_menu', 'size-text', 'normal'),
'target-blank-apps' => (array) json_decode($this->config->getAppValue('side_menu', 'target-blank-apps', '[]'), true),
'top-menu-apps' => (array) json_decode($this->config->getAppValue('side_menu', 'top-menu-apps', '[]'), true),
'apps' => $this->appRepository->getVisibleApps(),
];
+2 -1
View File
@@ -72,7 +72,8 @@ class Personal implements ISettings
$parameters = [
'enabled' => $this->config->getUserValue($user->getUid(), 'side_menu', 'enabled', '1'),
'top-menu-apps' => (array) json_decode($this->config->getUserValue($user->getUid(), 'side_menu', 'top-menu-apps', '[]'), true),
'target-blank' => $this->config->getUserValue($user->getUid(), 'side_menu', 'target-blank', '-1'),
'target-blank-mode' => $this->config->getUserValue($user->getUid(), 'side_menu', 'target-blank-mode', '1'),
'target-blank-apps' => (array) json_decode($this->config->getUserValue($user->getUid(), 'side_menu', 'target-blank-apps', '[]'), true),
'apps' => $this->appRepository->getVisibleApps(),
];
Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 KiB

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 57 KiB

+3 -2
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" :target="targetBlank ? '_blank' : undefined" v-bind:title="app.name">
<a v-bind:href="app.href" :target="targetBlankApps.indexOf(app.id) !== -1 ? '_blank' : undefined" 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>
@@ -87,6 +87,7 @@ export default {
}
this.apps.push({
id: dataId,
href: href,
name: trim(element.querySelector('span').innerHTML),
icon: svg,
@@ -120,7 +121,7 @@ export default {
this.retrieveApps()
this.retrieveLogo()
this.forceLightIcon = document.querySelector('#side-menu-container').getAttribute('data-forcelighticon') == 1;
this.targetBlank = document.querySelector('#side-menu-container').getAttribute('data-targetblank') == 1;
this.targetBlankApps = document.querySelector('#side-menu-container').getAttribute('data-targetblankapps').split(',');
const menu = document.querySelector('#appmenu')
+2 -2
View File
@@ -28,7 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<ul class="side-menu-apps-list">
<li v-bind:class="{'side-menu-app': true, 'active': activeApp === appId}" v-for="(app, appId) in category.apps">
<a v-bind:href="app.href" :target="targetBlank ? '_blank' : undefined" v-bind:title="app.name">
<a v-bind:href="app.href" :target="targetBlankApps.indexOf(appId) !== -1 ? '_blank' : undefined" v-bind:title="app.name">
<img class="side-menu-app-icon" v-bind:src="app.icon"></span>
<span class="side-menu-app-text" v-html="app.name"></span>
</a>
@@ -80,7 +80,7 @@ export default {
},
},
mounted() {
this.targetBlank = document.querySelector('#side-menu-container').getAttribute('data-targetblank') == 1;
this.targetBlankApps = document.querySelector('#side-menu-container').getAttribute('data-targetblankapps').split(',');
this.retrieveApps()
this.retrieveActiveApp()
+11
View File
@@ -81,6 +81,10 @@ const saveSettings = (key) => {
}
}
const elementToggler = (element) => {
jQuery(element).toggle()
}
jQuery(document).ready(() => {
elements = jQuery('.side-menu-setting')
@@ -118,4 +122,11 @@ jQuery(document).ready(() => {
document.documentElement.style.setProperty('--side-menu-' + name, value)
})
jQuery('.side-menu-toggler').on('click', (event) => {
var target = jQuery(event.target)
var element = target.attr('data-target')
elementToggler(element)
})
});
+2
View File
@@ -54,3 +54,5 @@
"Live preview": "Live Vorschau"
"Open apps in new tab": "Öffnen Sie Apps in einem neuen Tab"
"Use the global setting": "Verwenden Sie die globale Einstellung"
"Use my selection": "Verwenden Sie meine Auswahl"
"Show and hide the list of applications": "Ein- und Ausblenden der Anwendungsliste"
+2
View File
@@ -54,3 +54,5 @@
"Live preview": "Aperçu en direct"
"Open apps in new tab": "Ouvrir les applications dans un nouvel onglet"
"Use the global setting": "Utiliser la configuration globale"
"Use my selection": "Utiliser ma sélection"
"Show and hide the list of applications": "Afficher et masquer la liste des applications"
+4
View File
@@ -38,6 +38,10 @@ var updateTopMenu = function() {
appShown.push(app)
navigationApps.append(app.outerHTML)
}
if (targetBlankApps.indexOf(dataId) !== -1) {
jQuery(app).children('a').attr('target', '_blank');
}
})
var rightHeaderWidth = jQuery('.header-right').outerWidth()
+3 -3
View File
@@ -14,9 +14,9 @@
sideMenuContainer.attr('data-forcelighticon', '1')
<?php endif; ?>
<?php if ($_['target-blank']): ?>
sideMenuContainer.attr('data-targetblank', '1')
<?php endif; ?>
sideMenuContainer.attr('data-targetblankapps', '<?php p(implode(',', $_['target-blank-apps'])) ?>')
var targetBlankApps = <?php echo json_encode($_['target-blank-apps']) ?>;
body.on('side-menu.apps', function(e, apps) {
<?php if ($_['hide-when-no-apps']): ?>
+31 -9
View File
@@ -372,16 +372,32 @@ $choicesSizes = [
</label>
</div>
<div>
<select id="side-menu-loader-enabled" name="target-blank" class="side-menu-setting">
<?php foreach ($choicesYesNo as $label => $value): ?>
<option value="<?php echo $value ?>" <?php if ($value === $_['target-blank']): ?>selected<?php endif; ?>>
<?php echo $l->t($label); ?>
</option>
<?php endforeach; ?>
</select>
<p>
<a class="side-menu-toggler" data-target="#target-blank-apps" href="#_">
🖱️ <?php p($l->t('Show and hide the list of applications')); ?>
</a>
</p>
<div class="side-menu-setting" data-name="target-blank-apps" id="target-blank-apps" data-checkbox style="display: none">
<?php foreach ($_['apps'] as $app): ?>
<div>
<input
type="checkbox"
name="target-blank-apps[]"
value="<?php echo $app['id'] ?>"
id="target-blank-app-<?php echo $app['id'] ?>"
<?php if (in_array($app['id'], $_['target-blank-apps'])): ?>checked<?php endif; ?>
/>
<label for="target-blank-app-<?php echo $app['id'] ?>">
<?php echo p($l->t($app['name'])); ?>
</label>
</div>
<?php endforeach; ?>
</div>
<br>
<div>
<label for="side-menu-loader-enabled">
<?php p($l->t('Loader enabled')); ?>
@@ -409,7 +425,13 @@ $choicesSizes = [
</label>
</div>
<div class="side-menu-setting" data-name="top-menu-apps" data-checkbox>
<p>
<a class="side-menu-toggler" data-target="#top-menu-apps" href="#_">
🖱️ <?php p($l->t('Show and hide the list of applications')); ?>
</a>
</p>
<div class="side-menu-setting" data-name="top-menu-apps" id="top-menu-apps" data-checkbox style="display: none">
<?php foreach ($_['apps'] as $app): ?>
<div>
<input
+35 -6
View File
@@ -61,19 +61,42 @@ $choicesYesNo = [
<div>
<?php $choices = [
'Use global setting' => '-1',
'No' => '0',
'Yes' => '1',
'Use the global setting' => '1',
'Use my selection' => '2',
]; ?>
<select id="side-menu-loader-enabled" name="target-blank" class="side-menu-setting" data-personal>
<select id="side-menu-loader-enabled" name="target-blank-mode" class="side-menu-setting" data-personal>
<?php foreach ($choices as $label => $value): ?>
<option value="<?php echo $value ?>" <?php if ($value === $_['target-blank']): ?>selected<?php endif; ?>>
<option value="<?php echo $value ?>" <?php if ($value === $_['target-blank-mode']): ?>selected<?php endif; ?>>
<?php echo $l->t($label); ?>
</option>
<?php endforeach; ?>
</select>
</div>
<p>
<a class="side-menu-toggler" data-target="#target-blank-apps" href="#_">
🖱️ <?php p($l->t('Show and hide the list of applications')); ?>
</a>
</p>
<div class="side-menu-setting" data-name="target-blank-apps" id="target-blank-apps" data-personal data-checkbox style="display: none">
<?php foreach ($_['apps'] as $app): ?>
<div>
<input
type="checkbox"
name="target-blank-apps[]"
value="<?php echo $app['id'] ?>"
id="target-blank-app-<?php echo $app['id'] ?>"
<?php if (in_array($app['id'], $_['target-blank-apps'])): ?>checked<?php endif; ?>
/>
<label for="target-blank-app-<?php echo $app['id'] ?>">
<?php echo p($l->t($app['name'])); ?>
</label>
</div>
<?php endforeach; ?>
</div>
</div>
<div class="section">
@@ -92,7 +115,13 @@ $choicesYesNo = [
</em>
</p>
<div class="side-menu-setting" data-name="top-menu-apps" data-checkbox data-personal>
<p>
<a class="side-menu-toggler" data-target="#top-menu-apps" href="#_">
🖱️ <?php p($l->t('Show and hide the list of applications')); ?>
</a>
</p>
<div class="side-menu-setting" data-name="top-menu-apps" data-checkbox data-personal id="top-menu-apps" style="display: none">
<?php foreach ($_['apps'] as $app): ?>
<div>
<input