Browse Source

add opener-position option (issue #3)

pull/32/head
Simon Vieille 11 months ago
parent
commit
457bfc282b
Signed by: deblan GPG Key ID: 03383D15A1D31745
5 changed files with 148 additions and 102 deletions
  1. +1
    -0
      lib/Controller/JsController.php
  2. +1
    -0
      lib/Settings/Admin.php
  3. +1
    -0
      src/admin.js
  4. +6
    -1
      templates/js/script.php
  5. +139
    -101
      templates/settings/admin-form.php

+ 1
- 0
lib/Controller/JsController.php View File

@ -52,6 +52,7 @@ class JsController extends Controller
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'),
];


+ 1
- 0
lib/Settings/Admin.php View File

@ -54,6 +54,7 @@ class Admin implements ISettings
'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'),
];


+ 1
- 0
src/admin.js View File

@ -20,6 +20,7 @@ const elements = [
'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-cache',


+ 6
- 1
templates/js/script.php View File

@ -7,7 +7,12 @@
body.append(sideMenuContainer)
sideMenuContainer.append(sideMenu)
sideMenuOpener.insertBefore('#nextcloud')
<?php if ($_['opener-position'] === 'before'): ?>
sideMenuOpener.insertBefore('#nextcloud')
<?php else: ?>
sideMenuOpener.insertAfter('#nextcloud')
<?php endif; ?>
var isTouchDevice = window.matchMedia("(pointer: coarse)").matches


+ 139
- 101
templates/settings/admin-form.php View File

@ -19,115 +19,153 @@
script('side_menu', 'admin');
style('side_menu', 'admin');
$choicesYesNo = [
'No' => '0',
'Yes' => '1',
];
?>
<div id="side-menu-section" class="section">
<h2 class="inlineblock"><?php p($l->t('Side menu settings')); ?></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>
<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 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>
<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>
<?php
$choices = [
'Default' => 'side-menu-opener',
'Hamburger' => 'side-menu-opener-hamburger',
];
?>
<div>
<label for="side-menu-opener" class="settings-hint">
<?php p($l->t('Opener 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 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>
<?php
$choices = [
'No' => '0',
'Yes' => '1',
];
?>
<div>
<label for="side-menu-opener" class="settings-hint">
<?php p($l->t('Display the logo')); ?>
</label>
<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>
<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>
<div class="section">
<input type="hidden" id="side-menu-cache" name="cache" value="<?php print_unescaped($_['cache']); ?>">
<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>
<button id="side-menu-save" class="btn btn-primary"><?php p($l->t('Save')); ?></button>
<div>
<select id="side-menu-opener-hover" name="opener-hover">
<?php foreach ($choices 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>
<span id="side-menu-message" class="msg"></span>
</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>

Loading…
Cancel
Save